This repository has been archived by the owner on Jul 4, 2024. It is now read-only.
Build SecretsManagement-Sidecar Release Dockerimage #4
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build SecretsManagement-Sidecar Release Dockerimage | |
run-name: Build SecretsManagement-Sidecar Release Dockerimage | |
on: | |
push: | |
branches: | |
# TODO[FH]: remove testmain | |
- testmain | |
- master | |
paths: | |
- source/operators/secretsmanagementOperator-hc/sidecar/docker/**/* | |
jobs: | |
build-secrets-management-sidecar-release-dockerfile-job: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: read image of secretsmanagement-sidecar from values.yaml | |
id: get_smansidecar_image | |
uses: mikefarah/yq@master | |
with: | |
cmd: yq '.secretsmanagement-operator.sidecarImage' charts/canvas-oda/values.yaml | |
- name: read versionnumber of secretsmanagement-sidecar from values.yaml | |
id: get_smansidecar_version | |
uses: mikefarah/yq@master | |
with: | |
cmd: yq '[.secretsmanagement-operator.sidecarVersion, .secretsmanagement-operator.sidecarPrereleaseSuffix] | filter(.!=null and .!="") | join("-")' charts/canvas-oda/values.yaml | |
- name: Check Version | |
id: check-tag | |
run: | | |
echo | |
if [[ ${{ steps.get_smansidecar_version.outputs.result }} =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then | |
echo "Version ${{ steps.get_smansidecar_version.outputs.result }} matches release format <n>.<n>.<n>" | |
else | |
echo "::error::Version ${{ steps.get_smansidecar_version.outputs.result }} does not matche release format <n>.<n>.<n>" && exit 1 | |
fi | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Check for already existing image tag | |
id: check_docker_image | |
uses: KerberosMorphy/[email protected] | |
with: | |
registry: docker.io | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
image: ${{ steps.get_smanop_image.outputs.result }}:${{ steps.get_smanop_version.outputs.result }} | |
- name: error if tag already exists | |
if: steps.check_docker_image.outputs.image_exist==1 | |
run: | | |
echo "::error::image tag ${{ steps.get_smanop_version.outputs.result }} already exists in repo ${{ steps.get_smanop_image.outputs.result }}, exiting!" && exit 2 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Get Git commit timestamps | |
run: | | |
echo "SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct)" >> $GITHUB_ENV | |
echo "GIT_COMMIT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_ENV | |
echo "CICD_BUILD_TIME=$(date -Iseconds)" >> $GITHUB_ENV | |
- name: Build and push | |
uses: docker/build-push-action@v5 | |
with: | |
context: source/operators/secretsmanagementOperator-hc/sidecar/docker | |
build-args: | | |
SOURCE_DATE_EPOCH=${{ env.SOURCE_DATE_EPOCH }} | |
GIT_COMMIT_SHA=${{ env.GIT_COMMIT_SHA }} | |
CICD_BUILD_TIME=${{ env.CICD_BUILD_TIME }} | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
tags: | | |
${{ steps.get_smansidecar_image.outputs.result }}:latest | |
${{ steps.get_smansidecar_image.outputs.result }}:${{ steps.get_smansidecar_version.outputs.result }} | |
env: | |
SOURCE_DATE_EPOCH: ${{ env.SOURCE_DATE_EPOCH }} |