Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug in delete deployment preview #102

Open
sakethsomaraju opened this issue Dec 13, 2024 · 0 comments
Open

Bug in delete deployment preview #102

sakethsomaraju opened this issue Dec 13, 2024 · 0 comments

Comments

@sakethsomaraju
Copy link
Contributor

While creating create-deployment-preview , / are being striped off, even if the actual branch name consists /

 if [[ ${GITHUB_HEAD_REF##*/} != "" ]]; then
              BRANCH_DEPLOYMENT_NAME=${GITHUB_HEAD_REF##*/}_$DEPLOYMENT_NAME
 else
              branch_ref="${{ github.ref }}"
              branch_name="${branch_ref##*/}"
              BRANCH_DEPLOYMENT_NAME=${branch_name}_$DEPLOYMENT_NAME
  fi

This causes issues with deletion delete-deployment-preview as no cleanup is performed below.

BRANCH_DEPLOYMENT_NAME=${{ github.event.ref }}_$DEPLOYMENT_NAME

Steps to reproduce:

  1. Use the following step to create a preview deployment with branch name feature/test-br
 - name: Deploy to Astro DAGS
      id: deploy_to_astro
      continue-on-error: true
      # if: ${{ github.event.inputs.deploy_type == 'DAGS' }}
      uses: astronomer/[email protected]
      with:
        action: create-deployment-preview
        deployment-id: ${{ env.DEPLOYMENT_ID }}
  1. commit the following workflow to main branch.
name: Personal Astronomer CI - Deploy
# on:
#   push:
#     branches:
#       - main

on:
  delete:
    branches:
      - "**"
  workflow_dispatch:

env:
  ## Sets Deployment API credentials as environment variables
  ASTRO_API_TOKEN: ${{ secrets.ASTRO_API_TOKEN }}
  WORKSPACE: "clilt7vco00a601kk5fz65ob1"  
  DEPLOYMENT_ID: "cm4kns26b04ig01inliml8o7x" 

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
   
    - name: Delete preview deployment
      uses: astronomer/[email protected]
      with:
        action: delete-deployment-preview
        deployment-id: cm4mdzw2g0fwi01lgxxx2zyy7

 
  1. Delete feature/test-br on remote to trigger workflow with git push origin -d feature/test-br
  2. Workflow fails with No Deployment with the name feature/test-br_test was found

But it should try to delete test-br_test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant