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 e9e32ce
Show file tree
Hide file tree
Showing 27 changed files with 135 additions and 28 deletions.
11 changes: 10 additions & 1 deletion .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,6 +18,11 @@ 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:
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 }}
11 changes: 10 additions & 1 deletion .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,6 +18,11 @@ 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:
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 }}
11 changes: 9 additions & 2 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,6 +18,11 @@ 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:
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 }}
11 changes: 10 additions & 1 deletion .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,6 +18,11 @@ 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:
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 }}
12 changes: 11 additions & 1 deletion .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,6 +21,11 @@ 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:
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 }}
12 changes: 11 additions & 1 deletion .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,6 +19,11 @@ 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:
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 }}
12 changes: 11 additions & 1 deletion .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,6 +18,11 @@ 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:
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 }}
3 changes: 2 additions & 1 deletion docker/images/davrods/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ EXPOSE 80
EXPOSE 443

# Application settings
ARG TAG=development
ENV IRODS_VERSION="4.2.11"
ENV YUM_REPO_FILE_LOC "https://packages.irods.org/renci-irods.yum.repo"
ENV YUM_IRODS_REPO_SIGNING_KEY_LOC="https://packages.irods.org/irods-signing-key.asc"
Expand Down Expand Up @@ -61,4 +62,4 @@ COPY footer.html /etc/httpd/irods/footer.html
VOLUME [ "/sys/fs/cgroup" ]
COPY davrods_init.sh /var/lib/irods/scripts/davrods_init.sh
RUN chmod 0755 /var/lib/irods/scripts/davrods_init.sh
CMD ["/var/lib/irods/scripts/davrods_init.sh"]
CMD ["/var/lib/irods/scripts/davrods_init.sh", "${TAG}"]
2 changes: 1 addition & 1 deletion docker/images/davrods/build.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/sh
export DOCKER_SCAN_SUGGEST=false
docker build . -t ghcr.io/utrechtuniversity/davrods:dev-1.9 "$@"
docker build . -t "ghcr.io/utrechtuniversity/davrods:development" "$@"
7 changes: 6 additions & 1 deletion docker/images/davrods/davrods_init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@ set -e
set -o pipefail
set -u

DATA_VERSION="dev-1.9"
DATA_VERSION="$1"

if [ -z "$DATA_VERSION" ]
then echo "Error: no data version argument provided."
exit 1
fi

function before_update {
echo -e "[...] ${1}"
Expand Down
9 changes: 8 additions & 1 deletion docker/images/mailpit/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ set -x

export MAILPIT_VERSION=1.14.0
export DOCKER_SCAN_SUGGEST=false
DOCKER_TAG="$1"

if [ -z "$DOCKER_TAG" ]
then echo "Error: no docker tag argument provided."
exit 1
else shift
fi

if [ -d "mailpit" ]
then rm -rf mailpit
Expand All @@ -14,4 +21,4 @@ fi
git clone https://github.com/axllent/mailpit.git
cd mailpit
git checkout "v$MAILPIT_VERSION"
docker build . -t ghcr.io/utrechtuniversity/yoda-mailpit:dev-1.9 --build-arg VERSION="$MAILPIT_VERSION" "$@"
docker build . -t "ghcr.io/utrechtuniversity/yoda-mailpit:$DOCKER_TAG" --build-arg VERSION="$MAILPIT_VERSION" "$@"
3 changes: 2 additions & 1 deletion docker/images/yoda_eus/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ FROM centos:7
LABEL maintainer="Yoda team <[email protected]>"

# Application settings
ARG TAG=development
ENV YODA_EUS_REPO "https://github.com/UtrechtUniversity/yoda-external-user-service.git"
ENV YODA_EUS_BRANCH "development"
ENV YODA_PORTAL_REPO "https://github.com/UtrechtUniversity/yoda-portal.git"
Expand Down Expand Up @@ -70,4 +71,4 @@ RUN cp -Rdp /var/www/extuser /var/www/extuser-copy
VOLUME [ "/sys/fs/cgroup" ]
COPY yoda_eus_init.sh /var/lib/irods/scripts/yoda_eus_init.sh
RUN chmod 0755 /var/lib/irods/scripts/yoda_eus_init.sh
CMD ["/var/lib/irods/scripts/yoda_eus_init.sh"]
CMD ["/var/lib/irods/scripts/yoda_eus_init.sh", "${TAG}"]
2 changes: 1 addition & 1 deletion docker/images/yoda_eus/build.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/sh
export DOCKER_SCAN_SUGGEST=false
docker build . -t ghcr.io/utrechtuniversity/yoda-eus:dev-1.9 "$@"
docker build . -t ghcr.io/utrechtuniversity/yoda-eus:development "$@"
7 changes: 6 additions & 1 deletion docker/images/yoda_eus/yoda_eus_init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@ set -e
set -o pipefail
set -u

DATA_VERSION="dev-1.9"
DATA_VERSION="$1"

if [ -z "$DATA_VERSION" ]
then echo "Error: no data version argument provided."
exit 1
fi

function before_update {
echo -e "[...] ${1}"
Expand Down
3 changes: 2 additions & 1 deletion docker/images/yoda_irods_icat/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ FROM centos:7
LABEL maintainer="Yoda team <[email protected]>"

# Application settings
ARG TAG=development
ENV IRODS_VERSION "4.2.12"
ENV IRODS_PREP_VERSION "4.2.12.0"
ENV IRODS_INDEX_VERSION "4.2.12.0-1"
Expand Down Expand Up @@ -182,4 +183,4 @@ COPY irods-icat-init.sh /var/lib/irods/scripts/irods-icat-init.sh
RUN chmod 0755 /var/lib/irods/scripts/irods-icat-init.sh

VOLUME [ "/sys/fs/cgroup" ]
CMD ["/var/lib/irods/scripts/irods-icat-init.sh"]
CMD ["/var/lib/irods/scripts/irods-icat-init.sh", "${TAG}"]
2 changes: 1 addition & 1 deletion docker/images/yoda_irods_icat/build.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/sh
export DOCKER_SCAN_SUGGEST=false
docker build . -t ghcr.io/utrechtuniversity/yoda-provider:dev-1.9 "$@"
docker build . -t ghcr.io/utrechtuniversity/yoda-provider:development "$@"
7 changes: 6 additions & 1 deletion docker/images/yoda_irods_icat/irods-icat-init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@ set -e
set -o pipefail
set -u

DATA_VERSION="dev-1.9"
DATA_VERSION="$1"

if [ -z "$DATA_VERSION" ]
then echo "Error: no data version argument provided."
exit 1
fi

function before_update {
echo -e "[...] ${1}"
Expand Down
3 changes: 2 additions & 1 deletion docker/images/yoda_portal/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ FROM centos:7
LABEL maintainer="Yoda team <[email protected]>"

# Application settings
ARG TAG=development
ENV YODA_PORTAL_REPO "https://github.com/UtrechtUniversity/yoda-portal.git"
ENV YODA_PORTAL_BRANCH "development"

Expand Down Expand Up @@ -55,4 +56,4 @@ RUN cp -Rdp /var/www/yoda /var/www/yoda-copy
VOLUME [ "/sys/fs/cgroup" ]
COPY yoda_portal_init.sh /var/lib/irods/scripts/yoda_portal_init.sh
RUN chmod 0755 /var/lib/irods/scripts/yoda_portal_init.sh
CMD ["/var/lib/irods/scripts/yoda_portal_init.sh"]
CMD ["/var/lib/irods/scripts/yoda_portal_init.sh", "${TAG}"]
2 changes: 1 addition & 1 deletion docker/images/yoda_portal/build.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/sh
export DOCKER_SCAN_SUGGEST=false
docker build . -t ghcr.io/utrechtuniversity/yoda-portal:dev-1.9 "$@"
docker build . -t ghcr.io/utrechtuniversity/yoda-portal:development "$@"
7 changes: 6 additions & 1 deletion docker/images/yoda_portal/yoda_portal_init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@ set -e
set -o pipefail
set -u

DATA_VERSION="dev-1.9"
DATA_VERSION="$1"

if [ -z "$DATA_VERSION" ]
then echo "Error: no data version argument provided."
exit 1
fi

function before_update {
echo -e "[...] ${1}"
Expand Down
3 changes: 2 additions & 1 deletion docker/images/yoda_public/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ FROM centos:7
LABEL maintainer="Yoda team <[email protected]>"

# Application settings
ARG TAG=development
ENV MOAI_REPO "https://github.com/UtrechtUniversity/yoda-moai.git"
ENV MOAI_BRANCH "development"

Expand Down Expand Up @@ -96,4 +97,4 @@ RUN cp -Rdp /var/www/moai/yoda-moai /var/www/moai/yoda-moai-copy
VOLUME [ "/sys/fs/cgroup" ]
COPY yoda_public_init.sh /yoda_public_init.sh
RUN chmod 0755 /yoda_public_init.sh
CMD ["/yoda_public_init.sh"]
CMD ["/yoda_public_init.sh", "${TAG}"]
2 changes: 1 addition & 1 deletion docker/images/yoda_public/build.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/sh
export DOCKER_SCAN_SUGGEST=false
docker build . -t ghcr.io/utrechtuniversity/yoda-public:dev-1.9 "$@"
docker build . -t ghcr.io/utrechtuniversity/yoda-public:development "$@"
7 changes: 6 additions & 1 deletion docker/images/yoda_public/yoda_public_init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@ set -e
set -o pipefail
set -u

DATA_VERSION="dev-1.9"
DATA_VERSION="$1"

if [ -z "$DATA_VERSION" ]
then echo "Error: no data version argument provided."
exit 1
fi

function before_update {
echo -e "[...] ${1}"
Expand Down
Loading

0 comments on commit e9e32ce

Please sign in to comment.