Skip to content

Commit

Permalink
fix: adding sanitized branch action for removing invalid values
Browse files Browse the repository at this point in the history
  • Loading branch information
codechirag123 committed Nov 18, 2024
1 parent 97b46a8 commit 9ad110a
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions .github/workflows/hotfix-wf-service.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ jobs:
docker_image: ${{ steps.docker-version.outputs.image }} # ghcr.io/ballerine-io/workflows-service
docker_tag: ${{ steps.docker-version.outputs.tag }} # <short_sha>-<branch_name>
docker_full_image: ${{ steps.docker-version.outputs.full_image }} # ghcr.io/ballerine-io/workflows-service:<short_sha>-<branch_name>
sanitized-branch: ${{ steps.sanitized-branch.outputs.sanitized-branch-name }}

steps:
- name: Checkout repository
Expand Down Expand Up @@ -61,6 +62,10 @@ jobs:
uses: ./.github/actions/bump-version
with:
tag: ${{ steps.version.outputs.tag }}

- name: "Determine Branch"
id: sanitized-branch
uses: transferwise/sanitize-branch-name@v1

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
Expand Down Expand Up @@ -95,7 +100,7 @@ jobs:
tags: |
type=raw,value=${{ github.ref_name }}
type=raw,value=dev
type=raw,value=${{ steps.version.outputs.sha_short }}-${{ github.ref_name }}
type=raw,value=${{ steps.version.outputs.sha_short }}-${{ steps.sanitized-branch.outputs.sanitized-branch-name }}
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'prod') }}
type=sha,format=short
Expand All @@ -104,7 +109,7 @@ jobs:
run: |
DOCKER_IMAGE=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
DOCKER_TAG=${{ steps.version.outputs.sha_short }}-${{ github.ref_name }}
DOCKER_FULL_IMAGE=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.version.outputs.sha_short }}-${{ github.ref_name }}
DOCKER_FULL_IMAGE=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.version.outputs.sha_short }}-${{ steps.sanitized-branch.outputs.sanitized-branch-name }}
echo "DOCKER_IMAGE=$DOCKER_IMAGE"
echo "DOCKER_TAG=$DOCKER_TAG"
Expand Down Expand Up @@ -221,14 +226,14 @@ jobs:
images: ${{needs.build-and-push-image.outputs.docker_image}}-ee
tags: |
type=raw,value=${{ inputs.environment }}
type=raw,value=${{ needs.build-and-push-image.outputs.sha_short }}-${{ steps.lastcommit.outputs.shorthash }}-${{ inputs.environment }}
type=raw,value=${{ needs.build-and-push-image.outputs.sha_short }}-${{ steps.lastcommit.outputs.shorthash }}-${{ needs.build-and-push-image.outputs.sanitized-branch }}
type=sha,format=short
- name: Docker metadata version
id: docker-version
run: |
DOCKER_IMAGE=${{needs.build-and-push-image.outputs.docker_image}}-ee
DOCKER_TAG=${{ needs.build-and-push-image.outputs.sha_short }}-${{ steps.lastcommit.outputs.shorthash }}-${{ inputs.environment }}
DOCKER_TAG=${{ needs.build-and-push-image.outputs.sha_short }}-${{ steps.lastcommit.outputs.shorthash }}-${{ needs.build-and-push-image.outputs.sanitized-branch }}
DOCKER_FULL_IMAGE=$DOCKER_IMAGE:$DOCKER_TAG
echo "DOCKER_IMAGE=$DOCKER_IMAGE"
Expand Down Expand Up @@ -297,10 +302,10 @@ jobs:
changes: |
{
"kubernetes/helm/wf-service-migration/${{steps.update_helm_check.outputs.file_name}}": {
"image.tag": "${{ needs.build-and-push-image.outputs.sha_short }}-${{ needs.build-and-push-ee-image.outputs.SUBMODULE_SHORT_HASH }}-${{ inputs.environment }}",
"prismaMigrate.image.tag": "${{ needs.build-and-push-image.outputs.sha_short }}-${{ needs.build-and-push-ee-image.outputs.SUBMODULE_SHORT_HASH }}-${{ inputs.environment }}",
"dbMigrate.image.tag": "${{ needs.build-and-push-image.outputs.sha_short }}-${{ needs.build-and-push-ee-image.outputs.SUBMODULE_SHORT_HASH }}-${{ inputs.environment }}",
"dataSync.image.tag": "${{ needs.build-and-push-image.outputs.sha_short }}-${{ needs.build-and-push-ee-image.outputs.SUBMODULE_SHORT_HASH }}-${{ inputs.environment }}"
"image.tag": "${{ needs.build-and-push-image.outputs.sha_short }}-${{ needs.build-and-push-ee-image.outputs.SUBMODULE_SHORT_HASH }}-${{ needs.build-and-push-image.outputs.sanitized-branch }}",
"prismaMigrate.image.tag": "${{ needs.build-and-push-image.outputs.sha_short }}-${{ needs.build-and-push-ee-image.outputs.SUBMODULE_SHORT_HASH }}-${{ needs.build-and-push-image.outputs.sanitized-branch }}",
"dbMigrate.image.tag": "${{ needs.build-and-push-image.outputs.sha_short }}-${{ needs.build-and-push-ee-image.outputs.SUBMODULE_SHORT_HASH }}-${{ needs.build-and-push-image.outputs.sanitized-branch }}",
"dataSync.image.tag": "${{ needs.build-and-push-image.outputs.sha_short }}-${{ needs.build-and-push-ee-image.outputs.SUBMODULE_SHORT_HASH }}-${{ needs.build-and-push-image.outputs.sanitized-branch }}"
}
}
send-to-slack:
Expand Down

0 comments on commit 9ad110a

Please sign in to comment.