-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #34 from DW-BI-Project/feature/deploy
Feature/deploy
- Loading branch information
Showing
4 changed files
with
82 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
name: Dev build image & push | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
|
||
jobs: | ||
build: | ||
name: Dockerize dbt | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
# actions/checkout MUST come before auth | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- id: auth | ||
name: Authenticate with Google Cloud | ||
uses: "google-github-actions/auth@v1" | ||
with: | ||
token_format: access_token | ||
project_id: ${{ vars.DBT_BIGQUERY_PROJECT_ID }} | ||
credentials_json: ${{ secrets.KEYFILE_CONTENTS }} | ||
access_token_lifetime: 300s | ||
|
||
- name: Login to Artifact Registry | ||
uses: docker/login-action@v1 | ||
with: | ||
registry: us-central1-docker.pkg.dev | ||
username: oauth2accesstoken | ||
password: ${{ steps.auth.outputs.access_token }} | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
- name: Get tag | ||
id: get-tag | ||
run: echo ::set-output name=short_ref::${GITHUB_REF#refs/*/} | ||
|
||
- name: Build & Push Image | ||
uses: docker/build-push-action@v4 | ||
with: | ||
context: ./silverwork_dbt | ||
platforms: linux/amd64,linux/arm64 | ||
push: true | ||
tags: | | ||
${{ secrets.DBT_REGISTRY_ENDPOINT }}:${{ steps.get-tag.outputs.short_ref }} | ||
${{ secrets.DBT_REGISTRY_ENDPOINT }}:latest | ||
- name: Trigger Airflow init dag | ||
env: | ||
AIRFLOW_WEBSERVER_ENDPOINT: ${{ secrets.AIRFLOW_WEBSERVER_ENDPOINT }} | ||
AIRFLOW_WEBSERVER_ID: ${{ secrets.AIRFLOW_WEBSERVER_ID }} | ||
AIRFLOW_WEBSERVER_PASSWORD: ${{ secrets.AIRFLOW_WEBSERVER_PASSWORD }} | ||
AIRFLOW_DBT_INIT_DAG_ID: ${{ secrets.AIRFLOW_DBT_INIT_DAG_ID }} | ||
shell: bash | ||
run: | | ||
curl "$AIRFLOW_WEBSERVER_ENDPOINT/api/v1/dags/$AIRFLOW_DBT_INIT_DAG_ID/dagRuns" --user "$AIRFLOW_WEBSERVER_ID:$AIRFLOW_WEBSERVER_PASSWORD" -H 'Content-Type: application/json' -d '{}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# 베이스 이미지 선택 | ||
FROM --platform=linux/amd64 python:3.9-slim | ||
|
||
# 작업 디렉토리 설정 | ||
WORKDIR /app | ||
|
||
COPY . /app | ||
|
||
RUN pip install dbt-snowflake dbt-bigquery pandas |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{% macro generate_schema_name(custom_schema_name, node) -%} | ||
|
||
{%- set default_schema = target.schema -%} | ||
{%- if custom_schema_name is none -%} | ||
|
||
{{ default_schema }} | ||
|
||
{%- else -%} | ||
|
||
{{ custom_schema_name | trim }} | ||
|
||
{%- endif -%} | ||
|
||
{%- endmacro %} |