2023-05-10 09:42:08 +00:00
|
|
|
kind: pipeline
|
|
|
|
type: kubernetes
|
2023-07-11 13:15:41 +00:00
|
|
|
name: Container & Helm chart
|
|
|
|
|
|
|
|
trigger:
|
|
|
|
event:
|
|
|
|
exclude:
|
|
|
|
- tag
|
2023-05-10 09:42:08 +00:00
|
|
|
|
|
|
|
steps:
|
2023-07-11 13:15:41 +00:00
|
|
|
- name: Semantic Release (Dry-run)
|
|
|
|
image: bv11-cr01.bessems.eu/proxy/library/node:20-slim
|
|
|
|
pull: always
|
|
|
|
commands:
|
|
|
|
- |
|
|
|
|
apt-get update
|
|
|
|
- |
|
|
|
|
apt-get install -y --no-install-recommends \
|
|
|
|
git-core \
|
|
|
|
ca-certificates
|
|
|
|
- |
|
|
|
|
npm install \
|
|
|
|
semantic-release \
|
|
|
|
@semantic-release/commit-analyzer \
|
|
|
|
@semantic-release/exec \
|
|
|
|
- |
|
|
|
|
export GIT_CREDENTIALS=$${GIT_USERNAME}:$${GIT_APIKEY}
|
|
|
|
- |
|
|
|
|
npx semantic-release \
|
|
|
|
--package @semantic-release/exec \
|
|
|
|
--package semantic-release \
|
|
|
|
--branches ${DRONE_BRANCH} \
|
|
|
|
--tag-format "v\$${version}" \
|
|
|
|
--dry-run \
|
|
|
|
--plugins @semantic-release/commit-analyzer,@semantic-release/exec \
|
|
|
|
--analyzeCommits @semantic-release/commit-analyzer \
|
|
|
|
--verifyRelease @semantic-release/exec \
|
|
|
|
--verifyReleaseCmd 'echo "$${nextRelease.version}" > .version'
|
|
|
|
environment:
|
|
|
|
GIT_APIKEY:
|
|
|
|
from_secret: git_apikey
|
|
|
|
GIT_USERNAME: djpbessems
|
|
|
|
|
2023-07-11 13:37:29 +00:00
|
|
|
- name: Container image (Harbor)
|
2023-05-10 10:18:19 +00:00
|
|
|
depends_on:
|
2023-07-11 13:15:41 +00:00
|
|
|
- Semantic Release (Dry-run)
|
2023-07-11 17:44:28 +00:00
|
|
|
image: gcr.io/kaniko-project/executor:debug
|
2023-07-11 13:15:41 +00:00
|
|
|
pull: always
|
2023-07-11 17:44:28 +00:00
|
|
|
commands:
|
|
|
|
- |
|
|
|
|
wget https://github.com/jqlang/jq/releases/download/jq-1.6/jq-linux64 -qO /bin/jq
|
|
|
|
chmod +x /bin/jq
|
|
|
|
- |
|
2023-07-11 19:19:54 +00:00
|
|
|
/bin/jq '.auths["https://bv11-cr01.bessems.eu/v2/"].auth="'"$(echo -n $HARBOR_USERNAME':'$HARBOR_PASSWORD | base64)"'"' --null-input > /kaniko/.docker/config.json
|
2023-07-11 17:44:28 +00:00
|
|
|
- |
|
|
|
|
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:
|
2023-07-11 19:19:54 +00:00
|
|
|
HARBOR_USERNAME:
|
2023-05-10 09:42:08 +00:00
|
|
|
from_secret: harbor_username
|
2023-07-11 19:19:54 +00:00
|
|
|
HARBOR_PASSWORD:
|
2023-05-10 09:42:08 +00:00
|
|
|
from_secret: harbor_password
|
2023-07-11 13:15:41 +00:00
|
|
|
|
2023-07-11 13:37:29 +00:00
|
|
|
- name: Container image (docker.io)
|
2023-05-10 10:18:19 +00:00
|
|
|
depends_on:
|
2023-07-11 13:15:41 +00:00
|
|
|
- Semantic Release (Dry-run)
|
2023-07-11 15:19:16 +00:00
|
|
|
image: gcr.io/kaniko-project/executor:debug
|
2023-07-11 13:15:41 +00:00
|
|
|
pull: always
|
2023-07-11 13:30:47 +00:00
|
|
|
commands:
|
|
|
|
- |
|
2023-07-11 15:40:32 +00:00
|
|
|
wget https://github.com/jqlang/jq/releases/download/jq-1.6/jq-linux64 -qO /bin/jq
|
2023-07-11 15:26:40 +00:00
|
|
|
chmod +x /bin/jq
|
2023-07-11 17:44:28 +00:00
|
|
|
- |
|
|
|
|
export IMAGE_TAG=$(cat .version)
|
2023-07-11 15:26:40 +00:00
|
|
|
- |
|
2023-07-11 17:25:44 +00:00
|
|
|
/bin/jq '.auths["https://index.docker.io/v1/"].auth="'"$(echo -n $DOCKER_USERNAME':'$DOCKER_PASSWORD | base64)"'"' --null-input > /kaniko/.docker/config.json
|
2023-07-11 15:19:16 +00:00
|
|
|
- |
|
|
|
|
/kaniko/executor \
|
|
|
|
--dockerfile=Dockerfile \
|
|
|
|
--context=dir://. \
|
2023-07-11 17:44:28 +00:00
|
|
|
--destination=docker.io/djpbessems/json-server:latest \
|
|
|
|
--destination=docker.io/djpbessems/json-server:$IMAGE_TAG
|
2023-07-11 15:19:16 +00:00
|
|
|
environment:
|
|
|
|
DOCKER_USERNAME:
|
2023-07-11 08:23:40 +00:00
|
|
|
from_secret: docker_username
|
2023-07-11 15:19:16 +00:00
|
|
|
DOCKER_PASSWORD:
|
2023-05-10 09:42:08 +00:00
|
|
|
from_secret: docker_password
|
2023-05-10 10:06:38 +00:00
|
|
|
|
2023-07-11 13:37:29 +00:00
|
|
|
- name: Helm chart (Gitea)
|
2023-07-11 13:15:41 +00:00
|
|
|
depends_on:
|
|
|
|
- Semantic Release (Dry-run)
|
2023-05-10 10:06:38 +00:00
|
|
|
image: bv11-cr01.bessems.eu/proxy/alpine/helm
|
2023-07-11 13:15:41 +00:00
|
|
|
pull: always
|
2023-05-10 10:06:38 +00:00
|
|
|
commands:
|
2023-07-11 13:15:41 +00:00
|
|
|
- |
|
2023-07-11 17:44:28 +00:00
|
|
|
export CHART_VERSION=$(cat .version)
|
2023-07-11 17:47:50 +00:00
|
|
|
sed -i 's/{{ chart_version }}/'$CHART_VERSION'/g' charts/json-server/Chart.yaml
|
2023-07-12 10:10:06 +00:00
|
|
|
sed -i 's/tag: latest/tag: '$CHART_VERSION'/g' charts/json-server/values.yaml
|
2023-05-10 10:06:38 +00:00
|
|
|
- |
|
|
|
|
helm package ./charts/json-server
|
|
|
|
- |
|
2023-07-11 07:36:55 +00:00
|
|
|
helm plugin install https://github.com/chartmuseum/helm-push
|
|
|
|
- |
|
|
|
|
helm repo add \
|
|
|
|
--username $GIT_USERNAME \
|
|
|
|
--password $GIT_APIKEY \
|
|
|
|
spamasaurus \
|
|
|
|
https://code.spamasaurus.com/api/packages/$GIT_USERNAME/helm
|
|
|
|
- |
|
|
|
|
helm cm-push \
|
2023-07-11 07:38:41 +00:00
|
|
|
json-server-*.tgz \
|
|
|
|
spamasaurus
|
2023-05-10 10:06:38 +00:00
|
|
|
environment:
|
|
|
|
GIT_APIKEY:
|
|
|
|
from_secret: git_apikey
|
|
|
|
GIT_USERNAME: djpbessems
|
2023-07-11 13:15:41 +00:00
|
|
|
|
|
|
|
- name: Semantic Release
|
|
|
|
depends_on:
|
2023-07-11 13:38:16 +00:00
|
|
|
- Container image (Harbor)
|
|
|
|
- Container image (docker.io)
|
|
|
|
- Helm chart (Gitea)
|
2023-07-11 13:15:41 +00:00
|
|
|
image: bv11-cr01.bessems.eu/proxy/library/node:20-slim
|
|
|
|
pull: always
|
|
|
|
commands:
|
|
|
|
- |
|
2023-07-11 19:17:55 +00:00
|
|
|
apt-get update
|
|
|
|
- |
|
|
|
|
apt-get install -y --no-install-recommends \
|
|
|
|
git-core \
|
|
|
|
ca-certificates
|
|
|
|
- |
|
|
|
|
npm install \
|
|
|
|
semantic-release \
|
|
|
|
@semantic-release/commit-analyzer \
|
|
|
|
@semantic-release/git \
|
|
|
|
@semantic-release/release-notes-generator
|
|
|
|
- |
|
|
|
|
export GIT_CREDENTIALS=$${GIT_USERNAME}:$${GIT_APIKEY}
|
|
|
|
- |
|
|
|
|
npx semantic-release \
|
|
|
|
--branches ${DRONE_BRANCH} \
|
|
|
|
--tag-format "v\$${version}" \
|
|
|
|
--plugins @semantic-release/commit-analyzer,@semantic-release/release-notes-generator,@semantic-release/git
|
|
|
|
environment:
|
|
|
|
GIT_APIKEY:
|
|
|
|
from_secret: git_apikey
|
|
|
|
GIT_USERNAME: djpbessems
|