-
Notifications
You must be signed in to change notification settings - Fork 29
Open
Description
I disabled checkout using checkout: false
option & explicitly specifying deploy-type: image-and-dags
so the deploy step should just skip the Get Deploy Type
step, but it still tries to do a git diff for identifying any file changes, which is not required?
- name: Get Deploy Type
if: ${{ inputs.deploy-type == 'infer' || inputs.deploy-type == 'dags-only' || inputs.deploy-type == 'image-and-dags' }}
run: |
# infer based on files changed to deploy only dags or image and dags
echo ::group::Get Deploy Type
if [[ "${{ inputs.root-folder }}" != "" ]]; then
cd ${{ inputs.root-folder }}
fi
DAGS_ONLY_DEPLOY=false
SKIP_IMAGE_OR_DAGS_DEPLOY=false
files=()
GITHUB_EVENT_BEFORE=${{ github.event.before }}
GITHUB_EVENT_AFTER=${{ github.event.after }}
# case when the triggered event is a manual workflow dispatch or a new branch or tag creation, we would need to deploy the image because we cannot determine that it does not need to be deployed
if [[ "$GITHUB_EVENT_BEFORE" == "0000000000000000000000000000000000000000" || -z $GITHUB_EVENT_BEFORE && -z $GITHUB_EVENT_AFTER ]]; then
echo "Manual workflow dispatch or a new branch or tag creation, hence missing github event before and/or after commit hash"
else
echo "event that triggered the workflow: $GITHUB_REF"
branch=$(echo "${GITHUB_REF#refs/heads/}")
git fetch origin $branch
if ! git cat-file -e "${{ github.event.before }}" 2>/dev/null; then
echo "Commit ${{ github.event.before }} does not exist, falling back to image deploy."
else
SKIP_IMAGE_OR_DAGS_DEPLOY=true
files=$(git diff --name-only ${{ github.event.before }} ${{ github.event.after }})
echo "files changed: $files"
fi
[fi`]([url](url))
I feel the condition should be changed to ?
if: ${{ inputs.deploy-type == 'infer' }}
Below is the log where it's trying to fetch the repo, when it's a custom zip (without git credentials)
Run astronomer/deploy-action@v0.10.1
Run echo ::group::Install Astro CLI
Install Astro CLI
Run echo ::group::Determine Deploy Deployment
Determine Deploy Deployment
Run echo ::group::Determine if DAG Deploy is enabled
Determine if DAG Deploy is enabled
Run # infer based on files changed to deploy only dags or image and dags
Get Deploy Type
event that triggered the workflow: refs/pull/5/merge
fatal: could not read Username for 'https://github.com/': No such device or address
Error: Process completed with exit code 128.
Below is my action pipeline
name: Astronomer CI - Deploy code to preview
on:
pull_request:
branches:
- main
jobs:
build-artifacts:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.after }}
clean: false
persist-credentials: true
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: astronomer-airflow
path: .
include-hidden-files: true
test-artifacts:
needs: build-artifacts
runs-on: ubuntu-latest
steps:
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
name: astronomer-airflow
path: .
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install Python dependencies
run: |
pip install -r airflow/requirements.txt
pip install pytest
- name: Run tests
run: |
cd airflow
pytest --maxfail=1 --disable-warnings -q
deploy-artifacts:
needs: test-artifacts
runs-on: ubuntu-latest
environment: DEV
env:
ASTRO_DEPLOYMENT_ID: cmbyzhi151orp01l3dknlg1ty
ASTRO_API_TOKEN: ${{ secrets.ASTRO_DEPLOY_API_TOKEN }}
steps:
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
name: astronomer-airflow
path: .
- name: Deploy code to ${{ env.ASTRO_DEPLOYMENT_ID }}
uses: astronomer/deploy-action@v0.10.1
with:
checkout: true
deployment-id: ${{ env.ASTRO_DEPLOYMENT_ID }}
deploy-type: image-and-dags
root-folder: airflow
parse: true
pytest: true
Metadata
Metadata
Assignees
Labels
No labels