Skip to content
This repository has been archived by the owner on Jul 4, 2024. It is now read-only.

Commit

Permalink
configure prerelease version in values.yaml also for building
Browse files Browse the repository at this point in the history
dockerfile.
  • Loading branch information
ferenc-hechler committed Jun 10, 2024
1 parent 9be7251 commit f17f7b5
Show file tree
Hide file tree
Showing 5 changed files with 75 additions and 4 deletions.
56 changes: 56 additions & 0 deletions .github/workflows/build-secretsmanagement-operator-rc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Build SecretsManagement-Operator Dockerimage
run-name: Build SecretsManagement-Operator Dockerimage
on:
push:
branches:
- odaa-*
#paths:
#- source/operators/secretsmanagementOperator-hc/docker/**/*
jobs:
build-secrets-management-operator-dockerfile-job:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: read versionnumber of secretsmanagement-operator from values.yaml
id: get_smanop_version
uses: mikefarah/yq@master
with:
cmd: yq '[.secretsmanagement-operator.version, .secretsmanagement-operator.prereleaseSuffix] | filter(.!=null and .!="") | join("-")' charts/canvas-oda/values.yaml

- name: Check Version
id: check-tag
run: |
echo
if [[ ${{ steps.get_smanop_version.outputs.result }} =~ ^[0-9]+\.[0-9]+\.[0-9]+-.*$ ]]; then
echo "Version ${{ steps.get_smanop_version.outputs.result }} matches featurebranch format <n>.<n>.<n>-<prerelease>"
else
echo "::error::Version ${{ steps.get_smanop_version.outputs.result }} does not matche featurebranch format <n>.<n>.<n>-<prerelease>" && exit 1
fi
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- 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 "TIMESTAMP=$(git log -1 --pretty=%ct)" >> $GITHUB_ENV

- name: Build and push
uses: docker/build-push-action@v5
with:
context: source/operators/secretsmanagementOperator-hc/docker
# arm64 has problems building cffi python wheel
#platforms: linux/amd64,linux/arm64
platforms: linux/amd64
push: true
tags: |
ocfork/secretsmanagement-operator:latest
ocfork/secretsmanagement-operator:${{ steps.get_smanop_version.outputs.result }}
env:
SOURCE_DATE_EPOCH: ${{ env.TIMESTAMP }}
7 changes: 5 additions & 2 deletions charts/canvas-oda/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,11 @@ canvas-vault:
enabled: false

secretsmanagement-operator:
image: mtr.devops.telekom.de/magenta_canvas/public:secretsmanagement-operator-0.1.0
imagePullPolicy: IfNotPresent
image: ocfork/secretsmanagement-operator
version: 0.1.0
prereleaseSuffix: odaa-26
#imagePullPolicy: IfNotPresent
imagePullPolicy: Always
sidecarImage: mtr.devops.telekom.de/magenta_canvas/public:secretsmanagement-sidecar-0.1.0
# TODO: add TLS to canvas-vault-hc
vault_addr: "http://canvas-vault-hc.canvas-vault.svc.cluster.local:8200"
Expand Down
8 changes: 8 additions & 0 deletions charts/secretsmanagement-operator/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{{/*
build the full docker image name from image + version + prereleaseSuffix
*/}}
{{- define "secretsmanagementoperator.dockerimage" -}}
{{- .Values.image -}}:{{- .Values.version -}}
{{- if .Values.prereleaseSuffix -}}-{{- .Values.prereleaseSuffix -}}{{- end -}}
{{- end -}}

Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ spec:
serviceAccountName: {{ .Release.Name }}-smanop-account
containers:
- name: {{ .Release.Name }}-smanop
image: {{ .Values.image }}
image: {{ include "secretsmanagementoperator.dockerimage" . }}
imagePullPolicy: {{ .Values.imagePullPolicy }}
env:
- name: LOGGING
Expand Down
6 changes: 5 additions & 1 deletion charts/secretsmanagement-operator/values.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
image: mtr.devops.telekom.de/magenta_canvas/public:secretsmanagement-operator-0.1.0
image: ocfork/secretsmanagement-operator
version: 0.1.0
prereleaseSuffix: odaa-26
#imagePullPolicy: IfNotPresent
imagePullPolicy: Always

sidecarImage: mtr.devops.telekom.de/magenta_canvas/public:secretsmanagement-sidecar-0.1.0
# TODO: add TLS to canvas-vault-hc
vault_addr: "http://canvas-vault-hc.canvas-vault.svc.cluster.local:8200"
Expand Down

0 comments on commit f17f7b5

Please sign in to comment.