From eeb4b414defc2f9589d261e98155c6d332cc53cb Mon Sep 17 00:00:00 2001 From: Tomasz Gromadzki Date: Mon, 17 Jul 2023 21:45:10 +0200 Subject: [PATCH 1/2] common: force rebuild docker images Signed-off-by: Tomasz Gromadzki --- .github/workflows/docker_rebuild.yml | 5 +---- utils/docker/pull-or-rebuild-image.sh | 3 ++- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/docker_rebuild.yml b/.github/workflows/docker_rebuild.yml index fdb6b16a5b6..cf7f0ccfd91 100644 --- a/.github/workflows/docker_rebuild.yml +++ b/.github/workflows/docker_rebuild.yml @@ -47,9 +47,6 @@ jobs: steps: - name: Clone the git repo uses: actions/checkout@v3 - - - name: Get system information - run: ./$WORKDIR/get-system-info.sh - name: Pull or rebuild the image - run: cd $WORKDIR && ${{ matrix.CONFIG }} ./pull-or-rebuild-image.sh + run: cd $WORKDIR && ${{ matrix.CONFIG }} ./pull-or-rebuild-image.sh rebuild diff --git a/utils/docker/pull-or-rebuild-image.sh b/utils/docker/pull-or-rebuild-image.sh index c21970411ae..a1e3e7cff03 100755 --- a/utils/docker/pull-or-rebuild-image.sh +++ b/utils/docker/pull-or-rebuild-image.sh @@ -108,7 +108,8 @@ for file in $files; do echo $file; done for file in $files; do # Check if modified files are relevant to the current build if [[ $file =~ ^($base_dir)\/Dockerfile\.($OS)-($OS_VER)$ ]] \ - || [[ $file =~ ^($base_dir)\/.*\.sh$ ]] + || [[ $file =~ ^($base_dir)\/.*\.sh$ ]] \ + || [[ $file =~ ^($base_dir)\/\.\.\/\.\.\/\.\.\/\.github\/workflows\/docker_rebuild\.yml ]] then build_image push_image From 356737f49768678e2210a6ab6666c112eaa18d59 Mon Sep 17 00:00:00 2001 From: Tomasz Gromadzki Date: Mon, 17 Jul 2023 22:17:58 +0200 Subject: [PATCH 2/2] common: force Docker rebuild on docker_rebuild.yml modifications Signed-off-by: Tomasz Gromadzki --- .github/workflows/docker_rebuild.yml | 3 +++ utils/docker/pull-or-rebuild-image.sh | 11 ++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.github/workflows/docker_rebuild.yml b/.github/workflows/docker_rebuild.yml index cf7f0ccfd91..93a5a4803c1 100644 --- a/.github/workflows/docker_rebuild.yml +++ b/.github/workflows/docker_rebuild.yml @@ -8,11 +8,14 @@ on: - master paths: - 'utils/docker/images/**' + - '.github/workflows/docker_rebuild.yml' + push: branches: - master paths: - 'utils/docker/images/**' + - '.github/workflows/docker_rebuild.yml' schedule: # run this job at 22:00 UTC every other day (hopefully just before the nightly) - cron: '0 22 */2 * *' diff --git a/utils/docker/pull-or-rebuild-image.sh b/utils/docker/pull-or-rebuild-image.sh index a1e3e7cff03..d0c8de03524 100755 --- a/utils/docker/pull-or-rebuild-image.sh +++ b/utils/docker/pull-or-rebuild-image.sh @@ -61,9 +61,9 @@ function push_image { # - not a pull_request event, # - and PUSH_IMAGE flag was set for current build. if [[ "${CI_REPO_SLUG}" == "${GITHUB_REPO}" \ - && (${CI_BRANCH} == stable-* || ${CI_BRANCH} == devel-* || ${CI_BRANCH} == master) \ - && ${CI_EVENT_TYPE} != "pull_request" \ - && ${PUSH_IMAGE} == "1" ]] + && (((${CI_BRANCH} == stable-* || ${CI_BRANCH} == devel-* || ${CI_BRANCH} == master) \ + && ${CI_EVENT_TYPE} != "pull_request") \ + || ${PUSH_IMAGE} == "1") ]] then echo "The image will be pushed to the Container Registry: ${DOCKER_REPO}" pushd ${images_dir_name} @@ -71,6 +71,11 @@ function push_image { popd else echo "Skip pushing the image to the ${DOCKER_REPO}." + echo "CI_REPO_SLUG: ${CI_REPO_SLUG}" + echo "GITHUB_REPO: ${GITHUB_REPO}" + echo "CI_BRANCH: ${CI_BRANCH}" + echo "CI_EVENT_TYPE: ${CI_EVENT_TYPE}" + echo "PUSH_IMAGE: ${PUSH_IMAGE}" fi }