Skip to content

Commit

Permalink
Rework release workflow to split up image creation
Browse files Browse the repository at this point in the history
Trying to run creation in a single job exhausts disk space while
also being slower than running a matrix. As only two image are
required for the others to build, run those in serial then the rest in
a matrix.
  • Loading branch information
bryteise committed Jun 17, 2024
1 parent f348aa4 commit e44821c
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 35 deletions.
30 changes: 22 additions & 8 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,21 +1,35 @@
name: Dockerfiles Release
on: [create]
on: create
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}
cancel-in-progress: true
env:
GITHUB_TOKEN: ${{ github.token }}

jobs:
release:
if: (github.event_name == 'create' && github.event.ref_type == 'tag')
name: Release
if: (github.event_name == 'create' && github.event.ref_type == 'tag')
release-pre-reqs:
name: Release image required by other images
runs-on: ubuntu-latest
steps:
- name: Code Checkout
uses: actions/checkout@v4
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and Push
run: ./build-and-push-images.sh os-core ${{ github.event.ref }}
run: ./build-and-push-images.sh httpd ${{ github.event.ref }}
release-matrix:
name: Release Matrix
strategy:
fail-fast: false
matrix:
iamge: ['cgit', 'golang', 'haproxy', 'iperf', 'mariadb', 'memcached', 'nginx', 'node', 'numpy-mp', 'perl', 'php', 'php-fpm', 'postgres', 'python', 'rabbitmq', 'r-base', 'redis', 'ruby', 'tesseract-ocr']
runs-on: ubuntu-latest
steps:
- name: Delete unused tools folder
run: rm -rf /opt/hostedtoolcache
- name: Code Checkout
uses: actions/checkout@v4
- name: Login to GitHub Container Registry
Expand All @@ -25,4 +39,4 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and Push
run: ./build-and-push-images.sh ${{ github.event.ref }}
run: ./build-and-push-images.sh ${{ matrix.image }} ${{ github.event.ref }}
28 changes: 1 addition & 27 deletions build-and-push-images.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,30 +23,4 @@ build_and_push_image() {
push_image "${name}" "${ver}"
}

main() {
local ver="$1"
build_and_push_image os-core "${ver}"
# httpd is used by cgit so it must be pushed first
build_and_push_image httpd "${ver}"
build_and_push_image cgit "${ver}"
build_and_push_image golang "${ver}"
build_and_push_image haproxy "${ver}"
build_and_push_image iperf "${ver}"
build_and_push_image mariadb "${ver}"
build_and_push_image memcached "${ver}"
build_and_push_image nginx "${ver}"
build_and_push_image node "${ver}"
build_and_push_image numpy-mp "${ver}"
build_and_push_image perl "${ver}"
build_and_push_image php "${ver}"
build_and_push_image php-fpm "${ver}"
build_and_push_image postgres "${ver}"
build_and_push_image python "${ver}"
build_and_push_image rabbitmq "${ver}"
build_and_push_image r-base "${ver}"
build_and_push_image redis "${ver}"
build_and_push_image ruby "${ver}"
build_and_push_image tesseract-ocr "${ver}"
}

main $1
build_and_push_image $1 $2

0 comments on commit e44821c

Please sign in to comment.