Skip to content

Commit

Permalink
fix: configure helmfile promotion per env
Browse files Browse the repository at this point in the history
  • Loading branch information
cameronbraid committed Jan 27, 2021
1 parent 39987f2 commit e7959cf
Show file tree
Hide file tree
Showing 27 changed files with 78 additions and 201 deletions.
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

0 comments on commit e7959cf

Please sign in to comment.