Skip to content

Commit

Permalink
chore: Update build-product.yml workflow to check if app is deployed …
Browse files Browse the repository at this point in the history
…by ArgoCD
  • Loading branch information
dv-hossam-radwan committed May 17, 2024
1 parent 1234639 commit 6ae0bf3
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 6 deletions.
3 changes: 3 additions & 0 deletions .github/argocd-deployed-apps.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"apps": ["test_release_repo", "test"]
}
24 changes: 18 additions & 6 deletions .github/workflows/build-product.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ env:
PYTHON_BASE_IMAGE: "python:3.10.8-slim-bullseye"
DATAVISYN_PYTHON_BASE_IMAGE: "188237246440.dkr.ecr.eu-central-1.amazonaws.com/datavisyn/base/python:main"
DATAVISYN_NGINX_BASE_IMAGE: "188237246440.dkr.ecr.eu-central-1.amazonaws.com/datavisyn/base/nginx:main"
ARGOCD_DEPLOYED_APP: false

permissions:
id-token: write
Expand Down Expand Up @@ -83,6 +84,15 @@ jobs:
with:
branch_name: ${{ github.ref_name }}
time_zone: ${{ env.TIME_ZONE }}
- name: Check if app deployed by ArgoCD
id: argocd-deployed-app
run: |
result=$(jq '.apps | index("${{ steps.get-parameters.outputs.app }}") != null' ./.github/argocd-deployed-apps.json)
if [ "$result" = "true" ]; then
echo "ARGOCD_DEPLOYED_APP=true" >> $GITHUB_ENV
else
echo "ARGOCD_DEPLOYED_APP=false" >> $GITHUB_ENV
fi
build-single:
needs: prepare-build
if: ${{ needs.prepare-build.outputs.create_workspace != 'true' && needs.prepare-build.outputs.components != '[]' && needs.prepare-build.outputs.components != ''}}
Expand Down Expand Up @@ -124,12 +134,14 @@ jobs:
ref: ${{ env.WORKFLOW_BRANCH }}
path: ./tmp/github-workflows
- name: retag images
run: |
echo "Image Tag 1: ${{ needs.prepare-build.outputs.image_tag1 }}"
echo "Image Tag 2: ${{ needs.prepare-build.outputs.image_tag2 }}"
echo "Stage: ${{ needs.prepare-build.outputs.stage }}"
echo "Components: ${{ needs.prepare-build.outputs.components }}"
echo "app: ${{ needs.prepare-build.outputs.app }}"
if: ${{ env.ARGOCD_DEPLOYED_APP == 'false' }}
uses: ./tmp/github-workflows/.github/actions/retag-image
with:
aws_role: ${{ vars.DV_AWS_ECR_ROLE }}
aws_region: ${{ vars.DV_AWS_REGION }}
ecr_repositories: ${{ needs.prepare-build.outputs.ecr_repos }}
current_image_tag: ${{ needs.prepare-build.outputs.image_tag1 }}
additional_image_tag: ${{ needs.prepare-build.outputs.image_tag2 }}

deploy:
needs: [prepare-build, post-build]
Expand Down

0 comments on commit 6ae0bf3

Please sign in to comment.