Skip to content

Commit ea29075

Browse files
authored
chore: render latest environment template version instead of hardcoding it (#2617)
Previously we have to make changes to two places when we need to update the environment template version, one being the `environment/cf.yml` template, the other being the variable `deploy.LatestEnvTemplateVersion` By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
1 parent 092a626 commit ea29075

File tree

5 files changed

+6
-2
lines changed

5 files changed

+6
-2
lines changed

internal/pkg/deploy/cloudformation/stack/env.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ func (e *EnvStackConfig) Template() (string, error) {
102102
ImportVPC: e.in.ImportVPCConfig,
103103
VPCConfig: vpcConf,
104104
Version: e.in.Version,
105+
LatestVersion: deploy.LatestEnvTemplateVersion,
105106
}, template.WithFuncs(map[string]interface{}{
106107
"inc": template.IncFunc,
107108
}))

internal/pkg/deploy/cloudformation/stack/env_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ func TestEnv_Template(t *testing.T) {
4141
PrivateSubnetCIDRs: strings.Split(DefaultPrivateSubnetCIDRs, ","),
4242
PublicSubnetCIDRs: strings.Split(DefaultPublicSubnetCIDRs, ","),
4343
},
44+
LatestVersion: deploy.LatestEnvTemplateVersion,
4445
}, gomock.Any()).Return(&template.Content{Buffer: bytes.NewBufferString("mockTemplate")}, nil)
4546
e.parser = m
4647
},

internal/pkg/deploy/env.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const (
1313
// LegacyEnvTemplateVersion is the version associated with the environment template before we started versioning.
1414
LegacyEnvTemplateVersion = "v0.0.0"
1515
// LatestEnvTemplateVersion is the latest version number available for environment templates.
16-
LatestEnvTemplateVersion = "v1.5.0"
16+
LatestEnvTemplateVersion = "v1.5.1"
1717
)
1818

1919
// CreateEnvironmentInput holds the fields required to deploy an environment.

internal/pkg/template/env.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ type EnvOpts struct {
4141

4242
ImportVPC *config.ImportVPC
4343
VPCConfig *config.AdjustVPC
44+
45+
LatestVersion string
4446
}
4547

4648
// ParseEnv parses an environment's CloudFormation template with the specified data object and returns its content.

templates/environment/cf.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# SPDX-License-Identifier: MIT-0
33
Description: CloudFormation environment template for infrastructure shared among Copilot workloads.
44
Metadata:
5-
Version: 'v1.5.1'
5+
Version: {{ .LatestVersion }}
66
Parameters:
77
AppName:
88
Type: String

0 commit comments

Comments
 (0)