Skip to content

Commit e2021c0

Browse files
committed
Replace dispatch with builds based on repo subdirs (SOFTWARE-4300)
1 parent 4d4a5a5 commit e2021c0

File tree

1 file changed

+44
-21
lines changed

1 file changed

+44
-21
lines changed

.github/workflows/build-container.yml

Lines changed: 44 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: dispatched build-docker-image
1+
name: Build container images
22

33
on:
44
push:
@@ -19,9 +19,8 @@ jobs:
1919
id: mkdatetag
2020
run: echo "::set-output name=dtag::$(date +%Y%m%d-%H%M)"
2121

22-
build:
22+
base-image-build:
2323
runs-on: ubuntu-latest
24-
needs: [make-date-tag]
2524
if: startsWith(github.repository, 'opensciencegrid/')
2625
strategy:
2726
fail-fast: False
@@ -41,41 +40,65 @@ jobs:
4140
- id: generate-tag-list
4241
env:
4342
REPO: ${{ matrix.repo }}
44-
TIMESTAMP: ${{ needs.make-date-tag.outputs.dtag }}
4543
run: |
4644
docker_repo=${GITHUB_REPOSITORY/opensciencegrid\/docker-/opensciencegrid/}
47-
tag_list=$docker_repo:$REPO,$docker_repo:$REPO-$TIMESTAMP
48-
echo "::set-output name=taglist::$tag_list"
45+
echo "::set-output name=taglist::$docker_repo:$REPO"
4946
5047
- name: Set up Docker Buildx
5148
uses: docker/setup-buildx-action@v1
5249

53-
- name: Log in to Docker Hub
54-
uses: docker/login-action@v1
55-
with:
56-
username: ${{ secrets.DOCKER_USERNAME }}
57-
password: ${{ secrets.DOCKER_PASSWORD }}
58-
5950
- name: Build and push Docker images
6051
uses: docker/[email protected]
6152
with:
6253
build-args: BASE_YUM_REPO=${{ matrix.repo }}
6354
tags: "${{ steps.generate-tag-list.outputs.taglist }}"
55+
context: base
6456
cache-to: type=local,dest=/tmp/.buildx-cache
6557

66-
dispatch:
58+
child-image-builds:
6759
runs-on: ubuntu-latest
60+
needs: [make-date-tag, base-image-build]
6861
if: startsWith(github.repository, 'opensciencegrid/')
69-
needs: build
7062
strategy:
63+
fail-fast: False
7164
matrix:
72-
dispatch-repo:
73-
- docker-osg-ce-condor
65+
repo: ['development', 'testing', 'release']
66+
image: ['hosted-ce', 'osg-ce-condor']
7467
steps:
7568

76-
- name: dispatch build ${{ matrix.dispatch-repo }}
77-
uses: peter-evans/repository-dispatch@v1
69+
- name: checkout compute-entrypoint
70+
uses: actions/checkout@v2
71+
72+
- name: Load cached base image
73+
uses: actions/cache@v2
74+
with:
75+
path: /tmp/.buildx-cache
76+
key: base-${{ matrix.repo }}-buildx-${{ github.sha }}
77+
78+
- id: generate-tag-list
79+
env:
80+
REPO: ${{ matrix.repo }}
81+
IMAGE: ${{ matrix.image }}
82+
TIMESTAMP: ${{ needs.make-date-tag.outputs.dtag }}
83+
run: |
84+
docker_repo=opensciencegrid/$IMAGE
85+
tag_list=$docker_repo:$REPO,$docker_repo:$REPO-$TIMESTAMP
86+
echo "::set-output name=taglist::$tag_list"
87+
88+
- name: Set up Docker Buildx
89+
uses: docker/setup-buildx-action@v1
90+
91+
- name: Log in to Docker Hub
92+
uses: docker/login-action@v1
93+
with:
94+
username: ${{ secrets.DOCKER_USERNAME }}
95+
password: ${{ secrets.DOCKER_PASSWORD }}
96+
97+
- name: Build and push Docker images
98+
uses: docker/[email protected]
7899
with:
79-
token: ${{ secrets.REPO_ACCESS_TOKEN }}
80-
repository: opensciencegrid/${{ matrix.dispatch-repo }}
81-
event-type: dispatch-build
100+
push: True
101+
build-args: BASE_YUM_REPO=${{ matrix.repo }}
102+
tags: "${{ steps.generate-tag-list.outputs.taglist }}"
103+
context: ${{ matrix.image }}
104+
cache-from: type=local,dest=/tmp/.buildx-cache

0 commit comments

Comments
 (0)