From d0e1e2bf6a5e7172bd1f23ed9aacbc1e90831e0d Mon Sep 17 00:00:00 2001 From: azatsafin Date: Fri, 17 Jun 2022 15:20:41 +0300 Subject: [PATCH] start use pr number instead of branch name for custom deployments (#2179) Co-authored-by: Azat Safin --- .github/workflows/branch-deploy.yml | 6 +----- .github/workflows/branch-remove.yml | 8 ++------ 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/.github/workflows/branch-deploy.yml b/.github/workflows/branch-deploy.yml index 7d93385c30..63935f6b88 100644 --- a/.github/workflows/branch-deploy.yml +++ b/.github/workflows/branch-deploy.yml @@ -13,11 +13,7 @@ jobs: - name: get branch name id: extract_branch run: | - hub pr checkout ${{ github.event.pull_request.number }} - branch_name=$(hub branch | grep "*" | sed -e 's/^\*//') - echo $branch_name - echo ::set-output name=branch::${branch_name} - tag=$(echo $branch_name | sed 's/\//-/g' | sed 's/\./-/g' | sed 's/\_/-/g' | sed -e 's/\(.*\)/\L\1/' | cut -c1-32 | sed -E 's/(^[^a-z0-9])*([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)([^a-z0-9]*)/\2/') + tag='pr${{ github.event.pull_request.number }}' echo ::set-output name=tag::${tag} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/branch-remove.yml b/.github/workflows/branch-remove.yml index ccbacea3c9..8582b6feb7 100644 --- a/.github/workflows/branch-remove.yml +++ b/.github/workflows/branch-remove.yml @@ -12,11 +12,7 @@ jobs: - name: get branch name id: extract_branch run: | - hub pr checkout ${{ github.event.pull_request.number }} - branch_name=$(hub branch | grep "*" | sed -e 's/^\*//') - echo $branch_name - echo ::set-output name=branch::${branch_name} - tag=$(echo $branch_name | sed 's/\//-/g' | sed 's/\./-/g' | sed 's/\_/-/g' | cut -c1-32) + tag='pr${{ github.event.pull_request.number }}' echo ::set-output name=tag::${tag} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -27,7 +23,7 @@ jobs: run: | cd kafka-ui-infra/aws-infrastructure4eks/argocd/scripts echo "Branch:${{ steps.extract_branch.outputs.tag }}" - ./delete-env.sh ${{ steps.extract_branch.outputs.tag }} + ./delete-env.sh ${{ steps.extract_branch.outputs.tag }} || true git config --global user.email "kafka-ui-infra@provectus.com" git config --global user.name "kafka-ui-infra" git add ../kafka-ui-from-branch/