From 8fff315864155e780926cf4bd2c942c7baf90c63 Mon Sep 17 00:00:00 2001 From: Andrejs Cunskis Date: Tue, 3 May 2022 13:52:10 +0300 Subject: [PATCH 1/2] Move custom images to separate major component directories --- .gitlab/ci/e2e.images.yml | 40 ++++++++++++++++++++++++++++++++++++ .gitlab/ci/qa.images.yml | 23 --------------------- scripts/custom-docker-build | 5 ++--- scripts/lib/custom-docker.sh | 4 ++-- 4 files changed, 44 insertions(+), 28 deletions(-) create mode 100644 .gitlab/ci/e2e.images.yml delete mode 100644 .gitlab/ci/qa.images.yml diff --git a/.gitlab/ci/e2e.images.yml b/.gitlab/ci/e2e.images.yml new file mode 100644 index 0000000..63c22ce --- /dev/null +++ b/.gitlab/ci/e2e.images.yml @@ -0,0 +1,40 @@ +# Used by gitlab e2e tests and other qa related tasks + +# Base image used by QA framework unit tests and other jobs not requiring full toolset +.e2e-base: + variables: + DEBIAN: bullseye + GIT: '2.33' + RUBY: '2.7' + BUNDLER: '2.3' + CHROME: '99' + +# Image used for running full e2e test suite +.e2e-full: + variables: + LFS: '2.9' + GCLOUD: '383' + KUBECTL: '1.23' + DOCKER: '20.10.14' + +e2e-base test: + extends: + - .e2e-base + - .test_custom +e2e-base push: + extends: + - .e2e-base + - .build_and_deploy_custom + needs: ["e2e-base test"] + +e2e-full test: + extends: + - .e2e-base + - .e2e-full + - .test_custom +e2e-full push: + extends: + - .e2e-base + - .e2e-full + - .build_and_deploy_custom + needs: ["e2e-full test"] diff --git a/.gitlab/ci/qa.images.yml b/.gitlab/ci/qa.images.yml deleted file mode 100644 index 4e1d836..0000000 --- a/.gitlab/ci/qa.images.yml +++ /dev/null @@ -1,23 +0,0 @@ -# Used by gitlab e2e tests and other qa related tasks -.qa: - variables: - DEBIAN: bullseye - LFS: '2.9' - GIT: '2.33' - RUBY: '2.7' - BUNDLER: '2.3' - CHROME: '99' - GCLOUD: '383' - KUBECTL: '1.23' - DOCKER: '20.10.14' - -qa test: - extends: - - .qa - - .test_custom - -qa push: - extends: - - .qa - - .build_and_deploy_custom - needs: ["qa test"] diff --git a/scripts/custom-docker-build b/scripts/custom-docker-build index 349c719..f52436d 100755 --- a/scripts/custom-docker-build +++ b/scripts/custom-docker-build @@ -268,7 +268,6 @@ function print_kubectl_args() { function parse_arguments() { printf -- "-f Dockerfile.custom " - # Mapping between sources of architectures # - arch: a current image architecture (or uname -m if matching host, but can be different) # - apk --print-arch: a alpine architecture for installed packages @@ -337,14 +336,14 @@ function generate_command() { function build_custom_if_needed() { build_image_path=$(get_image_path) build_image_tag=$(get_image_tag) - echo "Building image $build_image_tag" full_image_name="$build_image_path:$build_image_tag" + echo "Building image $full_image_name" docker_command=$(generate_command $@ --build-arg BUILDKIT_INLINE_CACHE=1 --cache-from="$full_image_name" -t "$full_image_name") echo "Docker command:" printf "\t%s" "$docker_command" eval $docker_command - printf "\n\nSUCCESS - Successfully built:\n\t%s" "$build_image_tag" + printf "\n\nSUCCESS - Successfully built:\n\t%s" "$full_image_name" } build_custom_if_needed $@ diff --git a/scripts/lib/custom-docker.sh b/scripts/lib/custom-docker.sh index 66fdc86..df92c12 100644 --- a/scripts/lib/custom-docker.sh +++ b/scripts/lib/custom-docker.sh @@ -1,5 +1,5 @@ -PATH_TOOLS=() -TAG_TOOLS=(DEBIAN RUBY BUNDLER GOLANG GIT LFS CHROME NODE YARN POSTGRESQL GRAPHICSMAGICK PGBOUNCER BAZELISK DOCKER GCLOUD KUBECTL) +PATH_TOOLS=(DEBIAN RUBY GOLANG NODE POSTGRESQL) +TAG_TOOLS=(BUNDLER GIT LFS CHROME YARN GRAPHICSMAGICK PGBOUNCER BAZELISK DOCKER GCLOUD KUBECTL) function get_image_path() { local path From 8b1b51a97c0d4e855804fc484f90f1b488d5a2e5 Mon Sep 17 00:00:00 2001 From: Andrejs Cunskis Date: Tue, 3 May 2022 14:15:31 +0300 Subject: [PATCH 2/2] Correctly set tag for images without minor tools --- scripts/custom-docker-build | 1 + scripts/lib/custom-docker.sh | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/scripts/custom-docker-build b/scripts/custom-docker-build index f52436d..a4ef11e 100755 --- a/scripts/custom-docker-build +++ b/scripts/custom-docker-build @@ -344,6 +344,7 @@ function build_custom_if_needed() { printf "\t%s" "$docker_command" eval $docker_command printf "\n\nSUCCESS - Successfully built:\n\t%s" "$full_image_name" + echo "" } build_custom_if_needed $@ diff --git a/scripts/lib/custom-docker.sh b/scripts/lib/custom-docker.sh index df92c12..505f42a 100644 --- a/scripts/lib/custom-docker.sh +++ b/scripts/lib/custom-docker.sh @@ -25,5 +25,10 @@ function get_image_tag() { tag="${tag}-${tool,,}-${!tool}" fi done - echo "${tag:1}" + + if [[ -n "$tag" ]]; then + echo "${tag:1}" + else + echo "latest" + fi }