From a19f9fb1f288ec6f67e9351865f85dd3b3189320 Mon Sep 17 00:00:00 2001 From: meichler Date: Mon, 19 Feb 2024 10:22:11 +0200 Subject: [PATCH 1/5] Check that upload and master commits are different --- .gitlab/ci/.gitlab-ci.global.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.gitlab/ci/.gitlab-ci.global.yml b/.gitlab/ci/.gitlab-ci.global.yml index c7df44c12e4a..462aae58ef90 100644 --- a/.gitlab/ci/.gitlab-ci.global.yml +++ b/.gitlab/ci/.gitlab-ci.global.yml @@ -234,7 +234,7 @@ .checkout-upload-commit-content-nightly: &checkout-upload-commit-content-nightly - section_start "Checkout upload commit content nightly" --collapsed - | - if [[ -n "${NIGHTLY}" && "${CI_COMMIT_BRANCH}" == "master" ]]; then + if [[ -n "${NIGHTLY}" && "${CI_COMMIT_BRANCH}" == "master" && ${LAST_UPLOAD_COMMIT} != ${CI_COMMIT_SHA} ]]; then if [[ ! -d "${CI_PROJECT_DIR}/artifacts/production_packs" ]]; then echo "content production packs do not exist in ${CI_PROJECT_DIR}/artifacts" exit 1 @@ -245,7 +245,9 @@ git config core.fileMode false # used to tell git not to identify permission changes on files as changes chmod -R 777 ./Packs # required for the lint, we use the permissions of the file when running pytest within the containers echo "the Packs changes between upload commit ${LAST_UPLOAD_COMMIT} to master commit ${CI_COMMIT_SHA} is:" - git status -- Packs # show the differences between the upload commit to the master branch for the Packs folder + git status -- Packs # show the differences between the upload commit to the master branch for the Packs folder before commit + git commit -am "updated branch to upload commit ${LAST_UPLOAD_COMMIT}" + git status -- Packs # show the differences between the upload commit to the master branch for the Packs folder after commit echo "The Packs folder is in the state of commit $LAST_UPLOAD_COMMIT" else echo "not checking out to the latest upload commit $LAST_UPLOAD_COMMIT because the build is not content nightly" From b24e2d28b6df667a275a167542047c30708afc6d Mon Sep 17 00:00:00 2001 From: meichler Date: Mon, 19 Feb 2024 10:24:53 +0200 Subject: [PATCH 2/5] fix the print --- .gitlab/ci/.gitlab-ci.global.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab/ci/.gitlab-ci.global.yml b/.gitlab/ci/.gitlab-ci.global.yml index 462aae58ef90..d7e60ddbfd87 100644 --- a/.gitlab/ci/.gitlab-ci.global.yml +++ b/.gitlab/ci/.gitlab-ci.global.yml @@ -250,7 +250,7 @@ git status -- Packs # show the differences between the upload commit to the master branch for the Packs folder after commit echo "The Packs folder is in the state of commit $LAST_UPLOAD_COMMIT" else - echo "not checking out to the latest upload commit $LAST_UPLOAD_COMMIT because the build is not content nightly" + echo "not checking out to the latest upload commit $LAST_UPLOAD_COMMIT because the build is not content nightly or the ${LAST_UPLOAD_COMMIT} and ${CI_COMMIT_SHA} are equal" fi - | - section_end "Checkout upload commit content nightly" From 6162bcc38348e57a5c78030bc191318be664ece0 Mon Sep 17 00:00:00 2001 From: meichler Date: Mon, 19 Feb 2024 10:54:35 +0200 Subject: [PATCH 3/5] divided if --- .gitlab/ci/.gitlab-ci.global.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.gitlab/ci/.gitlab-ci.global.yml b/.gitlab/ci/.gitlab-ci.global.yml index d7e60ddbfd87..b8b428e3c80b 100644 --- a/.gitlab/ci/.gitlab-ci.global.yml +++ b/.gitlab/ci/.gitlab-ci.global.yml @@ -249,10 +249,11 @@ git commit -am "updated branch to upload commit ${LAST_UPLOAD_COMMIT}" git status -- Packs # show the differences between the upload commit to the master branch for the Packs folder after commit echo "The Packs folder is in the state of commit $LAST_UPLOAD_COMMIT" - else - echo "not checking out to the latest upload commit $LAST_UPLOAD_COMMIT because the build is not content nightly or the ${LAST_UPLOAD_COMMIT} and ${CI_COMMIT_SHA} are equal" + elif [[ "${NIGHTLY}" != true ]]; then + echo "not checking out to the latest upload commit $LAST_UPLOAD_COMMIT because the build is not content nightly." + elif [[ ${LAST_UPLOAD_COMMIT} == ${CI_COMMIT_SHA} ]]; then + echo "not checking out to the latest upload commit because the ${LAST_UPLOAD_COMMIT} and ${CI_COMMIT_SHA} are equal." fi - - | - section_end "Checkout upload commit content nightly" .export_cloud_machine_constants: &export_cloud_machine_constants From 1f82d670eedb7937e3339eee78386461e03ed921 Mon Sep 17 00:00:00 2001 From: meichler Date: Mon, 19 Feb 2024 11:43:12 +0200 Subject: [PATCH 4/5] CR fixes --- .gitlab/ci/.gitlab-ci.global.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.gitlab/ci/.gitlab-ci.global.yml b/.gitlab/ci/.gitlab-ci.global.yml index b8b428e3c80b..8bbd960ccb9e 100644 --- a/.gitlab/ci/.gitlab-ci.global.yml +++ b/.gitlab/ci/.gitlab-ci.global.yml @@ -249,10 +249,12 @@ git commit -am "updated branch to upload commit ${LAST_UPLOAD_COMMIT}" git status -- Packs # show the differences between the upload commit to the master branch for the Packs folder after commit echo "The Packs folder is in the state of commit $LAST_UPLOAD_COMMIT" - elif [[ "${NIGHTLY}" != true ]]; then + elif [[ -z "${NIGHTLY}" ]]; then echo "not checking out to the latest upload commit $LAST_UPLOAD_COMMIT because the build is not content nightly." - elif [[ ${LAST_UPLOAD_COMMIT} == ${CI_COMMIT_SHA} ]]; then - echo "not checking out to the latest upload commit because the ${LAST_UPLOAD_COMMIT} and ${CI_COMMIT_SHA} are equal." + elif [[ "${CI_COMMIT_BRANCH}" != "master" ]]; then + echo "not checking out to the latest upload commit $LAST_UPLOAD_COMMIT because the "${CI_COMMIT_BRANCH}" branch is not master." + elif [[ "${LAST_UPLOAD_COMMIT}" == "${CI_COMMIT_SHA}" ]]; then + echo "not checking out to the latest upload commit $LAST_UPLOAD_COMMIT because the \$LAST_UPLOAD_COMMIT and \$CI_COMMIT_SHA are equal to ${CI_COMMIT_SHA}." fi - section_end "Checkout upload commit content nightly" From 10a8f48a1507894bf11ace7bff11e993080941db Mon Sep 17 00:00:00 2001 From: meichler Date: Tue, 20 Feb 2024 15:59:17 +0200 Subject: [PATCH 5/5] CR fixes --- .gitlab/ci/.gitlab-ci.global.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitlab/ci/.gitlab-ci.global.yml b/.gitlab/ci/.gitlab-ci.global.yml index 8bbd960ccb9e..2a1786217f36 100644 --- a/.gitlab/ci/.gitlab-ci.global.yml +++ b/.gitlab/ci/.gitlab-ci.global.yml @@ -234,7 +234,7 @@ .checkout-upload-commit-content-nightly: &checkout-upload-commit-content-nightly - section_start "Checkout upload commit content nightly" --collapsed - | - if [[ -n "${NIGHTLY}" && "${CI_COMMIT_BRANCH}" == "master" && ${LAST_UPLOAD_COMMIT} != ${CI_COMMIT_SHA} ]]; then + if [[ -n "${NIGHTLY}" && "${CI_COMMIT_BRANCH}" == "master" && "${LAST_UPLOAD_COMMIT}" != "${CI_COMMIT_SHA}" ]]; then if [[ ! -d "${CI_PROJECT_DIR}/artifacts/production_packs" ]]; then echo "content production packs do not exist in ${CI_PROJECT_DIR}/artifacts" exit 1 @@ -246,7 +246,7 @@ chmod -R 777 ./Packs # required for the lint, we use the permissions of the file when running pytest within the containers echo "the Packs changes between upload commit ${LAST_UPLOAD_COMMIT} to master commit ${CI_COMMIT_SHA} is:" git status -- Packs # show the differences between the upload commit to the master branch for the Packs folder before commit - git commit -am "updated branch to upload commit ${LAST_UPLOAD_COMMIT}" + git commit -am "updated Packs folder to latest upload commit ${LAST_UPLOAD_COMMIT}" git status -- Packs # show the differences between the upload commit to the master branch for the Packs folder after commit echo "The Packs folder is in the state of commit $LAST_UPLOAD_COMMIT" elif [[ -z "${NIGHTLY}" ]]; then