build: Apply semantic release version to chart
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
Danny Bessems 2023-07-11 19:44:28 +02:00
parent dce6d7fb1c
commit f4ee0617cc
2 changed files with 26 additions and 14 deletions

View File

@ -44,16 +44,26 @@ steps:
- name: Container image (Harbor) - name: Container image (Harbor)
depends_on: depends_on:
- Semantic Release (Dry-run) - Semantic Release (Dry-run)
image: plugins/kaniko image: gcr.io/kaniko-project/executor:debug
pull: always pull: always
context: . commands:
settings: - |
repo: bv11-cr01.bessems.eu/library/json-server wget https://github.com/jqlang/jq/releases/download/jq-1.6/jq-linux64 -qO /bin/jq
registry: https://bv11-cr01.bessems.eu/v2/ chmod +x /bin/jq
tags: latest - |
username: /bin/jq '.auths["https://bv11-cr01.bessems.eu/v2/"].auth="'"$(echo -n $DOCKER_USERNAME':'$DOCKER_PASSWORD | base64)"'"' --null-input > /kaniko/.docker/config.json
- |
export IMAGE_TAG=$(cat .version)
- |
/kaniko/executor \
--dockerfile=Dockerfile \
--context=dir://. \
--destination=bv11-cr01.bessems.eu/library/json-server:latest \
--destination=bv11-cr01.bessems.eu/library/json-server:$IMAGE_TAG
environment:
DOCKER_USERNAME:
from_secret: harbor_username from_secret: harbor_username
password: DOCKER_PASSWORD:
from_secret: harbor_password from_secret: harbor_password
- name: Container image (docker.io) - name: Container image (docker.io)
@ -65,14 +75,16 @@ steps:
- | - |
wget https://github.com/jqlang/jq/releases/download/jq-1.6/jq-linux64 -qO /bin/jq wget https://github.com/jqlang/jq/releases/download/jq-1.6/jq-linux64 -qO /bin/jq
chmod +x /bin/jq chmod +x /bin/jq
- |
export IMAGE_TAG=$(cat .version)
- | - |
/bin/jq '.auths["https://index.docker.io/v1/"].auth="'"$(echo -n $DOCKER_USERNAME':'$DOCKER_PASSWORD | base64)"'"' --null-input > /kaniko/.docker/config.json /bin/jq '.auths["https://index.docker.io/v1/"].auth="'"$(echo -n $DOCKER_USERNAME':'$DOCKER_PASSWORD | base64)"'"' --null-input > /kaniko/.docker/config.json
cat /kaniko/.docker/config.json
- | - |
/kaniko/executor \ /kaniko/executor \
--dockerfile=Dockerfile \ --dockerfile=Dockerfile \
--context=dir://. \ --context=dir://. \
--destination=docker.io/djpbessems/json-server:latest --destination=docker.io/djpbessems/json-server:latest \
--destination=docker.io/djpbessems/json-server:$IMAGE_TAG
environment: environment:
DOCKER_USERNAME: DOCKER_USERNAME:
from_secret: docker_username from_secret: docker_username
@ -86,8 +98,8 @@ steps:
pull: always pull: always
commands: commands:
- | - |
apk add \ export CHART_VERSION=$(cat .version)
yq sed -i 's/{{ chart_version }}/'$CHART_VERSION'/g' json-server/Chart.yaml
- | - |
helm package ./charts/json-server helm package ./charts/json-server
- | - |

View File

@ -6,10 +6,10 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes # This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version. # to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/) # Versions are expected to follow Semantic Versioning (https://semver.org/)
version: v0.5.3 version: v{{ chart_version }}
# This is the version number of the application being deployed. This version number should be # This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to # incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using. # follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes. # It is recommended to use it with quotes.
appVersion: "v0.5.3" appVersion: "v{{ chart_version }}"