Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ACR, Workflow UX, gh act, azure batch automation #43

Merged
merged 66 commits into from
Sep 27, 2024
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
5892d23
Changes for CFA Azure ACR
jkislin Sep 18, 2024
96c64c9
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 18, 2024
db86b6c
added to news.md
jkislin Sep 18, 2024
444b423
testing image on jk branch
jkislin Sep 20, 2024
5cfe5d3
update workflow name; resubmit job
jkislin Sep 20, 2024
4023f65
change runs-on to new cdcgov runner
jkislin Sep 20, 2024
4284511
removed unworking cache check
jkislin Sep 20, 2024
5c4ec10
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 20, 2024
9777717
azure batch scaffolding (maybe not necessary here)
jkislin Sep 21, 2024
5e351a9
Merge branch 'jk-azure-readiness' of https://github.com/CDCgov/cfa-ep…
jkislin Sep 21, 2024
b2e279f
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 21, 2024
e955773
another attempt at cacheing and simplification; splitting the buiild/…
jkislin Sep 25, 2024
f4de2a6
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 25, 2024
604069f
better github actions ux via build names
jkislin Sep 25, 2024
8403153
organized workflows for contributor/tester ux
jkislin Sep 25, 2024
5916318
removed cacheing and made names easier to read
jkislin Sep 25, 2024
e5071a7
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 25, 2024
bfc8eed
comprehensive workflow renaming for ux/trackability
jkislin Sep 25, 2024
8a43469
Merge branch 'jk-azure-readiness' of https://github.com/CDCgov/cfa-ep…
jkislin Sep 25, 2024
21118f0
Merge branch 'main' of https://github.com/CDCgov/cfa-epinow2-pipeline…
jkislin Sep 25, 2024
4f9dbad
Explicit date casting in queries
zsusswein Sep 25, 2024
6745c57
Bump NEWS
zsusswein Sep 25, 2024
434b2e9
Merge branch 'zs-duckdb-update-bugfix' of https://github.com/CDCgov/c…
jkislin Sep 25, 2024
915fa76
pipeline with batch code - not yet working
jkislin Sep 25, 2024
285c8ae
Merge branch 'main' into jk-azure-readiness
jkislin Sep 25, 2024
1961bc2
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 25, 2024
cd9b198
commenting out the job01 dependencies build to claw us back some test…
jkislin Sep 25, 2024
1161903
Merge branch 'jk-azure-readiness' of https://github.com/CDCgov/cfa-ep…
jkislin Sep 25, 2024
718d372
nektos gh-act tests and pool creation code
jkislin Sep 26, 2024
929fdff
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 26, 2024
9ad0060
fix some env variables for auto scale formula
jkislin Sep 26, 2024
52748bd
Merge branch 'jk-azure-readiness' of https://github.com/CDCgov/cfa-ep…
jkislin Sep 26, 2024
73efd5a
more cowbell
jkislin Sep 26, 2024
4aa8bdc
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 26, 2024
d672938
fix needs issue
jkislin Sep 26, 2024
b4c21c1
Merge branch 'jk-azure-readiness' of https://github.com/CDCgov/cfa-ep…
jkislin Sep 26, 2024
ee0e5e9
we need quotes around var names"
jkislin Sep 26, 2024
21c70ca
autoscale formula as cat'd variable
jkislin Sep 26, 2024
f71a157
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 26, 2024
a0c3399
newline syntax fix for bash batch cli code
jkislin Sep 26, 2024
ba43234
Merge branch 'jk-azure-readiness' of https://github.com/CDCgov/cfa-ep…
jkislin Sep 26, 2024
62fb416
fixed endpoint uri
jkislin Sep 26, 2024
73360c7
autoscale enablement?;
jkislin Sep 26, 2024
914395b
autoscale as a separate step
jkislin Sep 26, 2024
2b30029
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 26, 2024
9211058
pool id var needs fixing in the last step
jkislin Sep 26, 2024
3194708
Merge branch 'jk-azure-readiness' of https://github.com/CDCgov/cfa-ep…
jkislin Sep 26, 2024
25d42c5
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 26, 2024
aaf2a1a
environment variables
jkislin Sep 26, 2024
623ea45
Merge branch 'jk-azure-readiness' of https://github.com/CDCgov/cfa-ep…
jkislin Sep 26, 2024
aa7438f
quotes?
jkislin Sep 26, 2024
8c1bb0f
comments
jkislin Sep 26, 2024
dde360e
run name in quotes
jkislin Sep 26, 2024
2819567
Update .github/workflows/1-Build-Dependency-Image.yaml
jkislin Sep 27, 2024
a64e632
Update .gitignore
jkislin Sep 27, 2024
ea45737
added cron trigger and removed jk-azure-readiness push trigger
jkislin Sep 27, 2024
f82110a
documentation edits; file renames; revived "cacheing" for testing
jkislin Sep 27, 2024
ed939ad
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 27, 2024
22cc946
ubuntu image update?
jkislin Sep 27, 2024
dd1b777
Merge branch 'jk-azure-readiness' of https://github.com/CDCgov/cfa-ep…
jkislin Sep 27, 2024
f25af3e
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 27, 2024
da7040c
node agent sku also...
jkislin Sep 27, 2024
203d661
Merge branch 'jk-azure-readiness' of https://github.com/CDCgov/cfa-ep…
jkislin Sep 27, 2024
3cd0126
attempting ubuntu 22 as 24 not yet supported
jkislin Sep 27, 2024
8355965
simplified commit message display in workflow gui
jkislin Sep 27, 2024
b5ebbf7
reverted to ubuntu 20. will have to investigate
jkislin Sep 27, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
154 changes: 154 additions & 0 deletions .github/workflows/build-and-push-docker.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
# This GitHub Actions workflow builds a Docker image for the
# cfa-epinow2-pipeline-docker project. It consists of two jobs:
# build_image_dependencies and build_image.
#
# - The `build_image_dependencies` job carries out the first part of a
# multi-stage build. It downloads and install all the dependencies
# listed in the `DESCRIPTION` file. It uses the `Dockerfile-dependencies`
# file to build the image.
#
# The built image is then pushed to the corresponding registry.
#
# The process is cached to avoid rebuilding the image if the dependencies
# have not changed. This is by hashing the `DESCRIPTION` file and the
# `Dockerfile-dependencies` file.
#
# - The build_image job builds the final image using the `Dockerfile` file.
# It uses the image built in the previous job as a base image.
#
# During the build process, the package is installed and built. Furthermore
# the package is checked using `R CMD check` to ensure that it is working
# correctly.
#
# Once the image is built, it is pushed to the corresponding registry.

name: Build and Push Docker image

on:
push:
branches:
- main
- jk-azure-readiness
workflow_dispatch:

env:
# Together, these form: cfaprdbatchcr.azurecr.io/cfa-epinow2-pipeline
REGISTRY: cfaprdbatchcr.azurecr.io
IMAGE_NAME: cfa-epinow2-pipeline

jobs:
build_image_dependencies:
runs-on: cfa-cdcgov
steps:
- name: Checkout code
uses: actions/checkout@v4

# - name: Check cache
# uses: actions/cache@v3
# id: cache
# with:
# key: docker-dependencies-${{ runner.os }}-${{ hashFiles('./DESCRIPTION', './Dockerfile-dependencies') }}
# path:
# ./DESCRIPTION

- name: Login to the Container Registry
uses: docker/login-action@v3
with:
registry: "cfaprdbatchcr.azurecr.io"
username: "cfaprdbatchcr"
password: ${{ secrets.CFAPRDBATCHCR_REGISTRY_PASSWORD }}

# if: steps.cache.outputs.cache-hit != 'true'
jkislin marked this conversation as resolved.
Show resolved Hide resolved

- name: Build and push
uses: docker/build-push-action@v6
with:
push: true
tags: |
${{ env.REGISTRY}}/${{ env.IMAGE_NAME }}-dependencies:latest
${{ env.REGISTRY}}/${{ env.IMAGE_NAME }}-dependencies:${{ github.sha }}
file: ./Dockerfile-dependencies

build_image:
needs: build_image_dependencies
runs-on: cfa-cdcgov
steps:

- name: Login to the Container Registry
uses: docker/login-action@v3
with:
registry: "cfaprdbatchcr.azurecr.io"
username: "cfaprdbatchcr"
password: ${{ secrets.CFAPRDBATCHCR_REGISTRY_PASSWORD }}

- name: Build and push
uses: docker/build-push-action@v6
with:
push: true
tags: |
${{ env.REGISTRY}}/${{ env.IMAGE_NAME }}:latest
${{ env.REGISTRY}}/${{ env.IMAGE_NAME }}:${{ github.sha }}
file: ./Dockerfile

create-and-launch-batch-pools:
runs-on: cfa-cdcgov
needs:
- build_image

permissions:
contents: read
packages: write

steps:
- name: Checkout Repo
id: checkout_repo
uses: actions/checkout@v4

- name: Login to Azure with NNH Service Principal
id: azure_login_2
uses: azure/login@v2
with:
# managed by EDAV. Contact Amit Mantri or Jon Kislin if you have issues.
creds: ${{ secrets.EDAV_CFA_PREDICT_NNHT_SP }}

- name: Download Configuration Tomls from cfadatalakeprd/cfapredict
jkislin marked this conversation as resolved.
Show resolved Hide resolved
id: download_config_tomls
run: |
rm -rf ./ci_config_tomls/
az storage blob download-batch \
--source https://cfadatalakeprd.blob.core.windows.net/cfapredict/ \
--pattern "./ci_config_tomls/*" \
--destination ./ \
--auth-mode "login"

- name: Delete Existing Batch Pool
id: delete_existing_batch_pool
run: |

export pool_id="cfa-epinow2-pipeline-ci"

# Check if the batch pool exists
EPINOW2_POOL_EXISTS=$(az batch pool show \
--account-name "cfaprdba" \
--account-endpoint "https://cfaprdba.eastus.batch.azure.com" \
--pool-id "$pool_id" \
--query "id" --output tsv 2>/dev/null)

if [ -z "$EPINOW2_POOL_EXISTS" ]; then
echo -e "Batch pool $pool_id does not exist."
else
echo -e "Batch pool $pool_id exists. Deleting it now..."
az batch pool delete \
--account-name cfaprdba \
--account-endpoint https://cfaprdba.eastus.batch.azure.com \
--pool-id "$pool_id" \
--yes
echo "Batch pool $pool_id has been deleted."
fi

- name: Create cfa-epinow2-pipeline Pools
id: create_nhsn_nssp_pools
run: |
echo 'hello world'


73 changes: 0 additions & 73 deletions .github/workflows/build-docker.yaml

This file was deleted.

19 changes: 17 additions & 2 deletions .secrets.baseline
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "1.4.0",
"version": "1.5.0",
"plugins_used": [
{
"name": "ArtifactoryDetector"
Expand All @@ -26,6 +26,9 @@
{
"name": "GitHubTokenDetector"
},
{
"name": "GitLabTokenDetector"
},
{
"name": "HexHighEntropyString",
"limit": 3.0
Expand All @@ -36,6 +39,9 @@
{
"name": "IbmCosHmacDetector"
},
{
"name": "IPPublicDetector"
},
{
"name": "JwtTokenDetector"
},
Expand All @@ -49,9 +55,15 @@
{
"name": "NpmDetector"
},
{
"name": "OpenAIDetector"
},
{
"name": "PrivateKeyDetector"
},
{
"name": "PypiTokenDetector"
},
{
"name": "SendGridDetector"
},
Expand All @@ -67,6 +79,9 @@
{
"name": "StripeDetector"
},
{
"name": "TelegramBotTokenDetector"
},
{
"name": "TwilioKeyDetector"
}
Expand Down Expand Up @@ -108,5 +123,5 @@
}
],
"results": {},
"generated_at": "2023-09-24T19:52:08Z"
"generated_at": "2024-09-20T17:50:20Z"
}
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
FROM gvegayon/cfa-epinow2-pipeline-dependencies:latest
# This requires access to the Azure Container Registry
FROM cfaprdbatchcr.azurecr.io/cfa-epinow2-pipeline-dependencies:latest

# Will copy the package to the container preserving the directory structure
COPY . pkg/
Expand Down
2 changes: 1 addition & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# CFAEpiNow2Pipeline (development version)

* Now uses CFA Azure ACR and images in the workflows and Dockerfiles, etc.
* Added Docker image with all the requirements to build the package.
* Bump pre-commit hooks
* Fix bug in warning message for incomplete data read (h/t @damonbayer)
Expand Down
Loading