Skip to content

Commit ad359b7

Browse files
authored
BFD-4576: Make IDR->BFD validation script run automatically on a schedule (#3229)
1 parent 27292c9 commit ad359b7

84 files changed

Lines changed: 2236 additions & 357 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/build-container-images.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,8 @@ jobs:
277277
- name: Generate build-contexts
278278
if: ${{ !inputs.skipBasePull }}
279279
id: gen-build-contexts
280+
env:
281+
NAMED_CONTEXTS: ${{ toJSON(matrix.image.namedContexts) || '{}' }}
280282
run: |
281283
build_contexts=()
282284
@@ -287,6 +289,15 @@ jobs:
287289
build_contexts+=("${image}:latest=docker-image://localhost:5000/${image}:${BASE_IMAGES_VERSION}")
288290
done
289291
292+
readarray -t named_contexts < <(echo "$NAMED_CONTEXTS" | jq -rc '. // {} | to_entries[]')
293+
for named_context in "${named_contexts[@]}"
294+
do
295+
context_name="$(jq -rc '.key' <<<"$named_context")"
296+
context_path="$(jq -rc '.value' <<<"$named_context")"
297+
298+
build_contexts+=("${context_name}=${context_path}")
299+
done
300+
290301
build_contexts_json="$(jq -c -n '$ARGS.positional' --args "${build_contexts[@]}")"
291302
292303
echo "build-contexts=$build_contexts_json" >> "$GITHUB_OUTPUT"

.github/workflows/build-release.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,8 @@ jobs:
452452
bfd-platform-pipeline-ccw-runner,
453453
bfd-platform-consume-idr-events,
454454
bfd-platform-run-idr-pipeline,
455-
bfd-platform-codebuild-runner
455+
bfd-platform-codebuild-runner,
456+
bfd-platform-idr-bfd-validator
456457
baseImagesVersion: ${{ needs.compute-version-strings.outputs.bfd_release }}
457458
cleanupImageArtifacts: false # We'll cleanup at the end of build-release, so don't do anything
458459
tagLatest: ${{ !contains(needs.compute-version-strings.outputs.bfd_release, '-') }}

.github/workflows/build_container_images_matrix.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,5 +82,14 @@
8282
"dockerfile": "ops/images/bfd-platform-codebuild-runner/Dockerfile",
8383
"contextDir": "ops/images/bfd-platform-codebuild-runner",
8484
"platform": "linux/arm64"
85+
},
86+
{
87+
"name": "bfd-platform-idr-bfd-validator",
88+
"dockerfile": "apps/utils/idr-bfd-validator/Dockerfile",
89+
"contextDir": "apps/utils/idr-bfd-validator",
90+
"namedContexts": {
91+
"idr-pipeline": "apps/bfd-pipeline-idr"
92+
},
93+
"platform": "linux/arm64"
8594
}
8695
]

.github/workflows/v3-release-deploy.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,7 @@ jobs:
385385
database,
386386
migrator-ng,
387387
idr-pipeline,
388+
idr-bfd-validator,
388389
idr-pipeline-metrics,
389390
idr-pipeline-alarms,
390391
server-ng,
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Dockerfile.dockerignore

apps/bfd-pipeline-idr/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,4 +62,4 @@ ENV PATH="/app/.venv/bin:$PATH"
6262
ENV PYTHONDONTWRITEBYTECODE=1
6363

6464
# Run the pipeline in IDR mode by default
65-
CMD ["uv", "run", "--no-sync", "pipeline.py"]
65+
CMD ["uv", "run", "--no-sync", "idr-pipeline"]

apps/bfd-pipeline-idr/Dockerfile.dockerignore

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
!pyproject.toml
33
!uv.lock
44
!.python-version
5-
!model/*.py
6-
!matching/*.py
7-
!*.py
5+
!src/idr_pipeline/model/*.py
6+
!src/idr_pipeline/matching/*.py
7+
!src/idr_pipeline/*.py

apps/bfd-pipeline-idr/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ source ./load-credentials.sh
9090
Run the app (optionally specify a minimum transaction date)
9191

9292
```sh
93-
PIPELINE_MIN_TRANSACTION_DATE=2024-01-01 uv run pipeline.py
93+
PIPELINE_MIN_TRANSACTION_DATE=2024-01-01 uv run idr-pipeline
9494
```
9595

9696
## Adding data to the model

apps/bfd-pipeline-idr/load-synthetic-env.sh

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,12 @@
33
set -e
44

55
read -p "Are you sure you want to overwrite the data in ${BFD_ENV}? [yn] " -n 1 -r
6-
echo # (optional) move to a new line
7-
if ! [[ $REPLY =~ ^[Yy]$ ]]
8-
then
9-
echo 'exiting'
10-
exit 0
6+
echo # (optional) move to a new line
7+
if ! [[ $REPLY =~ ^[Yy]$ ]]; then
8+
echo 'exiting'
9+
exit 0
1110
fi
1211

13-
1412
DB_CLUSTER="bfd-${BFD_ENV}-aurora-cluster"
1513
readonly DB_CLUSTER
1614
BFD_DB_USERNAME="$(aws ssm get-parameter --name "/bfd/${BFD_ENV}/idr-pipeline/sensitive/db/username" --with-decryption --query "Parameter.Value" --output text)"
@@ -43,7 +41,7 @@ export IDR_SCHEMA
4341

4442
args=('--load-type' 'initial' '--source' 'snowflake' '--load-mode' 'synthetic')
4543
if [[ -n "$1" ]]; then
46-
args+=('--seed-from' "$1")
44+
args+=('--seed-from' "$1")
4745
fi
4846

49-
IDR_ENABLE_DATE_PARTITIONS=0 IDR_ENABLE_PRIOR_AUTH=1 uv run pipeline.py "${args[@]}"
47+
IDR_ENABLE_DATE_PARTITIONS=0 IDR_ENABLE_PRIOR_AUTH=1 uv run idr-pipeline "${args[@]}"

apps/bfd-pipeline-idr/pyproject.toml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
[project]
2-
name = "bfd-pipeline-idr"
2+
name = "idr-pipeline"
33
version = "0.1.0"
4-
description = "Add your description here"
5-
readme = "README.md"
4+
description = "ETL Pipeline to load data from the IDR into BFD's database"
65
requires-python = ">=3.14.3"
76
dependencies = [
87
"cryptography>=46.0.5",
@@ -16,7 +15,6 @@ dependencies = [
1615
"click>=8.3.3",
1716
"anyio",
1817
"loguru",
19-
"pydantic-partial" # TODO: remove when idr_bfd_compare is moved
2018
]
2119

2220
[dependency-groups]
@@ -28,9 +26,19 @@ dev = [
2826
"pyright>=1.1.407",
2927
]
3028

29+
[project.scripts]
30+
idr-pipeline = "idr_pipeline:main"
31+
32+
[build-system]
33+
requires = ["uv_build<=0.12"]
34+
build-backend = "uv_build"
35+
3136
[tool.uv]
3237
exclude-newer = "7 days"
3338

39+
[tool.uv.build-backend]
40+
module-name = "idr_pipeline"
41+
3442
[tool.uv.sources]
3543
loguru = { git = "https://github.com/Delgan/loguru", rev = "2a17be730e111cf874d0bf967c4c5da15b7e4670" }
3644

0 commit comments

Comments
 (0)