diff --git a/.github/workflows/build-manually.yaml b/.github/workflows/build-manually.yaml new file mode 100644 index 0000000..77609b9 --- /dev/null +++ b/.github/workflows/build-manually.yaml @@ -0,0 +1,56 @@ +name: Build Embargo Butler ingest container on demand +on: + workflow_dispatch: + inputs: + rubinenvVersion: + description: 'rubin-env version' + required: true + default: '7.0.1' + obsLsstVersion: + description: 'Science Pipelines release' + required: true + default: 'w_2023_41' + + +env: + INGEST_NAME: embargo-butler-ingest + +jobs: + build: + runs-on: ubuntu-latest + permissions: + packages: write + contents: read + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Build ingest image + run: | + docker build . \ + -f Dockerfile.ingest \ + --tag $INGEST_NAME \ + --label "runnumber=${GITHUB_RUN_ID}" \ + --build-arg "RUBINENV_VERSION=${{ inputs.rubinenvVersion }}" \ + --build-arg "OBS_LSST_VERSION=${{ inputs.obsLsstVersion }}" + + - name: Log in to GitHub Container Registry + run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin + + - name: Push image + run: | + INGEST_ID=ghcr.io/${{ github.repository_owner }}/$INGEST_NAME + + if [[ "${{ github.ref }}" == "refs/pull/"* ]]; then + VERSION=$(echo "${{ github.head_ref }}" | sed -e 's|.*/||') + elif [[ "${{ github.ref }}" == "refs/tags/"* ]]; then + VERSION=$(echo "${{ github.ref_name }}" | sed -e 's|^v||') + else + VERSION=latest + fi + INGEST_VERSION="${VERSION}-${{ inputs.obsLsstVersion }}" + echo INGEST_ID=$INGEST_ID + echo VERSION=$VERSION + echo INGEST_VERSION=$INGEST_VERSION + docker tag $INGEST_NAME $INGEST_ID:$INGEST_VERSION + docker push $INGEST_ID:$INGEST_VERSION diff --git a/Dockerfile.ingest b/Dockerfile.ingest index 556d225..859f912 100644 --- a/Dockerfile.ingest +++ b/Dockerfile.ingest @@ -21,10 +21,13 @@ # Dockerfile for ingest service. -FROM lsstsqre/newinstall:7.0.1 +ARG RUBINENV_VERSION=7.0.1 +FROM lsstsqre/newinstall:${RUBINENV_VERSION} +ARG OBS_LSST_VERSION +ENV OBS_LSST_VERSION=${OBS_LSST_VERSION:-w_2023_41} USER lsst RUN source loadLSST.bash && mamba install redis-py rucio-clients -RUN source loadLSST.bash && eups distrib install -t "w_2023_39" obs_lsst +RUN source loadLSST.bash && eups distrib install -t "${OBS_LSST_VERSION}" obs_lsst COPY src/ingest.py src/exposure_info.py src/utils.py src/rucio_interface.py ./ingest/ # Environment variables that must be set: # REDIS_HOST REDIS_PASSWORD BUCKET BUTLER_REPO