-
Notifications
You must be signed in to change notification settings - Fork 1
72 lines (67 loc) · 2.47 KB
/
composer-vars-update.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
---
name: Composer Variables Update
on:
workflow_call:
secrets:
WORKLOAD_ID_PROVIDER:
required: true
SERVICE_ACCOUNT:
required: true
inputs:
GCP_PROJECT:
required: true
type: string
COMPOSER_ENVIRONMENT_NAME:
required: true
type: string
COMPOSER_ENVIRONMENT_LOCATION:
required: true
type: string
VARIABLES_FILE_PATH:
required: true
type: string
VARIABLES_FILE_NAME:
required: true
type: string
jobs:
composer-vars-update:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Authenticate to Google Cloud
id: gcloud_auth
uses: google-github-actions/auth@v1
with:
workload_identity_provider: ${{ secrets.WORKLOAD_ID_PROVIDER }}
service_account: ${{ secrets.SERVICE_ACCOUNT }}
project_id: ${{ inputs.GCP_PROJECT }}
token_format: 'access_token'
- name: Set up Cloud SDK
id: setup_cloud_sdk
uses: google-github-actions/setup-gcloud@v1
with:
version: '413.0.0'
install_components: gke-gcloud-auth-plugin
- name: Composer Storage Data Import
id: composer_storage_data_import
run: |
gcloud composer environments storage data import \
--environment=${{ inputs.COMPOSER_ENVIRONMENT_NAME }} \
--location=${{ inputs.COMPOSER_ENVIRONMENT_LOCATION }} \
--source=${{ inputs.VARIABLES_FILE_PATH }} \
--project=${{ inputs.GCP_PROJECT }}
- name: Composer Variables Import
id: composer_variables_import
env:
USE_GKE_GCLOUD_AUTH_PLUGIN: True
run: |
gcloud composer environments run \
${{ inputs.COMPOSER_ENVIRONMENT_NAME }} \
--location=${{ inputs.COMPOSER_ENVIRONMENT_LOCATION }} \
--project=${{ inputs.GCP_PROJECT }} \
variables \
import -- /home/airflow/gcs/data/${{ inputs.VARIABLES_FILE_NAME }}