This is an automated email from the ASF dual-hosted git repository. jacopoc pushed a commit to branch trunk in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git
commit 38e2bc6d21c02dcb44df8298e6105e1748c0154b Author: Jacopo Cappellato <[email protected]> AuthorDate: Thu Oct 22 10:53:05 2026 +0200 Build the Docker images only when they can be pushed and are needed The Docker workflow builds three images, compiling OFBiz each time, on an ubuntu-latest runner, a limited resource shared by all the ASF projects: - run the job only when the DO_DOCKER_PUSH variable is 'true': forks built the images without being able to push them. To run the workflow with act, pass --var DO_DOCKER_PUSH=true; the images are still not pushed under act - cancel the running or queued build of a branch when a new commit is pushed to it, since only the images of the latest push replace the -snapshot images; tag builds are never cancelled - don't trigger the build for changes that cannot affect the images (Markdown files, Windows scripts, IDE/devcontainer setup, other workflows). The docs are copied into the images, so they still trigger it. Paths filters are not evaluated for tag pushes, so tags always build the images Document the new condition and the cancellation in README-CI-CD.md. Co-Authored-By: Claude Opus 5.5 <[email protected]> --- .github/README-CI-CD.md | 4 ++-- .github/workflows/docker-image.yml | 34 +++++++++++++++++++++++++++++++--- 2 files changed, 33 insertions(+), 5 deletions(-) diff --git a/.github/README-CI-CD.md b/.github/README-CI-CD.md index d4251946fc..be130e6dc2 100644 --- a/.github/README-CI-CD.md +++ b/.github/README-CI-CD.md @@ -11,8 +11,8 @@ → Trigger: push / PR (except Dependabot PRs) + weekly on `trunk` and `release*`, skipped when only documentation or setup files change - `docker-image.yml` - Build and push images to `ghcr.io/apache/ofbiz` - → Trigger: push on `trunk` / `release*` + tags + Build and push images to `ghcr.io/apache/ofbiz`, only if the `DO_DOCKER_PUSH` variable is `true` + → Trigger: push on `trunk` / `release*` + tags; a new push cancels the running build of the same branch - `dependency-review.yml` Vulnerability scanning for dependencies in PRs diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 793edf527b..672f695ce7 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -27,12 +27,13 @@ # Some actions, such as docker/metadata-action, require a GITHUB_TOKEN. To meet this # requirement when using act you will need to create a Personal Access Token on GitHub. # You can then run act using a command similar to: -# act --job docker_build --secret GITHUB_TOKEN +# act --job docker_build --secret GITHUB_TOKEN --var DO_DOCKER_PUSH=true # Act will then prompt you to enter your token. ############################################################################# -# Docker push will only occur if configuration variable DO_DOCKER_PUSH is set to 'true'. -# This ensures that repository forks do not attempt push to the ghcr.io/apache/ofbiz container registry. +# The images are only built and pushed if configuration variable DO_DOCKER_PUSH is set to 'true'. +# This ensures that repository forks do not build images that they cannot push to the +# ghcr.io/apache/ofbiz container registry. # See https://docs.github.com/en/actions/learn-github-actions/variables#defining-configuration-variables-for-multiple-workflows # for more information on configuring variables for a repository. @@ -43,6 +44,32 @@ on: branches: [ trunk, release* ] tags: - '**' + # Changes that cannot affect the images (Markdown files, IDE/devcontainer setup, + # Windows-only scripts, other workflows...) don't trigger the build: the ubuntu-latest + # runners are a limited resource shared by all the ASF projects. + # These patterns are not evaluated for the push of a tag, which always builds the images. + # GitHub evaluates these patterns in order, so a later pattern can re-include a path that an + # earlier "!" pattern excluded. + paths: + - '**' + - '!**.md' + - '!**.bat' + - '!.asf.yaml' + - '!.devcontainer/**' + - '!.gitattributes' + - '!.gitignore' + - '!.hgignore' + - '!.idea/**' + - '!.pre-commit-config.yaml' + - '!.github/**' + - '.github/workflows/docker-image.yml' + +# Only the images of the latest push to a branch matter, as they replace the -snapshot images +# of the previous pushes, so a new push cancels the still running or queued build of the branch. +# The builds of tags are never cancelled. +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ github.ref_type == 'branch' }} permissions: contents: read @@ -50,6 +77,7 @@ permissions: jobs: docker_build: name: Build and push OFBiz docker container images + if: vars.DO_DOCKER_PUSH == 'true' runs-on: ubuntu-latest permissions: contents: read

