Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Helmfile promote config per env #263

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions docs/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -286,13 +286,13 @@ same cluster using the same git repository URL as the dev environment</p>
</tr>
<tr>
<td>
<code>keepOldReleases</code></br>
<code>KeepOldVersions</code></br>
<em>
bool
[]string
</em>
</td>
<td>
<p>KeepOldReleases if specified will cause the old releases to be retailed in the helfile</p>
<p>KeepOldVersions if specified will cause the named repo/release releases to be retailed in the helmfile</p>
</td>
</tr>
</tbody>
Expand Down
1 change: 1 addition & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -761,6 +761,7 @@ github.com/jenkins-x/jx-api/v4 v4.0.23 h1:GpgytvBXbHVGaeqsRLGl9f1v8vpxMsTWlZNPyh
github.com/jenkins-x/jx-api/v4 v4.0.23/go.mod h1:IC88X+24Nmexuj7lRNRgzfrchzlo0qysfwkICpqDmMQ=
github.com/jenkins-x/jx-gitops v0.0.530 h1:qIPmrZrg8McYFEMYn0cNfqVKYr78gAxN1LAeFxZdUDk=
github.com/jenkins-x/jx-gitops v0.0.530/go.mod h1:GONXzTOpVG0e51/clom1j8MdOWHBhh67NvboIzfbANI=
github.com/jenkins-x/jx-gitops v0.0.531 h1:0UEuvAf40TBmA3lQOWJ4iFUP8re/qygs17Pgpc69+yM=
github.com/jenkins-x/jx-gitops v0.0.531/go.mod h1:GONXzTOpVG0e51/clom1j8MdOWHBhh67NvboIzfbANI=
github.com/jenkins-x/jx-helpers/v3 v3.0.64 h1:2tKXtb3B20hZzB+pnhptU/Zb5HzFm2G4/CJLZLZRnTE=
github.com/jenkins-x/jx-helpers/v3 v3.0.64/go.mod h1:J3nlpCzSkrVayft16okG3bX9BtWdC7sFWBseKUyC+F8=
Expand Down
4 changes: 0 additions & 4 deletions pkg/apis/promote/v1alpha1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,6 @@ type HelmfileRule struct {
// same cluster using the same git repository URL as the dev environment
Namespace string `json:"namespace"`

// KeepOldReleases if specified will cause the old releases to be retailed in the helfile
// Deprecated : use KeepOldVersions
KeepOldReleases bool `json:"keepOldReleases"`

// KeepOldVersions if specified is a list of release names and if the release name is in this list then the old versions are kept
KeepOldVersions []string `json:"keepOldVersions"`
}
Expand Down
2 changes: 2 additions & 0 deletions pkg/promoteconfig/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ func Discover(dir, promoteNamespace string) (*v1alpha1.Promote, string, error) {
if err != nil {
return nil, "", errors.Wrapf(err, "failed to find helmfile")
}

config = &v1alpha1.Promote{
ObjectMeta: metav1.ObjectMeta{
Name: "generated",
Expand All @@ -59,6 +60,7 @@ func Discover(dir, promoteNamespace string) (*v1alpha1.Promote, string, error) {
},
},
}

return config, "", nil
}

Expand Down
3 changes: 3 additions & 0 deletions pkg/rules/factory/factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ func TestRuleFactory(t *testing.T) {
if name == "jenkins-x-versions" {
continue
}
if name != "helmfile-per-env-keep-old-version" {
continue
}

dir := filepath.Join(tmpDir, name)

Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ repositories:
releases:
- chart: dev/myapp
version: 1.2.3
name: myapp-1-2-3
name: myapp-1.2.3
templates: {}
renderedvalues: {}
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ repositories:
releases:
- chart: dev/myapp
version: 1.2.3
name: myapp-1-2-3
name: myapp-1.2.3
- chart: dev/myapp
version: 1.2.4
name: myapp-1-2-4
name: myapp-1.2.4
templates: {}
renderedvalues: {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
apiVersion: promote.jenkins-x.io/v1alpha1
kind: HelmfilePromote
spec:
keepOldVersions:
- dev/myapp
Loading