Skip to content

Commit

Permalink
Standardize envvars in GitHub workflows.
Browse files Browse the repository at this point in the history
Environment variables are now workflow-level wherever possible, to make
them easier to find and edit. In addition, the variables have been
standardized across the three build workflows.
  • Loading branch information
kfindeisen committed Aug 16, 2024
1 parent 179cf1f commit 9f8b693
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 11 deletions.
13 changes: 7 additions & 6 deletions .github/workflows/build-base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,17 @@ on:
permissions:
packages: write

env:
IMAGE_NAME: prompt-base
# All inputs are null for PR/push builds
PIPE_CONTAINER: ${{ inputs.pipeContainer || 'lsstsqre/centos' }}
STACK_TAG: ${{ inputs.stackTag || 'd_latest' }}
MAKE_LATEST: ${{ inputs.makeLatest && 'true' || 'false' }}

jobs:
update-base-image:
name: Update base image
runs-on: ubuntu-latest
env:
IMAGE_NAME: prompt-base
# All inputs are null for PR/push builds
PIPE_CONTAINER: ${{ inputs.pipeContainer || 'lsstsqre/centos' }}
STACK_TAG: ${{ inputs.stackTag || 'd_latest' }}
steps:
- name: Checkout code
uses: actions/checkout@v4
Expand Down Expand Up @@ -88,7 +90,6 @@ jobs:
- name: Push image to registries
working-directory: base
run: |
MAKE_LATEST="${{ inputs.makeLatest && 'true' || 'false' }}"
BRANCH=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
[ "$BRANCH" == "merge" ] && BRANCH=$(echo "${{ github.head_ref }}" | sed -e 's,.*/\(.*\),\1,')
Expand Down
10 changes: 7 additions & 3 deletions .github/workflows/build-service.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ permissions:
packages: write

env:
IMAGE_NAME: prompt-service
BASE_IMAGE: ghcr.io/${{ github.repository_owner }}/prompt-base

# This is a bracketed, comma-separated list of double-quoted base container
# tags that will be used to build service containers on each branch
# (including "main"). Typically, any tags listed beyond "latest" would be
Expand Down Expand Up @@ -50,6 +53,8 @@ jobs:
baseTag: ${{ fromJSON(needs.matrix-gen.outputs.matrix) }}
name: Test service
runs-on: ubuntu-latest
env:
BASE_TAG: ${{ matrix.baseTag }}
steps:
- name: Checkout code
uses: actions/checkout@v4
Expand All @@ -65,7 +70,7 @@ jobs:
run: |
docker run \
-v $GITHUB_WORKSPACE:/home/lsst/prompt_processing \
ghcr.io/${{ github.repository_owner }}/prompt-base:${{ matrix.baseTag }} \
"$BASE_IMAGE":"$BASE_TAG" \
bash -c '
cd /home/lsst/prompt_processing
source /opt/lsst/software/stack/loadLSST.bash
Expand All @@ -84,7 +89,6 @@ jobs:
matrix:
baseTag: ${{ fromJSON(needs.matrix-gen.outputs.matrix) }}
env:
IMAGE_NAME: prompt-service
BASE_TAG: ${{ matrix.baseTag }}
steps:
- name: Checkout code
Expand All @@ -97,7 +101,7 @@ jobs:
password: ${{ secrets.GITHUB_TOKEN }}
- name: Determine eups tag
run: |
docker run ghcr.io/${{ github.repository_owner }}/prompt-base:"$BASE_TAG" bash -c "cat conda/envs/lsst-scipipe-*/share/eups/ups_db/global.tags" > eups.tag || docker run ghcr.io/${{ github.repository_owner }}/prompt-base:"$BASE_TAG" bash -c "cat stack/miniconda*/ups_db/global.tags" > eups.tag || echo "Unknown" > eups.tag
docker run "$BASE_IMAGE":"$BASE_TAG" bash -c "cat conda/envs/lsst-scipipe-*/share/eups/ups_db/global.tags" > eups.tag || docker run "$BASE_IMAGE":"$BASE_TAG" bash -c "cat stack/miniconda*/ups_db/global.tags" > eups.tag || echo "Unknown" > eups.tag
echo "Eups tag = $(< eups.tag)"
- name: Build image
run: |
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/ci-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ name: Release CI

env:
IMAGE_NAME: lsst-dm/prompt-service
# Base tag to run tests against.
# Base image and tag to run tests against. NOT used in the container build.
BASE_TAG: "latest"
BASE_IMAGE: ghcr.io/${{ github.repository_owner }}/prompt-base

jobs:
# Do testing and building in separate jobs to keep total disk usage down
Expand Down Expand Up @@ -51,7 +52,7 @@ jobs:
run: |
docker run \
-v $GITHUB_WORKSPACE:/home/lsst/prompt_processing \
ghcr.io/${{ github.repository_owner }}/prompt-base:$BASE_TAG \
"$BASE_IMAGE":"$BASE_TAG" \
bash -c '
cd /home/lsst/prompt_processing
source /opt/lsst/software/stack/loadLSST.bash
Expand Down

0 comments on commit 9f8b693

Please sign in to comment.