Skip to content

Commit 6ae0bf3

Browse files
chore: Update build-product.yml workflow to check if app is deployed by ArgoCD
1 parent 1234639 commit 6ae0bf3

File tree

2 files changed

+21
-6
lines changed

2 files changed

+21
-6
lines changed

.github/argocd-deployed-apps.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"apps": ["test_release_repo", "test"]
3+
}

.github/workflows/build-product.yml

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ env:
3131
PYTHON_BASE_IMAGE: "python:3.10.8-slim-bullseye"
3232
DATAVISYN_PYTHON_BASE_IMAGE: "188237246440.dkr.ecr.eu-central-1.amazonaws.com/datavisyn/base/python:main"
3333
DATAVISYN_NGINX_BASE_IMAGE: "188237246440.dkr.ecr.eu-central-1.amazonaws.com/datavisyn/base/nginx:main"
34+
ARGOCD_DEPLOYED_APP: false
3435

3536
permissions:
3637
id-token: write
@@ -83,6 +84,15 @@ jobs:
8384
with:
8485
branch_name: ${{ github.ref_name }}
8586
time_zone: ${{ env.TIME_ZONE }}
87+
- name: Check if app deployed by ArgoCD
88+
id: argocd-deployed-app
89+
run: |
90+
result=$(jq '.apps | index("${{ steps.get-parameters.outputs.app }}") != null' ./.github/argocd-deployed-apps.json)
91+
if [ "$result" = "true" ]; then
92+
echo "ARGOCD_DEPLOYED_APP=true" >> $GITHUB_ENV
93+
else
94+
echo "ARGOCD_DEPLOYED_APP=false" >> $GITHUB_ENV
95+
fi
8696
build-single:
8797
needs: prepare-build
8898
if: ${{ needs.prepare-build.outputs.create_workspace != 'true' && needs.prepare-build.outputs.components != '[]' && needs.prepare-build.outputs.components != ''}}
@@ -124,12 +134,14 @@ jobs:
124134
ref: ${{ env.WORKFLOW_BRANCH }}
125135
path: ./tmp/github-workflows
126136
- name: retag images
127-
run: |
128-
echo "Image Tag 1: ${{ needs.prepare-build.outputs.image_tag1 }}"
129-
echo "Image Tag 2: ${{ needs.prepare-build.outputs.image_tag2 }}"
130-
echo "Stage: ${{ needs.prepare-build.outputs.stage }}"
131-
echo "Components: ${{ needs.prepare-build.outputs.components }}"
132-
echo "app: ${{ needs.prepare-build.outputs.app }}"
137+
if: ${{ env.ARGOCD_DEPLOYED_APP == 'false' }}
138+
uses: ./tmp/github-workflows/.github/actions/retag-image
139+
with:
140+
aws_role: ${{ vars.DV_AWS_ECR_ROLE }}
141+
aws_region: ${{ vars.DV_AWS_REGION }}
142+
ecr_repositories: ${{ needs.prepare-build.outputs.ecr_repos }}
143+
current_image_tag: ${{ needs.prepare-build.outputs.image_tag1 }}
144+
additional_image_tag: ${{ needs.prepare-build.outputs.image_tag2 }}
133145

134146
deploy:
135147
needs: [prepare-build, post-build]

0 commit comments

Comments
 (0)