Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
… into tx-dag
  • Loading branch information
cayod committed Oct 30, 2023
2 parents f9c68cf + 98728a9 commit d7c77a7
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 3 deletions.
13 changes: 13 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,19 @@ jobs:
GOOGLE_CLOUD_PROJECT: test-hubble-319619
BUCKET: us-central1-hubble-1pt5-dev-7db0e004-bucket

- name: Update Airflow variables
uses: actions-hub/gcloud@master
env:
PROJECT_ID: test-hubble-319619
APPLICATION_CREDENTIALS: "${{ secrets.CREDS_TEST_HUBBLE }}"
COMPOSER_ENVIRONMENT: hubble-1pt5-dev
LOCATION: us-central1
with:
args: >
components install kubectl && gcloud composer environments run
$COMPOSER_ENVIRONMENT --location $LOCATION variables import
-- gcsfuse/variables.json
promote-to-prod:
runs-on: ubuntu-latest
# deploy only occurs when pr is merged
Expand Down
15 changes: 14 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:

- name: Install dependencies
run: |
cat airflow_variables.json | sed -e s/\\/home\\/airflow\\/gcs\\/dags\\/// > airflow_variables_ci.json
cat airflow_variables_prod.json | sed -e s/\\/home\\/airflow\\/gcs\\/dags\\/// > airflow_variables_ci.json
python -m pip install --upgrade pip
pip install -r requirements-ci.txt
Expand Down Expand Up @@ -65,3 +65,16 @@ jobs:
env:
GOOGLE_CLOUD_PROJECT: hubble-261722
BUCKET: us-central1-hubble-2-d948d67b-bucket

- name: Update Airflow variables
uses: actions-hub/gcloud@master
env:
PROJECT_ID: hubble-261722
APPLICATION_CREDENTIALS: "${{ secrets.CREDS_TEST_HUBBLE }}"
COMPOSER_ENVIRONMENT: hubble-2
LOCATION: us-central1
with:
args: >
components install kubectl && gcloud composer environments run
$COMPOSER_ENVIRONMENT --location $LOCATION variables import
-- gcsfuse/variables.json
File renamed without changes.
10 changes: 8 additions & 2 deletions dags/stellar_etl_airflow/add_files_to_composer.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ def _create_files_list(env: str) -> Tuple[str, List[str]]:
# copy airflow configuration file
copy(f"airflow-{env}.cfg", f"{temp_dir}/airflow.cfg")
copy(f"airflow-{env}.cfg", f"airflow.cfg")

# copy airflow variables json
copy(f"airflow_variables_{env}.json", f"{temp_dir}/variables.json")
copy(f"airflow_variables_{env}.json", f"variables.json")
dags = glob(f"{temp_dir}/**/*.*", recursive=True)
return (temp_dir, dags)

Expand All @@ -53,7 +55,11 @@ def upload_dags_to_composer(bucket_name: str, env: str) -> None:

for f in files:
# remove path to temp dir
if f.endswith(".json"):
if f.endswith(f"variables.json"):
# insert airflow variable file
f = f.replace(f"{temp_dir}/", "")
blob = bucket.blob(f)
elif f.endswith(".json"):
# create schemas directory
f = f.replace(f"{temp_dir}/", "schemas/")
schema_destination = "dags/" + f
Expand Down

0 comments on commit d7c77a7

Please sign in to comment.