Skip to content

Commit

Permalink
CNJR-3496: Remove hardcoded version updates for releases
Browse files Browse the repository at this point in the history
  • Loading branch information
gl-johnson committed Feb 20, 2024
1 parent c1d196a commit 2e5230f
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 20 deletions.
22 changes: 7 additions & 15 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,22 +46,21 @@ follow the instructions in this section.

1. Review the git log and ensure the [changelog](CHANGELOG.md) contains all
relevant recent changes with references to GitHub issues or PRs, if possible.
Also ensure the latest unreleased version is accurate - our pipeline generates
a VERSION file based on the changelog, which is then used to assign the version
of the release and any release artifacts.
1. Review the changes since the last tag, and if the dependencies have changed
revise the [NOTICES](NOTICES.txt) to correctly capture the included
dependencies and their licenses / copyrights.
1. Ensure that all documentation that needs to be written has been
written by TW, approved by PO/Engineer, and pushed to the forward-facing documentation.
1. Scan the project for vulnerabilities

### Update the version, changelog, and notices
### Release and Promote

1. Create a new branch for the version bump.
1. Based on the changelog content, determine the new version number.
1. Update this version in the following files:
1. [provider.go](pkg/provider/provider.go)
1. [Chart version](helm/conjur-k8s-csi-provider/Chart.yaml)
1. Commit these changes - `Bump version to x.y.z` is an acceptable commit
message - and open a PR for review.
1. Merging into main/master branches will automatically trigger a release. If successful, this release can be promoted at a later time.
1. Jenkins build parameters can be utilized to promote a successful release or manually trigger aditional releases as needed.
1. Reference the [internal automated release doc](https://github.com/conjurinc/docs/blob/master/reference/infrastructure/automated_releases.md#release-and-promotion-process) for releasing and promoting.

### Push Helm package

Expand All @@ -70,10 +69,3 @@ follow the instructions in this section.
1. Move the Helm package file created in the previous step to the *docs* folder in the `helm-charts` repo.
1. Go to the `helm-charts` repo root folder and execute the `reindex.sh` script file located there.
1. Create a PR with those changes.

### Release and Promote

1. Merging into main/master branches will automatically trigger a release. If successful, this release can be promoted at a later time.
1. Jenkins build parameters can be utilized to promote a successful release or manually trigger aditional releases as needed.
1. Reference the [internal automated release doc](https://github.com/conjurinc/docs/blob/master/reference/infrastructure/automated_releases.md#release-and-promotion-process) for releasing and promoting.

9 changes: 9 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,15 @@ pipeline {
}
}

// Updates the helm chart and Go module version based on the VERSION file
stage('Update Project versions') {
steps {
script {
infrapool.agentSh 'bin/update_version'
}
}
}

stage('Get latest upstream dependencies') {
steps {
script {
Expand Down
13 changes: 13 additions & 0 deletions bin/update_version
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env bash

set -e

version=$(cat VERSION)
provider_file="./pkg/provider/provider.go"
chart_yaml="./helm/conjur-k8s-csi-provider/Chart.yaml"

# Update the providerVersion constant
sed -i "s/const providerVersion = \".*\"/const providerVersion = \"$version\"/" "$provider_file"

# Update the chart version
sed -i "s/version: .*/version: $version/" "$chart_yaml"
4 changes: 2 additions & 2 deletions helm/conjur-k8s-csi-provider/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v1
description: A Helm chart for deploying CyberArk Conjur's CSI Driver Provider
description: A Helm chart for deploying CyberArk Conjur's CSI Driver Provider
name: conjur-k8s-csi-provider
version: 0.1.0
version: 0.0-dev
home: https://github.com/cyberark/conjur-k8s-csi-provider
icon: https://www.cyberark.com/wp-content/uploads/2015/12/cybr-aim.jpg
2 changes: 1 addition & 1 deletion pkg/provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
)

const providerName = "conjur"
const providerVersion = "0.1.0"
const providerVersion = "0.0-dev"
const saTokensKey = "csi.storage.k8s.io/serviceAccount.tokens"
const configurationVersionKey = "conjur.org/configurationVersion"

Expand Down
9 changes: 7 additions & 2 deletions pkg/provider/provider_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"errors"
"fmt"
"os"
"testing"

"github.com/cyberark/conjur-k8s-csi-provider/pkg/conjur"
Expand Down Expand Up @@ -195,14 +196,18 @@ func TestVersion(t *testing.T) {
},
},
{
description: "response includes hardcoded provider details",
description: "response includes provider details",
req: &v1alpha1.VersionRequest{
Version: "0.0.test",
},
assertions: func(t *testing.T, resp *v1alpha1.VersionResponse, err error) {
assert.Nil(t, err)
assert.Equal(t, "conjur", resp.RuntimeName)
assert.Equal(t, "0.1.0", resp.RuntimeVersion)
expectedVersion, err := os.ReadFile("/conjur-k8s-csi-provider/VERSION")
if err != nil {
expectedVersion = []byte("0.0-dev")
}
assert.Equal(t, string(expectedVersion), resp.RuntimeVersion)
},
},
}
Expand Down

0 comments on commit 2e5230f

Please sign in to comment.