From 767b753f70ff58027aa3ea15b14b99ad8f5e0a6e Mon Sep 17 00:00:00 2001 From: dvirlabs Date: Wed, 18 Jun 2025 04:19:00 +0300 Subject: [PATCH 1/2] Set the update values stage to set the tag branchname-commithash --- .woodpecker.yaml | 23 ++++++----------------- backend/main.py | 1 - frontend/src/App.jsx | 2 +- 3 files changed, 7 insertions(+), 19 deletions(-) diff --git a/.woodpecker.yaml b/.woodpecker.yaml index f8d5c82..3c2c8eb 100644 --- a/.woodpecker.yaml +++ b/.woodpecker.yaml @@ -14,13 +14,11 @@ steps: context: frontend tags: - latest - - ${CI_COMMIT_SHA:0:7} - ${CI_COMMIT_BRANCH}-${CI_COMMIT_SHA:0:7} username: from_secret: DOCKER_USERNAME password: from_secret: DOCKER_PASSWORD - build-backend: name: Build & Push Backend @@ -37,7 +35,6 @@ steps: context: backend tags: - latest - - ${CI_COMMIT_SHA:0:7} - ${CI_COMMIT_BRANCH}-${CI_COMMIT_SHA:0:7} username: from_secret: DOCKER_USERNAME @@ -61,19 +58,15 @@ steps: - apk add --no-cache git yq - git config --global user.name "woodpecker-bot" - 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 - | - if [ "$CI_COMMIT_BRANCH" = "develop" ]; then - TAG="develop-${CI_BUILD_NUMBER}" - else - TAG="${CI_COMMIT_SHA:0:7}" - fi + TAG="${CI_COMMIT_BRANCH}-${CI_COMMIT_SHA:0:7}" echo "💡 Setting frontend tag to: $TAG" yq -i ".frontend.tag = \"$TAG\"" manifests/labmap/values.yaml git add manifests/labmap/values.yaml git commit -m "frontend: update tag to $TAG" || echo "No changes" - git push origin master + git push origin HEAD update-values-backend: name: Update backend tag in values.yaml @@ -92,16 +85,12 @@ steps: - apk add --no-cache git yq - git config --global user.name "woodpecker-bot" - 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 - | - if [ "$CI_COMMIT_BRANCH" = "develop" ]; then - TAG="develop-${CI_BUILD_NUMBER}" - else - TAG="${CI_COMMIT_SHA:0:7}" - fi + TAG="${CI_COMMIT_BRANCH}-${CI_COMMIT_SHA:0:7}" echo "💡 Setting backend tag to: $TAG" yq -i ".backend.tag = \"$TAG\"" manifests/labmap/values.yaml git add manifests/labmap/values.yaml git commit -m "backend: update tag to $TAG" || echo "No changes" - git push origin master + git push origin HEAD diff --git a/backend/main.py b/backend/main.py index 0f6b923..21d4717 100644 --- a/backend/main.py +++ b/backend/main.py @@ -81,6 +81,5 @@ def list_icons(): return categories - if __name__ == "__main__": uvicorn.run(app, host="0.0.0.0", port=8000) diff --git a/frontend/src/App.jsx b/frontend/src/App.jsx index 535e505..30a168e 100644 --- a/frontend/src/App.jsx +++ b/frontend/src/App.jsx @@ -4,4 +4,4 @@ function App() { return ; } -export default App; \ No newline at end of file +export default App; From 769c04c399c89a5389e80974672c20ee9a46e28e Mon Sep 17 00:00:00 2001 From: dvirlabs Date: Wed, 18 Jun 2025 04:20:44 +0300 Subject: [PATCH 2/2] Set the update values stage to set the tag branchname-commithash and fix the pipeline to not clone in update backend values stage --- .woodpecker.yaml | 3 +-- backend/main.py | 1 + frontend/src/App.jsx | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.woodpecker.yaml b/.woodpecker.yaml index 3c2c8eb..4551ece 100644 --- a/.woodpecker.yaml +++ b/.woodpecker.yaml @@ -58,7 +58,7 @@ steps: - apk add --no-cache git yq - git config --global user.name "woodpecker-bot" - 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 - | TAG="${CI_COMMIT_BRANCH}-${CI_COMMIT_SHA:0:7}" @@ -85,7 +85,6 @@ steps: - apk add --no-cache git yq - git config --global user.name "woodpecker-bot" - git config --global user.email "ci@dvirlabs.com" - - git clone "https://${GIT_USERNAME}:${GIT_TOKEN}@git.dvirlabs.com/dvirlabs/my-apps.git" - cd my-apps - | TAG="${CI_COMMIT_BRANCH}-${CI_COMMIT_SHA:0:7}" diff --git a/backend/main.py b/backend/main.py index 21d4717..0f6b923 100644 --- a/backend/main.py +++ b/backend/main.py @@ -81,5 +81,6 @@ def list_icons(): return categories + if __name__ == "__main__": uvicorn.run(app, host="0.0.0.0", port=8000) diff --git a/frontend/src/App.jsx b/frontend/src/App.jsx index 30a168e..535e505 100644 --- a/frontend/src/App.jsx +++ b/frontend/src/App.jsx @@ -4,4 +4,4 @@ function App() { return ; } -export default App; +export default App; \ No newline at end of file