Skip to content

Commit

Permalink
ci(github-actions): unify yaml format and explicitly export no_provid…
Browse files Browse the repository at this point in the history
…er_changed
  • Loading branch information
Lee-W committed Mar 15, 2024
1 parent a2b180a commit a962516
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 25 deletions.
38 changes: 23 additions & 15 deletions .github/workflows/reuse-wf-check-rc-release.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
name: (Reusable workflows) Check airflow provider RC releases and create testing branch

on: # yamllint disable-line rule:truthy
on: # yamllint disable-line rule:truthy
workflow_call:
inputs:
rc_testing_branch:
Expand All @@ -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
36 changes: 26 additions & 10 deletions .github/workflows/test-rc-release.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
name: Test providers RC releases

on: # yamllint disable-line rule:truthy
on: # yamllint disable-line rule:truthy
schedule:
- cron: "0 0,12 * * *"
workflow_dispatch:
Expand All @@ -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.outputs.rc_issue_url != ''
(
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.outputs.rc_issue_url != ''
(
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 a962516

Please sign in to comment.