Skip to content

Commit

Permalink
Fix gdrive_to_snowflake task in example_load_dag (#2072)
Browse files Browse the repository at this point in the history
The `gdrive_to_snowflake` task was failing because we hadn't set the
`GOOGLE_APPLICATION_CREDENTIALS` in deployment. This pull request
addresses the issue by creating a credential file using the Google Cloud
Platform Service Account credentials from secrets, which is essential
for the task.
  • Loading branch information
vatsrahul1001 authored Dec 22, 2023
1 parent 04b8c3d commit 73d398a
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/ci-astro-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ jobs:
deployment_id: ${{ secrets.ASTRO_DEPLOYMENT_ID }}
bearer_token: ${{ secrets.BEARER_TOKEN }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
GCP_SERVICE_ACCOUNT_JSON: ${{ secrets.GCP_SERVICE_ACCOUNT_JSON }}

wait-for-deployment-to-be-ready-and-trigger-dags-for-astro-sdk-integration-tests:
if: |
Expand Down Expand Up @@ -89,6 +90,7 @@ jobs:
deployment_id: ${{ secrets.ASTRO_DEPLOYMENT_ID_KE }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
bearer_token: ${{ secrets.BEARER_TOKEN }}
GCP_SERVICE_ACCOUNT_JSON: ${{ secrets.GCP_SERVICE_ACCOUNT_JSON }}

wait-for-deployment-to-be-ready-and-trigger-dags-for-astro-sdk-integration-tests-on-KE:
if: |
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/reuse-wf-deploy-to-astro-cloud.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ on: # yamllint disable-line rule:truthy
SLACK_WEBHOOK_URL:
description: 'slack webhook url for sending notification'
required: true
GCP_SERVICE_ACCOUNT_JSON:
description: 'GCP service account json'
required: true


jobs:
deploy-to-astro-cloud:
Expand All @@ -47,11 +51,13 @@ jobs:
working-directory: python-sdk/tests_integration/astro_deploy
run: |
echo "deploying ${{ inputs.git_rev }} to ${{ inputs.environment_to_deploy }}"
echo "${{ secrets.GCP_SERVICE_ACCOUNT_JSON }}" | base64 --decode > service-account-key.json
bash deploy.sh ${{ secrets.docker_registry }}\
${{ secrets.organization_id }} \
${{ secrets.deployment_id }} \
${{ secrets.bearer_token }} \
- name: send succeeded notification to Slack
if: success() && github.event_name == 'workflow_dispatch'
uses: slackapi/[email protected]
Expand Down
5 changes: 3 additions & 2 deletions python-sdk/tests_integration/astro_deploy/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
FROM quay.io/astronomer/astro-runtime:9.5.0-base

FROM quay.io/astronomer/astro-runtime:10.0.0-base
USER root
RUN apt-get update -y && apt-get install -y git
RUN apt-get install -y --no-install-recommends \
Expand All @@ -22,6 +21,7 @@ RUN pip install astronomer-starship-provider

RUN mkdir -p ${AIRFLOW_HOME}/dags
RUN mkdir -p ${AIRFLOW_HOME}/tests
RUN mkdir -p ${AIRFLOW_HOME}/include

COPY example_dags/ ${AIRFLOW_HOME}/dags/
COPY master_dag.py/ ${AIRFLOW_HOME}/dags/
Expand All @@ -30,3 +30,4 @@ COPY astronomer_migration_dag.py/ ${AIRFLOW_HOME}/dags/
COPY tests/ ${AIRFLOW_HOME}/tests/

RUN ls ${AIRFLOW_HOME}/dags/
COPY service-account-key.json $AIRFLOW_HOME/include/astro_sdk_gcp_cred.json
2 changes: 1 addition & 1 deletion python-sdk/tests_integration/astro_deploy/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function echo_help() {
echo "ASTRO_ORGANIZATION_ID Astro cloud organization Id"
echo "ASTRO_DEPLOYMENT_ID Astro cloud Deployment id"
echo "TOKEN Astro workspace token"
echo "bash deploy.sh <ASTRO_DOCKER_REGISTRY> <ASTRO_ORGANIZATION_ID> <ASTRO_DEPLOYMENT_ID> <TOKEN>"
echo "bash deploy.sh <ASTRO_DOCKER_REGISTRY> <ASTRO_ORGANIZATION_ID> <ASTRO_DEPLOYMENT_ID> <TOKEN> "
}

if [ "$1" == "-h" ]; then
Expand Down

0 comments on commit 73d398a

Please sign in to comment.