Skip to content

Commit 51a8cf9

Browse files
committed
ci(pipeline): enhance CI pipeline with installation tools
- Adds kubectl and helm installation steps to the CI pipeline. - Implements authentication for helm and docker registries based on build requirements. - Configures multi-platform Docker build and push actions. - Removes redundant tools and steps to streamline the pipeline.
1 parent 3cda62d commit 51a8cf9

File tree

1 file changed

+61
-35
lines changed

1 file changed

+61
-35
lines changed

.github/workflows/pipeline.yaml

Lines changed: 61 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,48 @@ jobs:
124124
- name: checkout
125125
uses: actions/checkout@v4
126126

127+
- name: tools - kubectl - install
128+
uses: azure/setup-kubectl@v4
129+
130+
- name: tools - helm - install
131+
uses: azure/setup-helm@v4
132+
133+
- name: tools - helm - login - ghcr
134+
if: ${{ needs.discovery.outputs.requiresBuildPush == 'true' }}
135+
run: |
136+
echo "${{ secrets.ES_GITHUB_PAT }}" | helm registry login ghcr.io -u ${{ github.actor }} --password-stdin
137+
138+
- name: tools - helm - login - docker.io
139+
if: ${{ needs.discovery.outputs.requiresBuildPush == 'true' }}
140+
run: |
141+
echo "${{ secrets.ES_DOCKERHUB_PAT }}" | helm registry login registry-1.docker.io -u ${{ secrets.ES_DOCKERHUB_USERNAME }} --password-stdin
142+
143+
- name: tools - docker - login ghcr.io
144+
if: ${{ needs.discovery.outputs.requiresBuildPush == 'true' }}
145+
uses: docker/login-action@v3
146+
with:
147+
registry: ghcr.io
148+
username: ${{ github.actor }}
149+
password: ${{ secrets.ES_GITHUB_PAT }}
150+
151+
- name: tools - docker - login docker.io
152+
if: ${{ needs.discovery.outputs.requiresBuildPush == 'true' }}
153+
uses: docker/login-action@v3
154+
with:
155+
registry: docker.io
156+
username: ${{ secrets.ES_DOCKERHUB_USERNAME }}
157+
password: ${{ secrets.ES_DOCKERHUB_PAT }}
158+
159+
- name: tools - docker - register QEMU
160+
run: |
161+
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
162+
163+
- name: tools - docker - setup buildx
164+
uses: docker/setup-buildx-action@v3
165+
with:
166+
driver: docker-container # REQUIRED for multi-platform builds
167+
168+
127169
- name: artifacts - prepare directories
128170
run: |
129171
mkdir -p .artifacts/helm
@@ -138,6 +180,25 @@ jobs:
138180
- name: helm - template chart
139181
run: helm template --namespace kube-system ${{ env.helmChart }} .artifacts/helm/${{ env.helmChart }}-${{ env.gitVersion_SemVer }}.tgz > .artifacts/kubectl/${{ env.helmChart }}-${{ env.gitVersion_SemVer }}.yaml
140182

183+
- name: docker - build and push
184+
uses: docker/build-push-action@v5
185+
with:
186+
context: ${{ env.containerImageBuildContext }}
187+
file: ${{ env.containerImageBuildDockerfile }}
188+
push: ${{ needs.discovery.outputs.requiresBuildPush == 'true' }}
189+
provenance: false
190+
platforms: linux/amd64,linux/arm/v7,linux/arm64
191+
tags: |
192+
${{ env.dockerHubContainerImageRepository }}/${{ env.containerImage }}:${{ env.gitVersion_SemVer }}
193+
${{ env.ghcrContainerImageRepository }}/${{ env.containerImage }}:${{ env.gitVersion_SemVer }}
194+
195+
- name: helm - push - ghcr
196+
run: helm push .artifacts/helm/${{ env.helmChart }}-${{ env.gitVersion_SemVer }}.tgz oci://ghcr.io/${{ github.repository_owner }}/helm-charts
197+
198+
- name: helm - push - docker.io
199+
run: helm push .artifacts/helm/${{ env.helmChart }}-${{ env.gitVersion_SemVer }}.tgz oci://registry-1.docker.io/${{ github.repository_owner }}/helm-charts
200+
201+
141202
- name: "artifacts - upload - helm chart"
142203
uses: actions/upload-artifact@v4
143204
with:
@@ -156,39 +217,4 @@ jobs:
156217
name: kubectl
157218
path: .artifacts/kubectl
158219

159-
- name: tools - docker - register QEMU
160-
run: |
161-
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
162-
163-
- name: tools - docker - setup buildx
164-
uses: docker/setup-buildx-action@v3
165-
with:
166-
driver: docker-container # REQUIRED for multi-platform builds
167-
168-
- name: tools - docker - login docker.io
169-
if: ${{ needs.discovery.outputs.requiresBuildPush == 'true' }}
170-
uses: docker/login-action@v3
171-
with:
172-
registry: docker.io
173-
username: ${{ secrets.ES_DOCKERHUB_USERNAME }}
174-
password: ${{ secrets.ES_DOCKERHUB_PAT }}
175-
176-
- name: tools - docker - login ghcr.io
177-
if: ${{ needs.discovery.outputs.requiresBuildPush == 'true' }}
178-
uses: docker/login-action@v3
179-
with:
180-
registry: ghcr.io
181-
username: ${{ github.actor }}
182-
password: ${{ secrets.ES_GITHUB_PAT }}
183220

184-
- name: docker - build and push
185-
uses: docker/build-push-action@v5
186-
with:
187-
context: ${{ env.containerImageBuildContext }}
188-
file: ${{ env.containerImageBuildDockerfile }}
189-
push: ${{ needs.discovery.outputs.requiresBuildPush == 'true' }}
190-
provenance: false
191-
platforms: linux/amd64,linux/arm/v7,linux/arm64
192-
tags: |
193-
${{ env.dockerHubContainerImageRepository }}/${{ env.containerImage }}:${{ env.gitVersion_SemVer }}
194-
${{ env.ghcrContainerImageRepository }}/${{ env.containerImage }}:${{ env.gitVersion_SemVer }}

0 commit comments

Comments
 (0)