Skip to content

Commit

Permalink
CI: update Docker image build logic
Browse files Browse the repository at this point in the history
- Change development image tags to "development" so that branch name and tag name are the same
  (and we don't need any logic to translate between branch names and tag names)
- Also build images for release-1.9 branch
- Also re-build images if their build workflow changes
  • Loading branch information
stsnel committed Feb 29, 2024
1 parent 2782c67 commit 45ee015
Show file tree
Hide file tree
Showing 29 changed files with 162 additions and 49 deletions.
13 changes: 11 additions & 2 deletions .github/workflows/build-push-image-davrods.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ on:
push:
branches:
- 'development'
- 'release-1.9'
paths:
- '.github/workflows/build-push-image-davrods.yml'
- 'docker/images/davrods/**'

jobs:
Expand All @@ -16,12 +18,17 @@ jobs:
contents: read
packages: write
steps:
- name: Extract branch name
shell: bash
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
id: extract_branch

- name: Check out Yoda repository
uses: actions/checkout@v3
with:
path: yoda
repository: UtrechtUniversity/yoda
ref: development
ref: ${{ steps.extract_branch.outputs.branch }}

- name: Authenticate to the container registry
uses: docker/login-action@v2
Expand All @@ -36,4 +43,6 @@ jobs:
context: yoda/docker/images/davrods
file: yoda/docker/images/davrods/Dockerfile
push: true
tags: ghcr.io/utrechtuniversity/davrods:dev-1.9
tags: ghcr.io/utrechtuniversity/davrods:${{ steps.extract_branch.outputs.branch }}
build-args: |
TAG=${{ steps.extract_branch.outputs.branch }}
13 changes: 11 additions & 2 deletions .github/workflows/build-push-image-eus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ on:
push:
branches:
- 'development'
- 'release-1.9'
paths:
- '.github/workflows/build-push-image-eus.yml'
- 'docker/images/yoda_eus/**'

jobs:
Expand All @@ -16,12 +18,17 @@ jobs:
contents: read
packages: write
steps:
- name: Extract branch name
shell: bash
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
id: extract_branch

- name: Check out Yoda repository
uses: actions/checkout@v3
with:
path: yoda
repository: UtrechtUniversity/yoda
ref: development
ref: ${{ steps.extract_branch.outputs.branch }}

- name: Authenticate to the container registry
uses: docker/login-action@v2
Expand All @@ -36,4 +43,6 @@ jobs:
context: yoda/docker/images/yoda_eus
file: yoda/docker/images/yoda_eus/Dockerfile
push: true
tags: ghcr.io/utrechtuniversity/yoda-eus:dev-1.9
tags: ghcr.io/utrechtuniversity/yoda-eus:${{ steps.extract_branch.outputs.branch }}
build-args: |
TAG=${{ steps.extract_branch.outputs.branch }}
13 changes: 10 additions & 3 deletions .github/workflows/build-push-image-mailpit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ on:
push:
branches:
- 'development'
- 'release-1.9'
paths:
- '.github/workflows/build-push-image-mailpit.yml'
- 'docker/images/mailpit/**'

jobs:
Expand All @@ -16,12 +18,17 @@ jobs:
contents: read
packages: write
steps:
- name: Extract branch name
shell: bash
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
id: extract_branch

- name: Check out Yoda repository
uses: actions/checkout@v3
with:
path: yoda
repository: UtrechtUniversity/yoda
ref: development
ref: ${{ steps.extract_branch.outputs.branch }}

- name: Authenticate to the container registry
uses: docker/login-action@v2
Expand All @@ -36,5 +43,5 @@ jobs:
- name: Build and push Docker image
run: |
cd yoda/docker/images/mailpit
./build.sh
docker push ghcr.io/utrechtuniversity/yoda-mailpit:dev-1.9
./build.sh "${{ steps.extract_branch.outputs.branch }}"
docker push ghcr.io/utrechtuniversity/yoda-mailpit:${{ steps.extract_branch.outputs.branch }}
13 changes: 11 additions & 2 deletions .github/workflows/build-push-image-portal.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ on:
push:
branches:
- 'development'
- 'release-1.9'
paths:
- '.github/workflows/build-push-image-portal.yml'
- 'docker/images/yoda_portal/**'

jobs:
Expand All @@ -16,12 +18,17 @@ jobs:
contents: read
packages: write
steps:
- name: Extract branch name
shell: bash
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
id: extract_branch

- name: Check out Yoda repository
uses: actions/checkout@v3
with:
path: yoda
repository: UtrechtUniversity/yoda
ref: development
ref: ${{ steps.extract_branch.outputs.branch }}

- name: Authenticate to the container registry
uses: docker/login-action@v2
Expand All @@ -36,4 +43,6 @@ jobs:
context: yoda/docker/images/yoda_portal
file: yoda/docker/images/yoda_portal/Dockerfile
push: true
tags: ghcr.io/utrechtuniversity/yoda-portal:dev-1.9
tags: ghcr.io/utrechtuniversity/yoda-portal:${{ steps.extract_branch.outputs.branch }}
build-args: |
TAG=${{ steps.extract_branch.outputs.branch }}
14 changes: 12 additions & 2 deletions .github/workflows/build-push-image-provider.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ on:
push:
branches:
- 'development'
- 'release-1.9'
paths:
- '.github/workflows/build-push-image-provider.yml'
- 'docker/images/yoda_irods_icat/**'
- 'roles/irods_completion/files/irods_completion.sh'
- 'roles/pam_python/files/pam_python.so'
Expand All @@ -19,12 +21,17 @@ jobs:
contents: read
packages: write
steps:
- name: Extract branch name
shell: bash
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
id: extract_branch

- name: Check out Yoda repository
uses: actions/checkout@v3
with:
path: yoda
repository: UtrechtUniversity/yoda
ref: development
ref: ${{ steps.extract_branch.outputs.branch }}

- name: Authenticate to the container registry
uses: docker/login-action@v2
Expand All @@ -44,4 +51,7 @@ jobs:
context: yoda/docker/images/yoda_irods_icat
file: yoda/docker/images/yoda_irods_icat/Dockerfile
push: true
tags: ghcr.io/utrechtuniversity/yoda-provider:dev-1.9
tags: ghcr.io/utrechtuniversity/yoda-provider:${{ steps.extract_branch.outputs.branch }}
build-args: |
TAG=${{ steps.extract_branch.outputs.branch }}
14 changes: 12 additions & 2 deletions .github/workflows/build-push-image-public.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ on:
push:
branches:
- 'development'
- 'release-1.9'
paths:
- '.github/workflows/build-push-image-public.yml'
- 'docker/images/yoda_public/**'
- 'roles/yoda_landingpages/files/**'

Expand All @@ -17,12 +19,17 @@ jobs:
contents: read
packages: write
steps:
- name: Extract branch name
shell: bash
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
id: extract_branch

- name: Check out Yoda repository
uses: actions/checkout@v3
with:
path: yoda
repository: UtrechtUniversity/yoda
ref: development
ref: ${{ steps.extract_branch.outputs.branch }}

- name: Authenticate to the container registry
uses: docker/login-action@v2
Expand All @@ -42,4 +49,7 @@ jobs:
context: yoda/docker/images/yoda_public
file: yoda/docker/images/yoda_public/Dockerfile
push: true
tags: ghcr.io/utrechtuniversity/yoda-public:dev-1.9
tags: ghcr.io/utrechtuniversity/yoda-public:${{ steps.extract_branch.outputs.branch }}
build-args: |
TAG=${{ steps.extract_branch.outputs.branch }}
14 changes: 12 additions & 2 deletions .github/workflows/build-push-image-web-mock.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ on:
push:
branches:
- 'development'
- 'release-1.9'
paths:
- '.github/workflows/build-push-image-web-mock.yml'
- 'docker/images/yoda_web_mock/**'

jobs:
Expand All @@ -16,12 +18,17 @@ jobs:
contents: read
packages: write
steps:
- name: Extract branch name
shell: bash
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
id: extract_branch

- name: Check out Yoda repository
uses: actions/checkout@v3
with:
path: yoda
repository: UtrechtUniversity/yoda
ref: development
ref: ${{ steps.extract_branch.outputs.branch }}

- name: Authenticate to the container registry
uses: docker/login-action@v2
Expand All @@ -36,4 +43,7 @@ jobs:
context: yoda/docker/images/yoda_web_mock
file: yoda/docker/images/yoda_web_mock/Dockerfile
push: true
tags: ghcr.io/utrechtuniversity/yoda-web-mock:dev-1.9
tags: ghcr.io/utrechtuniversity/yoda-web-mock:${{ steps.extract_branch.outputs.branch }}
build-args: |
TAG=${{ steps.extract_branch.outputs.branch }}
14 changes: 7 additions & 7 deletions docker/compose-with-bind-mounts/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ services:
container_name: provider.yoda
platform: linux/amd64
hostname: provider.yoda
image: ghcr.io/utrechtuniversity/yoda-provider:dev-1.9
image: ghcr.io/utrechtuniversity/yoda-provider:development
ports:
- "8247:1247"
- "20000-20199:20000-20199"
Expand Down Expand Up @@ -62,7 +62,7 @@ services:
container_name: portal.yoda
platform: linux/amd64
hostname: portal.yoda
image: ghcr.io/utrechtuniversity/yoda-portal:dev-1.9
image: ghcr.io/utrechtuniversity/yoda-portal:development
depends_on:
- provider
- eus
Expand All @@ -80,7 +80,7 @@ services:
container_name: eus.yoda
platform: linux/amd64
hostname: eus.yoda
image: ghcr.io/utrechtuniversity/yoda-eus:dev-1.9
image: ghcr.io/utrechtuniversity/yoda-eus:development
depends_on:
- extuserdb
- mailpit
Expand All @@ -101,7 +101,7 @@ services:
container_name: public.yoda
platform: linux/amd64
hostname: public.yoda
image: ghcr.io/utrechtuniversity/yoda-public:dev-1.9
image: ghcr.io/utrechtuniversity/yoda-public:development
ports:
- "8446:443"
build:
Expand All @@ -118,7 +118,7 @@ services:
container_name: data.yoda
platform: linux/amd64
hostname: data.yoda
image: ghcr.io/utrechtuniversity/davrods:dev-1.9
image: ghcr.io/utrechtuniversity/davrods:development
depends_on:
- provider
ports:
Expand All @@ -131,7 +131,7 @@ services:
container_name: mailpit.yoda
platform: linux/amd64
hostname: mailpit.yoda
image: ghcr.io/utrechtuniversity/yoda-mailpit:dev-1.9
image: ghcr.io/utrechtuniversity/yoda-mailpit:development
environment:
- TZ=Europe/Amsterdam
build:
Expand All @@ -144,7 +144,7 @@ services:
container_name: datacite-mock.yoda
platform: linux/amd64
hostname: datacite-mock.yoda
image: ghcr.io/utrechtuniversity/yoda-web-mock:dev-1.9
image: ghcr.io/utrechtuniversity/yoda-web-mock:development
environment:
- MOCKNAME=datacite
- MOCKFQDN=datacite-mock.yoda
Expand Down
14 changes: 7 additions & 7 deletions docker/compose/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ services:
container_name: provider.yoda
platform: linux/amd64
hostname: provider.yoda
image: ghcr.io/utrechtuniversity/yoda-provider:dev-1.9
image: ghcr.io/utrechtuniversity/yoda-provider:development
ports:
- "8247:1247"
- "20000-20199:20000-20199"
Expand Down Expand Up @@ -56,7 +56,7 @@ services:
container_name: portal.yoda
platform: linux/amd64
hostname: portal.yoda
image: ghcr.io/utrechtuniversity/yoda-portal:dev-1.9
image: ghcr.io/utrechtuniversity/yoda-portal:development
depends_on:
- provider
- eus
Expand All @@ -70,7 +70,7 @@ services:
container_name: eus.yoda
platform: linux/amd64
hostname: eus.yoda
image: ghcr.io/utrechtuniversity/yoda-eus:dev-1.9
image: ghcr.io/utrechtuniversity/yoda-eus:development
depends_on:
- extuserdb
- mailpit
Expand All @@ -84,7 +84,7 @@ services:
container_name: public.yoda
platform: linux/amd64
hostname: public.yoda
image: ghcr.io/utrechtuniversity/yoda-public:dev-1.9
image: ghcr.io/utrechtuniversity/yoda-public:development
ports:
- "8446:443"
build:
Expand All @@ -98,7 +98,7 @@ services:
container_name: data.yoda
platform: linux/amd64
hostname: data.yoda
image: ghcr.io/utrechtuniversity/davrods:dev-1.9
image: ghcr.io/utrechtuniversity/davrods:development
depends_on:
- provider
ports:
Expand All @@ -111,7 +111,7 @@ services:
container_name: mailpit.yoda
platform: linux/amd64
hostname: mailpit.yoda
image: ghcr.io/utrechtuniversity/yoda-mailpit:dev-1.9
image: ghcr.io/utrechtuniversity/yoda-mailpit:development
environment:
- TZ=Europe/Amsterdam
build:
Expand All @@ -124,7 +124,7 @@ services:
container_name: datacite-mock.yoda
platform: linux/amd64
hostname: datacite-mock.yoda
image: ghcr.io/utrechtuniversity/yoda-web-mock:dev-1.9
image: ghcr.io/utrechtuniversity/yoda-web-mock:development
environment:
- MOCKNAME=datacite
- MOCKFQDN=datacite-mock.yoda
Expand Down
Loading

0 comments on commit 45ee015

Please sign in to comment.