Skip to content

Deploy integration tests to astro cloud #274

Deploy integration tests to astro cloud

Deploy integration tests to astro cloud #274

---
name: deploy-integration-tests-to-astro-cloud
on: # yamllint disable-line rule:truthy
schedule:
- cron: "0 19 * * *"
workflow_dispatch:
inputs:
git_rev:
description: 'The git revision to deploy'
required: false
default: ''
environment_to_deploy:
description: 'astro cloud deployment to deploy to'
required: true
type: choice
options:
- both
- providers-integration-tests
- providers-integration-tests-on-KE
dags_to_trigger_after_deployment:
description: |
Comma separated list of dag_ids to trigger after deployment
(e.g. "example_async_adf_run_pipeline, example_async_batch")
required: false
type: string
default: ''
jobs:
deploy-to-providers-integration-tests:
if: |
contains(fromJSON('["both", "providers-integration-tests"]'), inputs.environment_to_deploy) ||
github.event_name == 'schedule'
uses: ./.github/workflows/deploy-to-astro-cloud-reuse-wf.yaml
with:
git_rev: ${{ inputs.git_rev }}
environment_to_deploy: 'providers-integration-tests'
secrets:
docker_registry: ${{ secrets.DOCKER_REGISTRY }}
organization_id: ${{ secrets.ORGANIZATION_ID }}
deployment_id: ${{ secrets.PROVIDER_INTEGRATION_TESTS_DEPLOYMENT_ID }}
astronomer_key_id: ${{ secrets.PROVIDER_INTEGRATION_TESTS_ASTRONOMER_KEY_ID }}
astronomer_key_secret: ${{ secrets.PROVIDER_INTEGRATION_TESTS_ASTRONOMER_KEY_SECRET }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
wait-for-deployment-to-be-ready-and-trigger-dags-for-providers-integration-tests:
if: |
github.event_name == 'schedule' ||
(github.event_name == 'workflow_dispatch' && inputs.dags_to_trigger_after_deployment != '')
needs: deploy-to-providers-integration-tests
runs-on: 'ubuntu-20.04'
steps:
- name: Sleep for 30 minutes
run: |
sleep_time=1800
echo "Current timestamp is" `date`
echo "Sleeping for $sleep_time seconds"
echo "allowing the deployed image to be updated across all Airflow components.."
sleep 1800
- name: checkout
uses: actions/checkout@v3
with:
ref: ${{ inputs.git_rev }}
- name: Trigger DAG(s)
run: |
python3 dev/integration_test_scripts/trigger_dag.py \
${{ secrets.PROVIDER_INTEGRATION_TESTS_DEPLOYMENT_ID }} \
${{ secrets.PROVIDER_INTEGRATION_TESTS_ASTRONOMER_KEY_ID }} \
${{ secrets.PROVIDER_INTEGRATION_TESTS_ASTRONOMER_KEY_SECRET }} \
--dag-ids "${{ inputs.dags_to_trigger_after_deployment }}"
deploy-to-providers-integration-tests-on-KE:
if: |
contains(fromJSON('["both", "providers-integration-tests-on-KE"]'), inputs.environment_to_deploy) ||
github.event_name == 'schedule'
uses: ./.github/workflows/deploy-to-astro-cloud-reuse-wf.yaml
with:
git_rev: ${{ inputs.git_rev }}
environment_to_deploy: 'providers-integration-tests-on-KE'
secrets:
docker_registry: ${{ secrets.DOCKER_REGISTRY }}
organization_id: ${{ secrets.ORGANIZATION_ID }}
deployment_id: ${{ secrets.PROVIDER_INTEGRATION_TESTS_ON_KE_DEPLOYMENT_ID }}
astronomer_key_id: ${{ secrets.PROVIDER_INTEGRATION_TESTS_ON_KE_ASTRONOMER_KEY_ID }}
astronomer_key_secret: ${{ secrets.PROVIDER_INTEGRATION_TESTS_ON_KE_ASTRONOMER_KEY_SECRET }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
wait-for-deployment-to-be-ready-and-trigger-dags-for-providers-integration-tests-on-KE:
if: |
github.event_name == 'schedule' ||
(github.event_name == 'workflow_dispatch' && inputs.dags_to_trigger_after_deployment != '')
needs: deploy-to-providers-integration-tests-on-KE
runs-on: 'ubuntu-20.04'
steps:
- name: Sleep and wait for the deployment to be ready
run: |
sleep_time=1800
echo "Current timestamp is" `date`
echo "Sleeping for $sleep_time seconds"
echo "allowing the deployed image to be updated across all Airflow components.."
sleep $sleep_time
- name: checkout
uses: actions/checkout@v3
with:
ref: ${{ inputs.git_rev }}
- name: Trigger DAG(s)
run: |
python3 dev/integration_test_scripts/trigger_dag.py \
${{ secrets.PROVIDER_INTEGRATION_TESTS_ON_KE_DEPLOYMENT_ID }} \
${{ secrets.PROVIDER_INTEGRATION_TESTS_ON_KE_ASTRONOMER_KEY_ID }} \
${{ secrets.PROVIDER_INTEGRATION_TESTS_ON_KE_ASTRONOMER_KEY_SECRET }} \
--dag-ids "${{ inputs.dags_to_trigger_after_deployment }}"