-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add namespace field to App Will be used to store the Cloud Platform namespace name. Adds migrations that add the field, then a data migration to add values for existing apps, then finally a third migration to require values when creating a new object. * Add namespace field to the register app form Adds the field in the HTML. Update the OIDC template to use the entered namespace when creating the app IAM role. * Add APP_ROLE_ARN secret after creating role Updates the create app role task handler to pass a github api token, so this can be used to create the APP_ROLE_ARN secret as soon as the App role is created. This is required for apps that will be deployed without Auth0 clients.
- Loading branch information
1 parent
1ef2172
commit c5e9669
Showing
16 changed files
with
144 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Generated by Django 4.2.7 on 2024-02-20 16:00 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("api", "0031_add_soft_delete_fields"), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name="app", | ||
name="namespace", | ||
field=models.CharField(blank=True, max_length=63, null=True, unique=True), | ||
), | ||
] |
20 changes: 20 additions & 0 deletions
20
controlpanel/api/migrations/0033_add_namespaces_values_to_apps.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Generated by Django 4.2.7 on 2024-02-20 16:01 | ||
|
||
from django.db import migrations | ||
|
||
|
||
def add_namespaces(apps, schema_editor): | ||
App = apps.get_model("api", "App") | ||
for app in App.objects.all(): | ||
app.namespace = f"data-platform-app-{app.slug}" | ||
app.save() | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("api", "0032_app_namespace"), | ||
] | ||
|
||
operations = [ | ||
migrations.RunPython(code=add_namespaces, reverse_code=migrations.RunPython.noop) | ||
] |
17 changes: 17 additions & 0 deletions
17
controlpanel/api/migrations/0034_remove_null_blank_from_namespace.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Generated by Django 4.2.7 on 2024-02-20 16:11 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("api", "0033_add_namespaces_values_to_apps"), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name="app", | ||
name="namespace", | ||
field=models.CharField(max_length=63, unique=True), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -61,10 +61,10 @@ def test_slug_characters_replaced(): | |
|
||
@pytest.mark.django_db | ||
def test_slug_collisions_increments(): | ||
app = App.objects.create(repo_url="[email protected]:org/foo-bar.git") | ||
app = App.objects.create(repo_url="[email protected]:org/foo-bar.git", namespace="foo-bar") | ||
assert "foo-bar" == app.slug | ||
|
||
app2 = App.objects.create(repo_url="https://www.example.com/org/foo-bar") | ||
app2 = App.objects.create(repo_url="https://www.example.com/org/foo-bar", namespace="foo-bar-2") | ||
assert "foo-bar-2" == app2.slug | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters