Skip to content

Commit 3cb51ea

Browse files
committed
ci(workflow): enhance helm chart packaging and preparation
- Adds new environment variables for helm chart configuration. - Prepares directories for artifact storage to streamline builds. - Updates helm-related steps to include build versioning for charts. - Ensures all helm commands use the new environment variables for consistency.
1 parent 4062e71 commit 3cb51ea

File tree

1 file changed

+43
-37
lines changed

1 file changed

+43
-37
lines changed

.github/workflows/pipeline.yaml

Lines changed: 43 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ concurrency:
2424
cancel-in-progress: true
2525

2626
env:
27+
helm_chart: "reflector"
28+
helm_chart_dir: "src/helm/reflector"
29+
30+
2731
containerImage: "kubernetes-reflector"
2832
containerImageBuildContext: "src/"
2933
containerImageBuildDockerfile: "src/ES.Kubernetes.Reflector/Dockerfile"
@@ -150,6 +154,12 @@ jobs:
150154
- name: checkout
151155
uses: actions/checkout@v4
152156

157+
- name: artifacts - prepare directories
158+
run: |
159+
mkdir -p .artifacts/helm
160+
mkdir -p .artifacts/kubectl
161+
mkdir -p .artifacts/artifacthub
162+
153163
- name: tools - dotnet - install
154164
uses: actions/setup-dotnet@v4
155165
with:
@@ -185,52 +195,48 @@ jobs:
185195
# if: ${{ needs.discovery.outputs.requiresBuildPush == 'true' }}
186196
# run: echo "${{ secrets.ES_GITHUB_PAT }}" | oras login ghcr.io -u ${{ github.actor }} --password-stdin
187197

188-
# - name: tools - helm - install
189-
# uses: azure/setup-helm@v4
198+
- name: tools - helm - install
199+
uses: azure/setup-helm@v4
190200

191-
# - name: tools - helm - login - ghcr.io
192-
# if: ${{ needs.discovery.outputs.requiresBuildPush == 'true' }}
193-
# run: echo "${{ secrets.ES_GITHUB_PAT }}" | helm registry login ghcr.io -u ${{ github.actor }} --password-stdin
201+
- name: tools - helm - login - ghcr.io
202+
if: ${{ env.build_push == 'true' }}
203+
run: echo "${{ secrets.ES_GITHUB_PAT }}" | helm registry login ghcr.io -u ${{ github.actor }} --password-stdin
194204

195-
# - name: tools - docker - login ghcr.io
196-
# if: ${{ needs.discovery.outputs.requiresBuildPush == 'true' }}
197-
# uses: docker/login-action@v3
198-
# with:
199-
# registry: ghcr.io
200-
# username: ${{ github.actor }}
201-
# password: ${{ secrets.ES_GITHUB_PAT }}
205+
- name: tools - docker - login ghcr.io
206+
if: ${{ env.build_push == 'true' }}
207+
uses: docker/login-action@v3
208+
with:
209+
registry: ghcr.io
210+
username: ${{ github.actor }}
211+
password: ${{ secrets.ES_GITHUB_PAT }}
202212

203-
# - name: tools - docker - login docker.io
204-
# if: ${{ needs.discovery.outputs.requiresBuildPush == 'true' }}
205-
# uses: docker/login-action@v3
206-
# with:
207-
# registry: docker.io
208-
# username: ${{ secrets.ES_DOCKERHUB_USERNAME }}
209-
# password: ${{ secrets.ES_DOCKERHUB_PAT }}
213+
- name: tools - docker - login docker.io
214+
if: ${{ env.build_push == 'true' }}
215+
uses: docker/login-action@v3
216+
with:
217+
registry: docker.io
218+
username: ${{ secrets.ES_DOCKERHUB_USERNAME }}
219+
password: ${{ secrets.ES_DOCKERHUB_PAT }}
210220

211-
# - name: tools - docker - register QEMU
212-
# run: |
213-
# docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
221+
- name: tools - docker - register QEMU
222+
run: |
223+
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
214224
215-
# - name: tools - docker - setup buildx
216-
# uses: docker/setup-buildx-action@v3
217-
# with:
218-
# driver: docker-container # REQUIRED for multi-platform builds
225+
- name: tools - docker - setup buildx
226+
uses: docker/setup-buildx-action@v3
227+
with:
228+
driver: docker-container # REQUIRED for multi-platform builds
219229

220-
# - name: artifacts - prepare directories
221-
# run: |
222-
# mkdir -p .artifacts/helm
223-
# mkdir -p .artifacts/kubectl
224-
# mkdir -p .artifacts/artifacthub
230+
225231

226-
# - name: helm - import README
227-
# run: cp README.md ${{ env.helmChartDir }}/README.md
232+
- name: helm - import README
233+
run: cp README.md ${{ env.helm_chart_dir }}/README.md
228234

229-
# - name: helm - package chart
230-
# run: helm package --destination .artifacts/helm --version ${{ env.gitVersion_SemVer }} --app-version ${{ env.gitVersion_SemVer }} ${{ env.helmChartDir }}
235+
- name: helm - package chart
236+
run: helm package --destination .artifacts/helm --version build-${{ env.gitVersion_SemVer }} --app-version build-${{ env.gitVersion_SemVer }} ${{ env.helm_chart_dir }}
231237

232-
# - name: helm - template chart
233-
# run: helm template --namespace kube-system ${{ env.helmChart }} .artifacts/helm/${{ env.helmChart }}-${{ env.gitVersion_SemVer }}.tgz > .artifacts/kubectl/${{ env.helmChart }}.yaml
238+
- name: helm - template chart
239+
run: helm template --namespace kube-system ${{ env.helm_chart }} .artifacts/helm/${{ env.helm_chart }}-build-${{ env.gitVersion_SemVer }}.tgz > .artifacts/kubectl/${{ env.helmChart }}.yaml
234240

235241
# - name: helm - artifacthub - repo
236242
# run: install -D src/helm/artifacthub-repo.yaml .artifacts/artifacthub/artifacthub-repo.yaml

0 commit comments

Comments
 (0)