Skip to content

Commit

Permalink
chore: apply linter
Browse files Browse the repository at this point in the history
  • Loading branch information
vncsna committed Feb 14, 2024
1 parent 89de6e3 commit 47a8874
Show file tree
Hide file tree
Showing 444 changed files with 34,159 additions and 28,605 deletions.
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1 +1 @@
*.sql linguist-detectable=true
*.sql linguist-detectable=true
14 changes: 2 additions & 12 deletions .github/workflows/cd.yaml
Original file line number Diff line number Diff line change
@@ -1,22 +1,18 @@
---
name: CD

on:
push:
branches:
- main

branches: [main]
env:
REGISTRY: ghcr.io
IMAGE_NAME: basedosdados/queries-basedosdados-dev/dbt-rpc

jobs:
build-container:
name: Build, publish and register
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Import Secrets
id: import_secrets
uses: hashicorp/[email protected]
Expand All @@ -28,41 +24,35 @@ jobs:
secret/data/gcp_credentials/basedosdados-dev GCP_PROJECT_ID | GCP_PROJECT_ID ;
secret/data/gcp_credentials/basedosdados-dev GKE_CLUSTER_NAME | GKE_CLUSTER_NAME ;
secret/data/gcp_credentials/basedosdados-dev GKE_CLUSTER_ZONE | GKE_CLUSTER_ZONE ;
- name: Setup Google Cloud CLI
uses: google-github-actions/[email protected]
with:
service_account_key: ${{ steps.import_secrets.outputs.GCP_SA_KEY_BASE64 }}
project_id: ${{ steps.import_secrets.outputs.GKE_PROJECT_ID }}
export_default_credentials: true

- name: Get GKE credentials
uses: google-github-actions/[email protected]
with:
cluster_name: ${{ steps.import_secrets.outputs.GKE_CLUSTER_NAME }}
location: ${{ steps.import_secrets.outputs.GKE_CLUSTER_ZONE }}
credentials: ${{ steps.import_secrets.outputs.GCP_SA_KEY_BASE64 }}

- name: Log in to the Container registry
uses: docker/[email protected]
with:
registry: ${{ env.REGISTRY}}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push
uses: docker/[email protected]
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }}

- name: Set up Kustomize
run: |-
curl -sfLo kustomize https://github.com/kubernetes-sigs/kustomize/releases/download/v3.1.0/kustomize_3.1.0_linux_amd64
chmod u+x ./kustomize
- name: Deploy
run: |-
./kustomize edit set image gcr.io/PROJECT_ID/IMAGE_DBT:TAG=$REGISTRY/$IMAGE_NAME:$GITHUB_SHA
Expand Down
16 changes: 3 additions & 13 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
---
name: Deploy docs

on:
push:
branches:
- main

branches: [main]
jobs:
docs:
name: Deploy docs
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Import Secrets
id: import_secrets
uses: hashicorp/[email protected]
Expand All @@ -21,33 +18,26 @@ jobs:
token: ${{ secrets.VAULT_TOKEN}}
secrets: |
secret/data/queries_credentials/<GCP_PROJECT_NAME> GCP_SA_KEY | GCP_SA_KEY;
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.9.x"

python-version: 3.9.x
- name: Upgrade pip
run: |
pip install -U pip
- name: Install dependencies
run: |
pip3 install -r requirements-dev.txt -r requirements.txt
- name: Setup credentials
run: |
echo ${{ steps.import_secrets.outputs.GCP_SA_KEY }} > dbt-sa.json
python3 .github/workflows/scripts/modify_profiles.py
- name: Generate docs
run: |
dbt docs generate --profiles-dir .
- name: Delete credentials
run: |
rm dbt-sa.json
- name: Deploy docs
uses: JamesIves/[email protected]
with:
Expand Down
16 changes: 4 additions & 12 deletions .github/workflows/metadata_automation.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
---
name: Metadata Automation

on:
push:
branches:
- '*'

branches: ['*']
jobs:
update-metadata:
name: Update metadata from Google Sheets
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Import Secrets
id: import_secrets
uses: hashicorp/[email protected]
Expand All @@ -21,28 +18,23 @@ jobs:
token: ${{ secrets.VAULT_TOKEN}}
secrets: |
secret/data/queries_credentials/basedosdados-dev GCP_SA_KEY_BASE64 | GCP_SA_KEY_BASE64;
- name: Setup Python version
uses: actions/setup-python@v2
with:
python-version: "3.9"

python-version: '3.9'
- name: Install Python dependencies for actions
run: |-
pip install -r requirements-dev.txt
- name: Checkout to the head ref
run: |-
git fetch --depth=1
git checkout ${{ github.head_ref }}
- name: Update metadata
env:
GCP_SA_KEY_BASE64: ${{ steps.import_secrets.outputs.GCP_SA_KEY_BASE64 }}
run: |-
python3 .github/workflows/scripts/metadata_automation.py
- name: Commit changed files
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: 'Update metadata'
commit_message: Update metadata
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ venv-dbt/
.user.yml
dbt_packages
profiles.yml
gists/test.py
gists/test.py
15 changes: 6 additions & 9 deletions .kubernetes/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,12 @@ spec:
- name: credentials-prod
mountPath: /credentials-prod/
readOnly: true
command:
- "/bin/sh"
- "-c"
command: [/bin/sh, -c]
args:
- >
dbt deps;
dbt-rpc serve --profiles-dir . --profile default --target dev --host 0.0.0.0 --port 8580
dbt-rpc serve --profiles-dir . --profile default --target dev --host
0.0.0.0 --port 8580
volumes:
- name: credentials-dev
secret:
Expand All @@ -45,7 +44,6 @@ spec:
secret:
secretName: credentials-prod
restartPolicy: Always

---
apiVersion: apps/v1
kind: Deployment
Expand Down Expand Up @@ -78,13 +76,12 @@ spec:
- name: credentials-prod
mountPath: /credentials-prod/
readOnly: true
command:
- "/bin/sh"
- "-c"
command: [/bin/sh, -c]
args:
- >
dbt deps;
dbt-rpc serve --profiles-dir . --profile default --target prod --host 0.0.0.0 --port 8580
dbt-rpc serve --profiles-dir . --profile default --target prod --host
0.0.0.0 --port 8580
volumes:
- name: credentials-dev
secret:
Expand Down
5 changes: 2 additions & 3 deletions .kubernetes/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,11 @@ metadata:
name: dbt-rpc-dev
spec:
ports:
- name: "8580"
- name: '8580'
port: 8580
targetPort: 8580
selector:
app: dbt-rpc-dev

---
apiVersion: v1
kind: Service
Expand All @@ -22,7 +21,7 @@ metadata:
name: dbt-rpc-prod
spec:
ports:
- name: "8580"
- name: '8580'
port: 8580
targetPort: 8580
selector:
Expand Down
Loading

0 comments on commit 47a8874

Please sign in to comment.