Skip to content

Commit dd45da5

Browse files
committed
don't need to create a CABOTAGE_SENTINEL when setting up a branch
1 parent 953f3e6 commit dd45da5

1 file changed

Lines changed: 4 additions & 23 deletions

File tree

cabotage/celery/tasks/branch_deploy.py

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
from kubernetes.client.rest import ApiException
77

88
from cabotage.server import (
9-
config_writer,
109
db,
1110
github_app,
1211
kubernetes as kubernetes_ext,
@@ -34,10 +33,11 @@ def _create_app_env_for_branch_deploy(
3433
project,
3534
auto_deploy_branch=None,
3635
):
37-
"""Create ApplicationEnvironment + sentinel + shared configs for a branch deploy.
36+
"""Create ApplicationEnvironment for a branch deploy.
3837
39-
Configs from the base environment are shared by pointing at the same
40-
Vault/Consul key_slugs rather than copying values.
38+
Configuration objects are copied from the base environment, sharing the same
39+
Consul/Vault key_slugs. The CabotageEnrollment inheritsFrom grants access
40+
to the base namespace's secrets.
4141
"""
4242
base_app_env = ApplicationEnvironment.query.filter_by(
4343
application_id=application.id,
@@ -55,27 +55,8 @@ def _create_app_env_for_branch_deploy(
5555
db.session.add(app_env)
5656
db.session.flush()
5757

58-
ns = safe_k8s_name(organization.k8s_identifier, environment.k8s_identifier)
59-
prefix = safe_k8s_name(project.k8s_identifier, application.k8s_identifier)
60-
61-
sentinel = Configuration(
62-
application_id=application.id,
63-
application_environment_id=app_env.id,
64-
name="CABOTAGE_SENTINEL",
65-
value="at least one environment variable must exist",
66-
secret=False,
67-
buildtime=False,
68-
)
69-
key_slugs = config_writer.write_configuration(ns, prefix, sentinel)
70-
sentinel.key_slug = key_slugs["config_key_slug"]
71-
sentinel.build_key_slug = key_slugs["build_key_slug"]
72-
db.session.add(sentinel)
73-
db.session.flush()
74-
7558
if base_app_env:
7659
for config in base_app_env.configurations:
77-
if config.name == "CABOTAGE_SENTINEL":
78-
continue
7960
shared_config = Configuration(
8061
application_id=application.id,
8162
application_environment_id=app_env.id,

0 commit comments

Comments
 (0)