Skip to content

Commit

Permalink
Merge pull request #4083 from zendesk/adammw/dynamic-role-config-subst
Browse files Browse the repository at this point in the history
Substitute $environment in k8s role config file
  • Loading branch information
adammw committed Dec 6, 2023
2 parents 12e8a4c + 481d48d commit a4f9283
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion plugins/kubernetes/app/models/kubernetes/role.rb
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,12 @@ def defaults
# allows passing the project to reuse the repository cache when doing multiple lookups
def role_config_file(reference, deploy_group:, project: project(), **args) # rubocop:disable Style/MethodCallWithoutArgsParentheses
file = config_file
file = file.sub('$deploy_group', deploy_group.env_value) if deploy_group && dynamic_folders?
if deploy_group && dynamic_folders?
file = file.
sub('$deploy_group', deploy_group.env_value).
sub('$environment', deploy_group.environment.permalink)
end

self.class.role_config_file(project, file, reference, **args)
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<fieldset>
<%= form.input :name %>
<%= form.input :config_file, help: "Can use $deploy_group substitution to have a dynamic file path." %>
<%= form.input :config_file, help: "Can use <code>$deploy_group</code> and <code>$environment</code> substitutions to have a dynamic file path." %>
<% if @project.override_resource_names? %>
<%= form.input :service_name, help: "Override service name with this name. Uses name from yml file if it starts with this name." %>
<%= form.input :resource_name,
Expand Down

0 comments on commit a4f9283

Please sign in to comment.