From e91f3fce038e43065398dcad39f27f7a39713212 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9my=20Coutable?= <remy@rymai.me>
Date: Wed, 15 Jun 2022 10:33:12 +0200
Subject: [PATCH] ci: Consolidate Review App jobs image
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Rémy Coutable <remy@rymai.me>
---
 .gitlab-ci.yml                            | 1 +
 .gitlab/ci/review-apps/main.gitlab-ci.yml | 4 ++--
 .gitlab/ci/review.gitlab-ci.yml           | 2 +-
 scripts/review_apps/review-apps.sh        | 4 ++--
 scripts/utils.sh                          | 4 ----
 5 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 0c06df88b3fae..0ff1c6951c7a5 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -114,6 +114,7 @@ variables:
   DOCS_REVIEW_APPS_DOMAIN: "35.193.151.162.nip.io"
   DOCS_GITLAB_REPO_SUFFIX: "ee"
 
+  REVIEW_APPS_IMAGE: "${REGISTRY_HOST}/${REGISTRY_GROUP}/gitlab-build-images/ruby-3.0:gcloud-383-kubectl-1.23-helm-3.5"
   REVIEW_APPS_DOMAIN: "gitlab-review.app"
   REVIEW_APPS_GCP_PROJECT: "gitlab-review-apps"
   REVIEW_APPS_GCP_REGION: "us-central1"
diff --git a/.gitlab/ci/review-apps/main.gitlab-ci.yml b/.gitlab/ci/review-apps/main.gitlab-ci.yml
index 7f3ae70da8cfd..a01c6327cda10 100644
--- a/.gitlab/ci/review-apps/main.gitlab-ci.yml
+++ b/.gitlab/ci/review-apps/main.gitlab-ci.yml
@@ -14,7 +14,7 @@ include:
 .base-before_script: &base-before_script
   - source ./scripts/utils.sh
   - source ./scripts/review_apps/review-apps.sh
-  - install_api_client_dependencies_with_apk
+  - apt-get update && apt-get install -y jq
 
 review-build-cng-env:
   extends:
@@ -72,7 +72,7 @@ review-build-cng:
 .review-workflow-base:
   extends:
     - .default-retry
-  image: ${REGISTRY_HOST}/${REGISTRY_GROUP}/gitlab-build-images:gitlab-helm3.5-kubectl1.17
+  image: ${REVIEW_APPS_IMAGE}
   resource_group: "review/${CI_COMMIT_REF_NAME}"
   variables:
     HOST_SUFFIX: "${CI_ENVIRONMENT_SLUG}"
diff --git a/.gitlab/ci/review.gitlab-ci.yml b/.gitlab/ci/review.gitlab-ci.yml
index b2cd9d61fd882..ef4b37aff4d04 100644
--- a/.gitlab/ci/review.gitlab-ci.yml
+++ b/.gitlab/ci/review.gitlab-ci.yml
@@ -5,7 +5,7 @@ review-cleanup:
   extends:
     - .default-retry
     - .review:rules:review-cleanup
-  image: ${REGISTRY_HOST}/${REGISTRY_GROUP}/gitlab-build-images/ruby-3.0:gcloud-383-kubectl-1.23-helm-3.5
+  image: ${REVIEW_APPS_IMAGE}
   stage: prepare
   environment:
     name: review/${CI_COMMIT_REF_SLUG}${SCHEDULE_TYPE} # No separator for SCHEDULE_TYPE so it's compatible as before and looks nice without it
diff --git a/scripts/review_apps/review-apps.sh b/scripts/review_apps/review-apps.sh
index b6ac7b4281b41..e979d0f75cf0f 100755
--- a/scripts/review_apps/review-apps.sh
+++ b/scripts/review_apps/review-apps.sh
@@ -219,7 +219,7 @@ function create_application_secret() {
     kubectl create secret generic --namespace "${namespace}" \
       "shared-gitlab-initial-root-password" \
       --from-literal="password=${REVIEW_APPS_ROOT_PASSWORD}" \
-      --dry-run -o json | kubectl apply -f -
+      --dry-run=client -o json | kubectl apply -f -
   else
     echoinfo "The 'shared-gitlab-initial-root-password' secret already exists in the ${namespace} namespace."
   fi
@@ -232,7 +232,7 @@ function create_application_secret() {
     kubectl create secret generic --namespace "${namespace}" \
       "shared-gitlab-license" \
       --from-file=license="${REVIEW_APPS_EE_LICENSE_FILE}" \
-      --dry-run -o json | kubectl apply -f -
+      --dry-run=client -o json | kubectl apply -f -
   else
     echoinfo "The 'shared-gitlab-license' secret already exists in the ${namespace} namespace."
   fi
diff --git a/scripts/utils.sh b/scripts/utils.sh
index d9205921963a4..335b2eb41e7c6 100644
--- a/scripts/utils.sh
+++ b/scripts/utils.sh
@@ -72,10 +72,6 @@ function setup_db() {
   run_timed_command "setup_db_praefect"
 }
 
-function install_api_client_dependencies_with_apk() {
-  run_timed_command "apk add --update openssl curl jq"
-}
-
 function install_gitlab_gem() {
   run_timed_command "gem install httparty --no-document --version 0.18.1"
   run_timed_command "gem install gitlab --no-document --version 4.17.0"
-- 
GitLab