From 5374820b5c61329e2328e4452fa571036e3f5baf Mon Sep 17 00:00:00 2001 From: Matt Westphall Date: Thu, 17 Oct 2024 12:24:50 -0500 Subject: [PATCH] SOFTWARE-6017: Add support for OSG-24, upload to osg-htc repo --- .github/actions/push-digest-local/action.yaml | 10 +++--- .github/workflows/build-container.yml | 31 ++++++++++++------- 2 files changed, 25 insertions(+), 16 deletions(-) diff --git a/.github/actions/push-digest-local/action.yaml b/.github/actions/push-digest-local/action.yaml index 081762b..85a35ab 100644 --- a/.github/actions/push-digest-local/action.yaml +++ b/.github/actions/push-digest-local/action.yaml @@ -51,10 +51,10 @@ runs: echo "platform=${platform//\//-}" >> ${GITHUB_OUTPUT} - name: Registry login - # if: >- - # github.ref == 'refs/heads/master' && - # github.event_name != 'pull_request' && - # github.repository_owner == 'opensciencegrid' + if: >- + github.ref == 'refs/heads/master' && + github.event_name != 'pull_request' && + contains(fromJson('["opensciencegrid","osg-htc"]'), github.repository_owner) uses: docker/login-action@v2 with: registry: ${{ inputs.registry }} @@ -79,7 +79,7 @@ runs: run: | mkdir -p /tmp/${{ inputs.registry }}/digests digest="${{ steps.upload-image.outputs.digest }}" - touch "/tmp/${{ inputs.registry }}/digests/${digest#sha256:}" + touch "/tmp/${{ inputs.registry }}/digests/${digest#sha256:}" - name: Upload digest uses: actions/upload-artifact@v4 diff --git a/.github/workflows/build-container.yml b/.github/workflows/build-container.yml index 2cc8b4f..e11ee31 100644 --- a/.github/workflows/build-container.yml +++ b/.github/workflows/build-container.yml @@ -18,8 +18,13 @@ jobs: fail-fast: false matrix: os: ['el9', 'cuda_11_8_0'] - osg_series: ['23'] + # osg_series: ['23'] repo: ['development', 'testing', 'release'] + osg_series: + - series: '24' + image: 'osg-htc/ospool-ep' + - series: '23' + image: 'opensciencegrid/osgvo-docker-pilot' platform: ['linux/amd64','linux/arm64'] exclude: # cuda builds take a super long time; only do one of them @@ -32,11 +37,12 @@ jobs: - id: custom-image-name env: - SERIES: ${{ matrix.osg_series }} + SERIES: ${{ matrix.osg_series.series }} + IMAGE: ${{ matrix.osg_series.image }} REPO: ${{ matrix.repo }} OS: ${{ matrix.os }} run: | - PREFIX="output_image=${GITHUB_REPOSITORY}:${SERIES}" + PREFIX="output_image=${IMAGE}:${SERIES}" TIMESTAMP=$(date +%Y%m%d-%H%M) echo "${PREFIX}-${OS}-${REPO}" >> ${GITHUB_OUTPUT} echo "base_tag=${SERIES}-${OS}-${REPO}" >> ${GITHUB_OUTPUT} @@ -47,7 +53,7 @@ jobs: uses: opensciencegrid/build-container-action@HEAD with: registry_url: hub.opensciencegrid.org - osg_series: ${{ matrix.osg_series }} + osg_series: ${{ matrix.osg_series.series }} osg_repo: ${{ matrix.repo }} base_os: ${{ matrix.os }} platform: ${{ matrix.platform }} @@ -101,14 +107,14 @@ jobs: if: >- github.ref == 'refs/heads/master' && github.event_name != 'pull_request' && - github.repository_owner == 'opensciencegrid' + contains(fromJson('["opensciencegrid","osg-htc"]'), github.repository_owner) name: Upload By Digest to Harbor uses: ./.github/actions/push-digest-local with: registry: hub.opensciencegrid.org username: ${{ secrets.OSG_HARBOR_ROBOT_USER }} password: ${{ secrets.OSG_HARBOR_ROBOT_PASSWORD }} - osg_series: ${{ matrix.osg_series }} + osg_series: ${{ matrix.osg_series.series }} osg_repo: ${{ matrix.repo }} base_os: ${{ matrix.os }} platform: ${{ matrix.platform }} @@ -121,10 +127,13 @@ jobs: # some arch fails. Handling this scenario is future work: # https://opensciencegrid.atlassian.net/browse/SOFTWARE-6010 - id: upload-by-digest-dockerhub + # TODO support the osg-htc organization on dockerhub if: >- github.ref == 'refs/heads/master' && github.event_name != 'pull_request' && - github.repository_owner == 'opensciencegrid' + contains(fromJson('["opensciencegrid","osg-htc"]'), github.repository_owner) && + startsWith(matrix.osg_series.image, 'opensciencegrid') + name: Upload By Digest to Docker Hub uses: ./.github/actions/push-digest-local with: @@ -144,15 +153,15 @@ jobs: if: >- github.ref == 'refs/heads/master' && github.event_name != 'pull_request' && - github.repository_owner == 'opensciencegrid' + contains(fromJson('["opensciencegrid","osg-htc"]'), github.repository_owner) needs: - build-images strategy: fail-fast: false matrix: os: ['el9', 'cuda_11_8_0'] - osg_series: ['23'] repo: ['development', 'testing', 'release'] + osg_series: ['23', '24'] registry: [ { url: hub.opensciencegrid.org, @@ -222,10 +231,10 @@ jobs: env: DEFAULT_OS: el9 run: | - BASE_IMG=${{ matrix.registry.url }}/opensciencegrid/osgvo-docker-pilot - DIGESTS=$(for digest in $(ls digests/); do echo $BASE_IMG@sha256:$digest; done) TAGS=$(cat tags/*-amd64) for tag in ${TAGS//,/ }; do + BASE_IMG=${tag/:*/} + DIGESTS=$(for digest in $(ls digests/); do echo $BASE_IMG@sha256:$digest; done) docker buildx imagetools create --tag $tag $DIGESTS; # Also tag the image for the default OS as the OS-less tag