Skip to content

Commit 82d8862

Browse files
committed
break it up
1 parent 8eb3860 commit 82d8862

26 files changed

+296
-25
lines changed

.devcontainer/pypi_vulnerabilities.code-workspace

Lines changed: 0 additions & 17 deletions
This file was deleted.

.github/workflows/deploy_safety.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ jobs:
2424
- name: load_prod_safety_db
2525
uses: ./.github/actions/run_in_venv
2626
with:
27-
working-dir: .
27+
working-dir: ./safety_etl
2828
script: |
29-
dbt run-operation ensure_datasets
30-
python etl/safety_db/load_missing_partitions.py --dataset ${DBT_DATASET}_internal
29+
python ./load_missing_partitions.py --dataset ${DBT_DATASET}_impl
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
on:
2+
workflow_dispatch: {}
3+
workflow_call: {}
4+
5+
jobs:
6+
deploy:
7+
runs-on: ubuntu-latest
8+
env:
9+
PIP_REQUIRE_VIRTUALENV: true
10+
DBT_MAX_GIGABYTES_BILLED: ${{ vars.DBT_MAX_GIGABYTES_BILLED }}
11+
permissions:
12+
contents: read
13+
id-token: write
14+
steps:
15+
- name: checkout
16+
uses: actions/checkout@v4
17+
18+
- name: setup_workflow
19+
uses: ./.github/actions/setup_default_workflow
20+
with:
21+
workload_identity_provider: ${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER }}
22+
service_account: ${{ secrets.GCP_SERVICE_ACCOUNT }}
23+
24+
- name: deploy udfs
25+
uses: ./.github/actions/run_in_venv
26+
with:
27+
working-dir: ./semver_udf
28+
script: |
29+
dbt build

.github/workflows/pipeline.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,21 @@ jobs:
1616
id-token: write
1717
secrets: inherit
1818

19+
refresh-semver-udf:
20+
uses: ./.github/workflows/deploy_semver_udf.yml
21+
permissions:
22+
contents: read
23+
id-token: write
24+
secrets: inherit
25+
1926
refresh-safety:
2027
uses: ./.github/workflows/deploy_safety.yml
2128
permissions:
2229
contents: read
2330
id-token: write
2431
secrets: inherit
32+
needs:
33+
- refresh-semver-udf
2534

2635
refresh_vulns:
2736
uses: ./.github/workflows/deploy_vulns.yml
@@ -30,8 +39,9 @@ jobs:
3039
id-token: write
3140
actions: read
3241
pages: write
42+
secrets: inherit
3343
needs:
44+
- refresh-semver-udf
3445
- refresh-safety
3546
- refresh-pypi
36-
secrets: inherit
3747

.safety-policy.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
11
security:
2-
ignore-vulnerabilities:
3-
'73530':
4-
reason: No details of vulnerability
2+
ignore-vulnerabilities: {}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{% macro grant_schemas(schemas, grant_view_to=[], revoke_view_from=[]) -%}
2+
{% if execute %}
3+
{% for schema in schemas %}
4+
{% if grant_view_to|length > 0 and not schema.endswith('_impl') %}
5+
6+
{%- set grant_sql -%}
7+
GRANT `roles/bigquery.dataViewer`
8+
ON SCHEMA {{ schema }}
9+
TO
10+
{% for principal in grant_view_to %}
11+
'{{ principal }}'{{ ", " if not loop.last else "" }}
12+
{% endfor %}
13+
{%- endset -%}
14+
15+
{%- do run_query(grant_sql) -%}
16+
{% endif %}
17+
18+
{% if revoke_view_from|length > 0 %}
19+
{%- set revoke_sql -%}
20+
REVOKE `roles/bigquery.dataViewer`
21+
ON SCHEMA {{ schema }}
22+
FROM
23+
{% for principal in revoke_view_from %}
24+
'{{ principal }}'{{ ", " if not loop.last else "" }}
25+
{% endfor %}
26+
{%- endset -%}
27+
28+
{%- do run_query(revoke_sql) -%}
29+
{% endif %}
30+
31+
{% endfor %}
32+
{% endif %}
33+
34+
{%- endmacro %}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{
2+
"folders": [
3+
{
4+
"name": "pypi",
5+
"path": "pypi"
6+
},
7+
{
8+
"name": "safety",
9+
"path": "safety"
10+
},
11+
{
12+
"name": "safety_etl",
13+
"path": "safety_etl"
14+
},
15+
{
16+
"name": "semver_udf",
17+
"path": "semver_udf"
18+
},
19+
{
20+
"name": "dbt_shared",
21+
"path": "dbt_shared"
22+
},
23+
{
24+
"name": "vscode_shared",
25+
"path": "vscode_shared"
26+
},
27+
{
28+
"name": ".github",
29+
"path": ".github"
30+
},
31+
{
32+
"name": "pypi_vulnerabilities",
33+
"path": "."
34+
}
35+
],
36+
"settings": {}
37+
}

safety/dbt_project.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: 'product' # only referred to in this config file
2+
version: '1.0.0'
3+
config-version: 2
4+
5+
profile: 'current'
6+
7+
macro-paths: ["macros", "../dbt_shared/macros"]
8+
analysis-paths: ["analyses"]
9+
test-paths: ["tests"]
10+
seed-paths: ["seeds"]
11+
model-paths: ["models"]
12+
snapshot-paths: ["snapshots"]
13+
14+
clean-targets:
15+
- "target"
16+
- "dbt_packages"
17+
18+
models:
19+
+labels:
20+
stability: unstable
21+
data_classification: public
22+
+persist_docs:
23+
relation: true
24+
columns: true
25+
# product:
26+
# impl:
27+
# +schema: impl
28+
29+
tests:
30+
product: {}
31+
32+
on-run-start:
33+
- '{{ ensure_dataset(is_public=env_var("DBT_PUBLIC")) }}'
34+
35+
on-run-end:
36+
- '{{ drop_redundant_models(dry_run=false) }}'

0 commit comments

Comments
 (0)