From b24dcbba0513b4d3da99b320bbba5b30e550baa4 Mon Sep 17 00:00:00 2001 From: Fran Arbanas Date: Tue, 5 Nov 2024 15:08:36 +0100 Subject: [PATCH] fix: add cleaning gateway probe git ref --- .github/workflows/push-node-status-agent.yaml | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/.github/workflows/push-node-status-agent.yaml b/.github/workflows/push-node-status-agent.yaml index a31fef5673f..7a4be83dd80 100644 --- a/.github/workflows/push-node-status-agent.yaml +++ b/.github/workflows/push-node-status-agent.yaml @@ -36,19 +36,26 @@ jobs: with: cmd: yq -oy '.package.version' ${{ env.WORKING_DIRECTORY }}/Cargo.toml + - name: cleanup-gateway-probe-ref + id: cleanup_gateway_probe_ref + run: | + GATEWAY_PROBE_GIT_REF=${{ github.event.inputs.gateway_probe_git_ref }} + GIT_REF_SLUG="${GATEWAY_PROBE_GIT_REF//\//-}" + echo "git_ref=$(GIT_REF_SLUG)\n" >> $GITHUB_OUTPUT + - name: Remove existing tag if exists run: | - if git rev-parse ${{ env.WORKING_DIRECTORY }}-${{ steps.get_version.outputs.result }}-${{ github.event.inputs.gateway_probe_git_ref }} >/dev/null 2>&1; then - git push --delete origin ${{ env.WORKING_DIRECTORY }}-${{ steps.get_version.outputs.result }}-${{ github.event.inputs.gateway_probe_git_ref }} - git tag -d ${{ env.WORKING_DIRECTORY }}-${{ steps.get_version.outputs.result }}-${{ github.event.inputs.gateway_probe_git_ref }} + if git rev-parse ${{ env.WORKING_DIRECTORY }}-${{ steps.get_version.outputs.result }}-${{ steps.cleanup_gateway_probe_ref.git_ref }} >/dev/null 2>&1; then + git push --delete origin ${{ env.WORKING_DIRECTORY }}-${{ steps.get_version.outputs.result }}-${{ steps.cleanup_gateway_probe_ref.git_ref }} + git tag -d ${{ env.WORKING_DIRECTORY }}-${{ steps.get_version.outputs.result }}-${{ steps.cleanup_gateway_probe_ref.git_ref }} fi - name: Create tag run: | - git tag -a ${{ env.WORKING_DIRECTORY }}-${{ steps.get_version.outputs.result }}-${{ github.event.inputs.gateway_probe_git_ref }} -m "Version ${{ steps.get_version.outputs.result }}-${{ github.event.inputs.gateway_probe_git_ref }}" - git push origin ${{ env.WORKING_DIRECTORY }}-${{ steps.get_version.outputs.result }}-${{ github.event.inputs.gateway_probe_git_ref }} + git tag -a ${{ env.WORKING_DIRECTORY }}-${{ steps.get_version.outputs.result }}-${{ steps.cleanup_gateway_probe_ref.git_ref }} -m "Version ${{ steps.get_version.outputs.result }}-${{ github.event.inputs.gateway_probe_git_ref }}" + git push origin ${{ env.WORKING_DIRECTORY }}-${{ steps.get_version.outputs.result }}-${{ steps.cleanup_gateway_probe_ref.git_ref }} - name: BuildAndPushImageOnHarbor run: | - docker build --build-arg GIT_REF=${{ github.event.inputs.gateway_probe_git_ref }} -f ${{ env.WORKING_DIRECTORY }}/Dockerfile . -t harbor.nymte.ch/nym/${{ env.CONTAINER_NAME }}:${{ steps.get_version.outputs.result }}-${{ github.event.inputs.gateway_probe_git_ref }} -t harbor.nymte.ch/nym/${{ env.CONTAINER_NAME }}:latest + docker build --build-arg GIT_REF=${{ github.event.inputs.gateway_probe_git_ref }} -f ${{ env.WORKING_DIRECTORY }}/Dockerfile . -t harbor.nymte.ch/nym/${{ env.CONTAINER_NAME }}:${{ steps.get_version.outputs.result }}-${{ steps.cleanup_gateway_probe_ref.git_ref }} -t harbor.nymte.ch/nym/${{ env.CONTAINER_NAME }}:latest docker push harbor.nymte.ch/nym/${{ env.CONTAINER_NAME }} --all-tags