Skip to content

Commit dd46426

Browse files
Verification of helm charts post publish (#15) (#16)
Added below checks to the release pipeline verification of chart versions post publish feature deployment through published charts
1 parent 41d1571 commit dd46426

File tree

1 file changed

+51
-4
lines changed

1 file changed

+51
-4
lines changed

.github/workflows/release.yaml

Lines changed: 51 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,15 @@ jobs:
1313
IMAGE_REGISTRY: ${{ vars.IMAGE_REGISTRY }}
1414
secrets: inherit
1515
image-publish:
16+
name: Tag image with release tag and push to repo
17+
if: github.event.ref == 'refs/heads/main'
1618
runs-on: ubuntu-latest
1719
needs: ["build"]
1820
env:
19-
IMAGE_PATH : ${{ needs.build.outputs.IMAGE_PATH }}
21+
IMAGE_PATH: ${{ needs.build.outputs.IMAGE_PATH }}
22+
outputs:
23+
PROVIDER_IMAGE_REPO: ${{ env.PROVIDER_IMAGE_REPO }}
24+
PROVIDER_IMAGE_NEW_TAG: ${{ env.PROVIDER_IMAGE_NEW_TAG }}
2025
steps:
2126

2227
- name: Log into GitHub Container Registry
@@ -34,6 +39,14 @@ jobs:
3439
docker tag ${{ env.IMAGE_PATH }} ${{ env.PROVIDER_IMAGE_REPO }}:${{ env.PROVIDER_IMAGE_NEW_TAG }}
3540
docker push ${{ env.PROVIDER_IMAGE_REPO }}:${{ env.PROVIDER_IMAGE_NEW_TAG }}
3641
42+
charts-publish:
43+
runs-on: ubuntu-latest
44+
needs: ["build", "image-publish"]
45+
env:
46+
IMAGE_PATH : ${{ needs.build.outputs.IMAGE_PATH }}
47+
PROVIDER_IMAGE_REPO: ${{ needs.image-publish.outputs.PROVIDER_IMAGE_REPO }}
48+
PROVIDER_IMAGE_NEW_TAG: ${{ needs.image-publish.outputs.PROVIDER_IMAGE_NEW_TAG }}
49+
steps:
3750
- name: Checkout
3851
uses: actions/[email protected]
3952
with:
@@ -52,7 +65,41 @@ jobs:
5265
-e 's|tag:.*|tag: ${{ env.PROVIDER_IMAGE_NEW_TAG }}|' \
5366
charts/oci-secrets-store-csi-driver-provider/values.yaml
5467
helm package charts/oci-secrets-store-csi-driver-provider -d charts
55-
helm repo index --url https://${GITHUB_ACTOR,,}.github.io/oci-secrets-store-csi-driver-provider/charts --merge charts/index.yaml charts
68+
mkdir temp-charts
69+
helm repo index --url ${{ vars.HELM_CHARTS_REPO }}/charts --merge charts/index.yaml temp-charts
70+
mv temp-charts/index.yaml charts/index.yaml
5671
git add charts
57-
git commit -m "Releasing chart version: ${{ github.ref_name }}"
58-
git push -u origin gh-pages
72+
git commit -m "Releasing version: ${{ github.ref_name }}"
73+
git push -u origin gh-pages
74+
75+
- name: verify published chart version
76+
run: |
77+
helm repo add oci-provider ${{ vars.HELM_CHARTS_REPO }}/charts
78+
PUBLISHED_CHART_VERSION=`helm search repo oci-provider/oci-secrets-store-csi-driver-provider | grep ^oci | awk '{print $2}'`
79+
LOCAL_CHART_VERSION=`grep "^version: " charts/oci-secrets-store-csi-driver-provider/Chart.yaml | sed -e "s/version: //"`
80+
echo "PUBLISHED_CHART_VERSION=$PUBLISHED_CHART_VERSION"
81+
echo "LOCAL_CHART_VERSION=$LOCAL_CHART_VERSION"
82+
if [ "${PUBLISHED_CHART_VERSION}" != "${LOCAL_CHART_VERSION}" ];
83+
then
84+
echo "published version and local versions are not matching"
85+
exit 1
86+
else
87+
echo "published version and local versions are matching"
88+
fi
89+
90+
charts-deploy:
91+
runs-on: ubuntu-latest
92+
needs: [ "charts-publish"]
93+
steps:
94+
- name: Create k8s Kind Cluster
95+
uses: helm/[email protected]
96+
97+
- name: get nodes
98+
run: kubectl get nodes
99+
100+
- name: deploy helm chart
101+
run: |
102+
helm repo add oci-provider ${{ vars.HELM_CHARTS_REPO }}/charts
103+
helm install oci-provider oci-provider/oci-secrets-store-csi-driver-provider -n kube-system
104+
kubectl get daemonset -n kube-system \
105+
--selector='app.kubernetes.io/name in (oci-secrets-store-csi-driver-provider, secrets-store-csi-driver)'

0 commit comments

Comments
 (0)