Set the update values stage to set the tag branchname-commithash

This commit is contained in:
dvirlabs 2025-06-18 04:19:00 +03:00
parent deb1fa13d3
commit 767b753f70
3 changed files with 7 additions and 19 deletions

View File

@ -14,14 +14,12 @@ steps:
context: frontend context: frontend
tags: tags:
- latest - latest
- ${CI_COMMIT_SHA:0:7}
- ${CI_COMMIT_BRANCH}-${CI_COMMIT_SHA:0:7} - ${CI_COMMIT_BRANCH}-${CI_COMMIT_SHA:0:7}
username: username:
from_secret: DOCKER_USERNAME from_secret: DOCKER_USERNAME
password: password:
from_secret: DOCKER_PASSWORD from_secret: DOCKER_PASSWORD
build-backend: build-backend:
name: Build & Push Backend name: Build & Push Backend
image: woodpeckerci/plugin-kaniko image: woodpeckerci/plugin-kaniko
@ -37,7 +35,6 @@ steps:
context: backend context: backend
tags: tags:
- latest - latest
- ${CI_COMMIT_SHA:0:7}
- ${CI_COMMIT_BRANCH}-${CI_COMMIT_SHA:0:7} - ${CI_COMMIT_BRANCH}-${CI_COMMIT_SHA:0:7}
username: username:
from_secret: DOCKER_USERNAME from_secret: DOCKER_USERNAME
@ -61,19 +58,15 @@ steps:
- apk add --no-cache git yq - apk add --no-cache git yq
- git config --global user.name "woodpecker-bot" - git config --global user.name "woodpecker-bot"
- git config --global user.email "ci@dvirlabs.com" - git config --global user.email "ci@dvirlabs.com"
- git clone "https://$${GIT_USERNAME}:$${GIT_TOKEN}@git.dvirlabs.com/dvirlabs/my-apps.git" - git clone "https://${GIT_USERNAME}:${GIT_TOKEN}@git.dvirlabs.com/dvirlabs/my-apps.git"
- cd my-apps - cd my-apps
- | - |
if [ "$CI_COMMIT_BRANCH" = "develop" ]; then TAG="${CI_COMMIT_BRANCH}-${CI_COMMIT_SHA:0:7}"
TAG="develop-${CI_BUILD_NUMBER}"
else
TAG="${CI_COMMIT_SHA:0:7}"
fi
echo "💡 Setting frontend tag to: $TAG" echo "💡 Setting frontend tag to: $TAG"
yq -i ".frontend.tag = \"$TAG\"" manifests/labmap/values.yaml yq -i ".frontend.tag = \"$TAG\"" manifests/labmap/values.yaml
git add manifests/labmap/values.yaml git add manifests/labmap/values.yaml
git commit -m "frontend: update tag to $TAG" || echo "No changes" git commit -m "frontend: update tag to $TAG" || echo "No changes"
git push origin master git push origin HEAD
update-values-backend: update-values-backend:
name: Update backend tag in values.yaml name: Update backend tag in values.yaml
@ -92,16 +85,12 @@ steps:
- apk add --no-cache git yq - apk add --no-cache git yq
- git config --global user.name "woodpecker-bot" - git config --global user.name "woodpecker-bot"
- git config --global user.email "ci@dvirlabs.com" - git config --global user.email "ci@dvirlabs.com"
- git clone "https://$${GIT_USERNAME}:$${GIT_TOKEN}@git.dvirlabs.com/dvirlabs/my-apps.git" - git clone "https://${GIT_USERNAME}:${GIT_TOKEN}@git.dvirlabs.com/dvirlabs/my-apps.git"
- cd my-apps - cd my-apps
- | - |
if [ "$CI_COMMIT_BRANCH" = "develop" ]; then TAG="${CI_COMMIT_BRANCH}-${CI_COMMIT_SHA:0:7}"
TAG="develop-${CI_BUILD_NUMBER}"
else
TAG="${CI_COMMIT_SHA:0:7}"
fi
echo "💡 Setting backend tag to: $TAG" echo "💡 Setting backend tag to: $TAG"
yq -i ".backend.tag = \"$TAG\"" manifests/labmap/values.yaml yq -i ".backend.tag = \"$TAG\"" manifests/labmap/values.yaml
git add manifests/labmap/values.yaml git add manifests/labmap/values.yaml
git commit -m "backend: update tag to $TAG" || echo "No changes" git commit -m "backend: update tag to $TAG" || echo "No changes"
git push origin master git push origin HEAD

View File

@ -81,6 +81,5 @@ def list_icons():
return categories return categories
if __name__ == "__main__": if __name__ == "__main__":
uvicorn.run(app, host="0.0.0.0", port=8000) uvicorn.run(app, host="0.0.0.0", port=8000)