Skip to content

Commit

Permalink
fix: adding service key as Input in argo action ci cd (#2797)
Browse files Browse the repository at this point in the history
* fix: adding service key as Input

* feat: removed check if migration needed
  • Loading branch information
codechirag123 authored Oct 24, 2024
1 parent 177b19f commit 4dec194
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 60 deletions.
5 changes: 4 additions & 1 deletion .github/actions/argocd-action/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,16 @@ inputs:
argocd_server:
description: "ArgoCD Server"
required: true
tg_svc_key:
description: "Twingate Key"
required: true
runs:
using: composite
steps:
- name: Setup Twingate
uses: twingate/github-action@v1
with:
service-key: ${{ secrets.TWINGATE_SERVICE_KEY_SECRET_NAME }}
service-key: ${{ inputs.tg_svc_key }}

- name: Obtain ArgoCD JWT Token
id: get_token
Expand Down
31 changes: 1 addition & 30 deletions .github/workflows/db-ops.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,38 +13,8 @@ env:


jobs:
check_if_data_migration_needed:
runs-on: ubuntu-latest
outputs:
should_build: ${{ steps.check-branch-existance.outputs.should_build }} # short sha of the commit
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 1
submodules: 'recursive'
token: ${{ secrets.SUBMODULES_TOKEN }}

- name: Check if branch exists
id: check-branch-existance
run: |
cd services/workflows-service/prisma/data-migrations
is_exists=$(git ls-remote --exit-code --heads -t --ref -q origin "${{ env.MIGRATION_REF }}" | wc -l)
# Check if the branch exists by counting the number of results
if [ $is_exists -eq 0 ]; then
echo "Branch '${{ env.MIGRATION_REF }}' does not exist."
echo "should_build=false" >> $GITHUB_OUTPUT
else
echo "should_build=true" >> $GITHUB_OUTPUT
fi
exit 0
build-and-push-ee-image:
runs-on: ubuntu-latest
needs: [check_if_data_migration_needed]
if: ${{ needs.check_if_data_migration_needed.outputs.should_build == 'true' }}
permissions:
contents: read
packages: write
Expand Down Expand Up @@ -187,6 +157,7 @@ jobs:
argocd_username: ${{ secrets.ARGOCD_USERNAME }}
argocd_password: ${{ secrets.ARGOCD_PASSWORD }}
argocd_server: ${{ secrets.ARGOCD_SERVER }}
tg_svc_key: ${{ secrets.TWINGATE_SERVICE_KEY_SECRET_NAME }}

send-to-slack:
runs-on: ubuntu-latest
Expand Down
30 changes: 1 addition & 29 deletions .github/workflows/deploy-wf-service.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,33 +40,6 @@ jobs:
echo "SHORT_HASH is ${{ env.SHORT_HASH }}"
echo "SHORT_HASH is ${{ env.SHORT_HASH }}"
echo "SHORT_HASH is $SHORT_HASH"
check_if_data_migration_needed:
runs-on: ubuntu-latest
outputs:
should_build: ${{ steps.check-branch-existance.outputs.should_build }} # short sha of the commit
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 1
submodules: 'recursive'
token: ${{ secrets.SUBMODULES_TOKEN }}

- name: Check if branch exists
id: check-branch-existance
run: |
cd services/workflows-service/prisma/data-migrations
is_exists=$(git ls-remote --exit-code --heads -t --ref -q origin "${{ inputs.environment }}" | wc -l)
# Check if the branch exists by counting the number of results
if [ $is_exists -eq 0 ]; then
echo "Branch '${{ inputs.environment }}' does not exist."
echo "should_build=false" >> $GITHUB_OUTPUT
else
echo "should_build=true" >> $GITHUB_OUTPUT
fi
exit 0
tag-and-push-image:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -146,8 +119,7 @@ jobs:
build-and-push-ee-image:
runs-on: ubuntu-latest
needs: [check_if_data_migration_needed,tag-and-push-image]
if: always() && ${{(needs.check_if_data_migration_needed.outputs.should_build == 'true')}}
needs: [tag-and-push-image]
outputs:
SUBMODULE_SHORT_HASH: ${{ steps.lastcommit.outputs.shorthash }}
permissions:
Expand Down

0 comments on commit 4dec194

Please sign in to comment.