Skip to content

Commit

Permalink
Deploy only if RC is released (#1396)
Browse files Browse the repository at this point in the history
Our RC test workflow was updating the deployment and running the master DAG even if there was no RC release. This PR only initiates deployment and DAG triggers when we have an RC release.
  • Loading branch information
vatsrahul1001 authored Mar 15, 2024
1 parent f586ded commit e66a1a2
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 23 deletions.
36 changes: 22 additions & 14 deletions .github/workflows/reuse-wf-check-rc-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,19 @@ on: # yamllint disable-line rule:truthy
(Either rc_testing_branch or issue_url is required, and you cannot give both.)
required: false
type: string
default: ''
default: ""
issue_url:
description: |
issue_url: the GitHub issue URL that tracks the status of Providers release
(Either rc_testing_branch or issue_url is required, and you cannot give both.)
required: false
type: string
default: ''
default: ""
base_git_rev:
description: 'The base git revision to test Providers RCs'
description: "The base git revision to test Providers RCs"
required: false
type: string
default: 'main'
default: "main"
git_email:
description: "bot's email for setting up git"
required: true
Expand All @@ -38,27 +38,33 @@ on: # yamllint disable-line rule:truthy
description: "the path to run scripts"
required: false
type: string
default: ''
default: ""
secrets:
BOT_ACCESS_TOKEN:
description: 'personal access token for the bot to push the commit and create pull request'
description: "personal access token for the bot to push the commit and create pull request"
required: true
outputs:
rc_testing_branch:
description: 'personal access token for the bot to push the commit and create pull request'
description: "personal access token for the bot to push the commit and create pull request"
value: ${{ jobs.export-rc-testing-branch-name.outputs.rc_testing_branch }}
no_provider_changed:
description: "no provider has been changed in this rc release"
value: ${{ jobs.create-branch-for-testing-rc-release.outputs.no_provider_changed }}
rc_issue_url:
description: "the newly found GitHub issue URL that tracks the status of Providers release"
value: ${{ jobs.check-rc-testing-announcement.outputs.rc_issue_url }}

jobs:
check-rc-testing-announcement:
runs-on: 'ubuntu-20.04'
runs-on: "ubuntu-20.04"
if: github.event_name == 'schedule'
env:
GH_TOKEN: ${{ github.token }}
steps:
- name: Checkout apache-airflow
uses: actions/checkout@v3
with:
repository: 'apache/airflow'
repository: "apache/airflow"

- name: Parse the latest 100 GitHub issues from apache-airflow to check providers testing announcement
id: parse-airflow-gh-issues
Expand Down Expand Up @@ -115,20 +121,20 @@ jobs:
rc_issue_url: ${{ steps.export-rc-issue-url.outputs.rc_issue_url }}

validate-manual-input:
runs-on: 'ubuntu-20.04'
runs-on: "ubuntu-20.04"
if: github.event_name == 'workflow_dispatch'
steps:
- name: Validate user input
if: |
(inputs.rc_testing_branch == '' && inputs.issue_url == '') ||
(inputs.rc_testing_branch != '' && inputs.issue_url != '')
(inputs.rc_testing_branch == '' && inputs.issue_url == '') ||
(inputs.rc_testing_branch != '' && inputs.issue_url != '')
run: |
echo "Either rc_testing_branch or issue_url is required, and you cannot give both."
exit 1
create-branch-for-testing-rc-release:
needs: [validate-manual-input, check-rc-testing-announcement]
runs-on: 'ubuntu-20.04'
runs-on: "ubuntu-20.04"
if: |
always() &&
(
Expand Down Expand Up @@ -182,6 +188,7 @@ jobs:
echo "no_provider_changed=true" >> $GITHUB_OUTPUT
else
echo "$difference"
echo "no_provider_changed=false" >> $GITHUB_OUTPUT
fi
- name: Create RC branch
Expand Down Expand Up @@ -215,6 +222,7 @@ jobs:
echo "git_rev=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
outputs:
rc_testing_branch: ${{ steps.create_rc_branch.outputs.rc_testing_branch }}
no_provider_changed: ${{ steps.check-repo-provideres-updated.outputs.no_provider_changed }}

export-rc-testing-branch-name:
needs: [validate-manual-input, create-branch-for-testing-rc-release]
Expand All @@ -228,7 +236,7 @@ jobs:
needs.validate-manual-input.result == 'success' &&
inputs.rc_testing_branch
)
runs-on: 'ubuntu-20.04'
runs-on: "ubuntu-20.04"
steps:
- name: export rc_testing_branch
id: export-rc-testing-branch-name-step
Expand Down
34 changes: 25 additions & 9 deletions .github/workflows/test-rc-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,17 @@ on: # yamllint disable-line rule:truthy
rc_testing_branch: existing testing branch
(Either rc_testing_branch or issue_url is required, and you cannot give both.)
required: false
default: ''
default: ""
issue_url:
description: |
issue_url: the GitHub issue URL that tracks the status of Providers release
(Either rc_testing_branch or issue_url is required, and you cannot give both.)
required: false
base_git_rev:
description: 'The base git revision to test Providers RCs'
description: "The base git revision to test Providers RCs"
required: false
type: string
default: 'main'
default: "main"

jobs:
check-airflow-provider-rc-release:
Expand All @@ -42,11 +42,15 @@ jobs:
needs: check-airflow-provider-rc-release
if: |
always() &&
needs.check-airflow-provider-rc-release.result == 'success'
(
needs.check-airflow-provider-rc-release.outputs.rc_issue_url != '' ||
inputs.issue_url != ''
) &&
needs.check-airflow-provider-rc-release.outputs.no_provider_changed != 'true'
uses: ./.github/workflows/reuse-wf-deploy-to-astro-cloud.yaml
with:
git_rev: ${{ needs.check-airflow-provider-rc-release.outputs.rc_testing_branch }}
environment_to_deploy: 'providers-integration-tests'
environment_to_deploy: "providers-integration-tests"
secrets:
docker_registry: ${{ secrets.DOCKER_REGISTRY }}
organization_id: ${{ secrets.ORGANIZATION_ID }}
Expand All @@ -55,7 +59,11 @@ jobs:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}

wait-for-deployment-to-be-ready-and-trigger-master-dag:
needs: [deploy-rc-testing-branch-to-astro-cloud, check-airflow-provider-rc-release]
needs:
[
deploy-rc-testing-branch-to-astro-cloud,
check-airflow-provider-rc-release,
]
if: |
always() &&
needs.deploy-rc-testing-branch-to-astro-cloud.result == 'success'
Expand All @@ -73,11 +81,15 @@ jobs:
needs: check-airflow-provider-rc-release
if: |
always() &&
needs.check-airflow-provider-rc-release.result == 'success'
(
needs.check-airflow-provider-rc-release.outputs.rc_issue_url != '' ||
inputs.issue_url != ''
) &&
needs.check-airflow-provider-rc-release.outputs.no_provider_changed != 'true'
uses: ./.github/workflows/reuse-wf-deploy-to-astro-cloud.yaml
with:
git_rev: ${{ needs.check-airflow-provider-rc-release.outputs.rc_testing_branch }}
environment_to_deploy: 'providers-integration-tests'
environment_to_deploy: "providers-integration-tests"
secrets:
docker_registry: ${{ secrets.DOCKER_REGISTRY }}
organization_id: ${{ secrets.ORGANIZATION_ID }}
Expand All @@ -86,7 +98,11 @@ jobs:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}

wait-for-deployment-to-be-ready-and-trigger-master-dag-on-GCP:
needs: [deploy-rc-testing-branch-to-astro-cloud, check-airflow-provider-rc-release]
needs:
[
deploy-rc-testing-branch-to-astro-cloud,
check-airflow-provider-rc-release,
]
if: |
always() &&
needs.deploy-rc-testing-branch-to-astro-cloud.result == 'success'
Expand Down

0 comments on commit e66a1a2

Please sign in to comment.