Skip to content

Commit

Permalink
Changed to default .env file + Removing hardcoded branch name
Browse files Browse the repository at this point in the history
 - .env.tags file not being read by docker compose file

SERVER_IMAGE_TAG also needs to be stored in .env file since docker compose file makes use of it.

Branch name already included in image tag; hence removing
  • Loading branch information
Mahadik, Mukul Chandrakant authored and Mahadik, Mukul Chandrakant committed Sep 21, 2024
1 parent 1f78e70 commit 2a61f4e
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 15 deletions.
3 changes: 3 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
PUBLIC_DASH_NOTEBOOK_IMAGE_TAG=2024-09-20--38-59
PUBLIC_DASH_FRONTEND_IMAGE_TAG=2024-09-20--29-15
SERVER_IMAGE_TAG=2024-09-20--58-50
27 changes: 14 additions & 13 deletions .github/workflows/image_build_push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
-H "Authorization: Bearer ${{ secrets.GH_FG_PAT_TAGS }}" \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/MukuFlash03/e-mission-server/contents/.env.tags?ref=cleanup-cicd)
https://api.github.com/repos/MukuFlash03/e-mission-server/contents/.env?ref=cleanup-cicd)
content=$(echo "$response" | jq -r .content)
decoded_content=$(echo "$content" | base64 --decode)
Expand All @@ -34,7 +34,7 @@ jobs:
- name: Set docker image tags
id: set-tags
run: |
set -a; source .env.tags; set +a
set -a; source .env; set +a
echo "PUBLIC_DASH_NOTEBOOK_IMAGE_TAG=${PUBLIC_DASH_NOTEBOOK_IMAGE_TAG}" >> "$GITHUB_OUTPUT"
echo "PUBLIC_DASH_FRONTEND_IMAGE_TAG=${PUBLIC_DASH_FRONTEND_IMAGE_TAG}" >> "$GITHUB_OUTPUT"
Expand Down Expand Up @@ -75,26 +75,27 @@ jobs:
fi
docker push $DOCKER_USER/${GITHUB_REPOSITORY#*/}_notebook:${GITHUB_REF##*/}_${{ steps.date.outputs.date }}
- name: Update .env.tags file
- name: Update .env file
run: |
echo "PUBLIC_DASH_NOTEBOOK_IMAGE_TAG=${GITHUB_REF##*/}_${{ steps.date.outputs.date }}" > .env.tags
echo "PUBLIC_DASH_NOTEBOOK_IMAGE_TAG=${GITHUB_REF##*/}_${{ steps.date.outputs.date }}" > .env
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
echo "Workflow_dispatch: Reuse existing frontend image tag"
echo "PUBLIC_DASH_FRONTEND_IMAGE_TAG=${GITHUB_REF##*/}_${{ steps.set-tags.outputs.PUBLIC_DASH_FRONTEND_IMAGE_TAG }}" >> .env.tags
echo "Workflow_dispatch: Reuse existing frontend image tag"
echo "PUBLIC_DASH_FRONTEND_IMAGE_TAG=${GITHUB_REF##*/}_${{ steps.set-tags.outputs.PUBLIC_DASH_FRONTEND_IMAGE_TAG }}" >> .env
else
echo "Push event: Update frontend image tag"
echo "PUBLIC_DASH_FRONTEND_IMAGE_TAG=${GITHUB_REF##*/}_${{ steps.date.outputs.date }}" >> .env.tags
echo "Push event: Update frontend image tag"
echo "PUBLIC_DASH_FRONTEND_IMAGE_TAG=${GITHUB_REF##*/}_${{ steps.date.outputs.date }}" >> .env
fi
echo "SERVER_IMAGE_TAG=${GITHUB_REF##*/}_${{ steps.get-server-tag.outputs.SERVER_IMAGE_TAG }}" >> .env
- name: Add, Commit, Push changes to .env.tags file
- name: Add, Commit, Push changes to .env file
run: |
git config --local user.email "[email protected]"
git config --local user.name "Github Actions bot to update .env.tags with latest tags"
git config --local user.name "Github Actions bot to update .env with latest tags"
if git diff --quiet; then
echo "Latest timestamp already present in .env.tags file, no changes to commit"
echo "Latest timestamp already present in .env file, no changes to commit"
else
git add .env.tags
git commit -m "Updated docker image tags in .env.tags file to the latest timestamp"
git add .env
git commit -m "Updated docker image tags in .env file to the latest timestamp"
git push origin
fi
Expand Down
4 changes: 2 additions & 2 deletions viz_scripts/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# python 3
ARG SERVER_IMAGE_TAG
# FROM shankari/e-mission-server:master_${SERVER_IMAGE_TAG}
FROM mukuflash03/e-mission-server:cleanup-cicd_${SERVER_IMAGE_TAG}
# FROM shankari/e-mission-server:${SERVER_IMAGE_TAG}
FROM mukuflash03/e-mission-server:${SERVER_IMAGE_TAG}

ADD https://s3.amazonaws.com/rds-downloads/rds-combined-ca-bundle.pem /etc/ssl/certs/

Expand Down

0 comments on commit 2a61f4e

Please sign in to comment.