From 0d7ecb6bcae0107e5fad044d078d57226dded11b Mon Sep 17 00:00:00 2001 From: Yury Kovalev Date: Tue, 7 Nov 2023 18:58:12 +0100 Subject: [PATCH 1/2] ROX-20694: Use app-interface image tag pattern for all the images --- Makefile | 17 +++-------------- build_push_fleet_manager.sh | 1 - build_push_probe.sh | 1 - dev/env/defaults/00-defaults.env | 1 - dev/env/scripts/lib.sh | 2 -- dev/env/scripts/up.sh | 8 +------- scripts/build_setup.sh | 4 ---- 7 files changed, 4 insertions(+), 30 deletions(-) diff --git a/Makefile b/Makefile index 7f016564b5..0429de6f8e 100644 --- a/Makefile +++ b/Makefile @@ -10,18 +10,10 @@ SHELL = bash binary:=fleet-manager # The image tag for building and pushing comes from TAG environment variable by default. -# If there is no TAG env than CI_TAG is used instead. -# Otherwise image tag is generated based on git tags. +# Otherwise image tag is generated based on current commit hash. +# The version should be a 7-char hash from git. This is what the deployment process in app-interface expects. ifeq ($(TAG),) -ifeq (,$(wildcard CI_TAG)) -ifeq ($(IGNORE_REPOSITORY_DIRTINESS),true) -TAG=$(shell git describe --tags --abbrev=10 --long) -else -TAG=$(shell git describe --tags --abbrev=10 --dirty --long) -endif -else -TAG=$(shell cat CI_TAG) -endif +TAG=$(shell git rev-parse --short=7 HEAD) endif image_tag = $(TAG) @@ -50,9 +42,6 @@ probe_image_repository:=$(PROBE_IMAGE_NAME) external_image_registry:= $(IMAGE_REGISTRY) internal_image_registry:=image-registry.openshift-image-registry.svc:5000 -# Test image name that will be used for PR checks -test_image:=test/$(IMAGE_NAME) - DOCKER ?= docker DOCKER_CONFIG ?= "${HOME}/.docker" diff --git a/build_push_fleet_manager.sh b/build_push_fleet_manager.sh index 700f17f8a1..8c07e22b8d 100755 --- a/build_push_fleet_manager.sh +++ b/build_push_fleet_manager.sh @@ -42,7 +42,6 @@ make \ DOCKER_CONFIG="${DOCKER_CONFIG}" \ QUAY_USER="${QUAY_USER}" \ QUAY_TOKEN="${QUAY_TOKEN}" \ - TAG="${VERSION}" \ external_image_registry="quay.io" \ internal_image_registry="quay.io" \ image_repository="${IMAGE_REPOSITORY}" \ diff --git a/build_push_probe.sh b/build_push_probe.sh index 947c0b7818..f0791f3d8d 100755 --- a/build_push_probe.sh +++ b/build_push_probe.sh @@ -39,7 +39,6 @@ make \ DOCKER_CONFIG="${DOCKER_CONFIG}" \ QUAY_PROBE_USER="${QUAY_USER}" \ QUAY_PROBE_TOKEN="${QUAY_TOKEN}" \ - TAG="${VERSION}" \ external_image_registry="quay.io" \ internal_image_registry="quay.io" \ probe_image_repository="${IMAGE_REPOSITORY}" \ diff --git a/dev/env/defaults/00-defaults.env b/dev/env/defaults/00-defaults.env index 19d4f21173..9dd477dc06 100644 --- a/dev/env/defaults/00-defaults.env +++ b/dev/env/defaults/00-defaults.env @@ -17,7 +17,6 @@ export CENTRAL_VERSION_DEFAULT=$(echo "$STACKROX_VERSION_TAG" | sed -e 's/0-nigh export SCANNER_VERSION_DEFAULT="2.30.0" # This one matches the above operator version tag. export STACKROX_OPERATOR_NAMESPACE_DEFAULT="rhacs" export FLEET_MANAGER_IMAGE_DEFAULT="" -export IGNORE_REPOSITORY_DIRTINESS_DEFAULT="false" export ENABLE_DB_PORT_FORWARDING_DEFAULT="false" export ENABLE_FM_PORT_FORWARDING_DEFAULT="false" export OPENSHIFT_MARKETPLACE_DEFAULT="false" diff --git a/dev/env/scripts/lib.sh b/dev/env/scripts/lib.sh index 505e7b30ea..2c15c7a8f2 100644 --- a/dev/env/scripts/lib.sh +++ b/dev/env/scripts/lib.sh @@ -145,7 +145,6 @@ init() { export ENABLE_CENTRAL_EXTERNAL_CERTIFICATE=${ENABLE_CENTRAL_EXTERNAL_CERTIFICATE:-$ENABLE_CENTRAL_EXTERNAL_CERTIFICATE_DEFAULT} export CENTRAL_DOMAIN_NAME=${CENTRAL_DOMAIN_NAME:-$CENTRAL_DOMAIN_NAME_DEFAULT} export FLEET_MANAGER_IMAGE=${FLEET_MANAGER_IMAGE:-$FLEET_MANAGER_IMAGE_DEFAULT} - export IGNORE_REPOSITORY_DIRTINESS=${IGNORE_REPOSITORY_DIRTINESS:-$IGNORE_REPOSITORY_DIRTINESS_DEFAULT} export RHACS_TARGETED_OPERATOR_UPGRADES=${RHACS_TARGETED_OPERATOR_UPGRADES:-$RHACS_TARGETED_OPERATOR_UPGRADES_DEFAULT} export RHACS_GITOPS_ENABLED=${RHACS_GITOPS_ENABLED:-$RHACS_GITOPS_ENABLED_DEFAULT} @@ -229,7 +228,6 @@ SKIP_TESTS: ${SKIP_TESTS} ENABLE_CENTRAL_EXTERNAL_CERTIFICATE: ${ENABLE_CENTRAL_EXTERNAL_CERTIFICATE} CENTRAL_DOMAIN_NAME: ${CENTRAL_DOMAIN_NAME} FLEET_MANAGER_IMAGE: ${FLEET_MANAGER_IMAGE} -IGNORE_REPOSITORY_DIRTINESS: ${IGNORE_REPOSITORY_DIRTINESS} RHACS_TARGETED_OPERATOR_UPGRADES: ${RHACS_TARGETED_OPERATOR_UPGRADES} RHACS_GITOPS_ENABLED: ${RHACS_GITOPS_ENABLED} FLEET_MANAGER_CONTAINER_COMMAND: ${FLEET_MANAGER_CONTAINER_COMMAND} diff --git a/dev/env/scripts/up.sh b/dev/env/scripts/up.sh index 33b7f2089e..567a7deb60 100755 --- a/dev/env/scripts/up.sh +++ b/dev/env/scripts/up.sh @@ -21,17 +21,11 @@ else export CHAMBER_SECRET_BACKEND=null fi -if [[ "$IGNORE_REPOSITORY_DIRTINESS" = "true" ]]; then - fleet_manager_image_info="${FLEET_MANAGER_IMAGE} (ignoring repository dirtiness)" -else - fleet_manager_image_info="${FLEET_MANAGER_IMAGE}" -fi - cat < Date: Wed, 8 Nov 2023 14:15:29 +0100 Subject: [PATCH 2/2] Change dp terraform scripts --- deploy/helm/probe/deploy.sh | 12 ++++++------ .../helm/rhacs-terraform/terraform_cluster.sh | 12 ++++++------ dp-terraform/ocm/install_addon.sh | 10 +++++----- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/deploy/helm/probe/deploy.sh b/deploy/helm/probe/deploy.sh index 6425bc087c..e639286e25 100755 --- a/deploy/helm/probe/deploy.sh +++ b/deploy/helm/probe/deploy.sh @@ -2,11 +2,12 @@ set -euo pipefail SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" +ROOT_DIR="$SCRIPT_DIR/../../.." # shellcheck source=scripts/lib/external_config.sh -source "$SCRIPT_DIR/../../../scripts/lib/external_config.sh" +source "$ROOT_DIR/scripts/lib/external_config.sh" # shellcheck source=scripts/lib/helm.sh -source "$SCRIPT_DIR/../../../scripts/lib/helm.sh" +source "$ROOT_DIR/scripts/lib/helm.sh" if [[ $# -ne 2 ]]; then echo "Usage: $0 [environment] [cluster]" >&2 @@ -19,8 +20,7 @@ ENVIRONMENT=$1 CLUSTER_NAME=$2 PROBE_IMAGE_ORG="rhacs-eng" PROBE_IMAGE_NAME="blackbox-monitoring-probe-service" -# Get HEAD for both main and production. This is the latest merged commit. -PROBE_IMAGE_TAG="$(git rev-parse --short=7 HEAD)" +PROBE_IMAGE_TAG="$(make -C "${ROOT_DIR}" tag)" PROBE_IMAGE="quay.io/${PROBE_IMAGE_ORG}/${PROBE_IMAGE_NAME}:${PROBE_IMAGE_TAG}" init_chamber @@ -57,9 +57,9 @@ if [[ $CLUSTER_ENVIRONMENT != "$ENVIRONMENT" ]]; then fi if [[ "${HELM_DRY_RUN:-}" == "true" ]]; then - "${SCRIPT_DIR}/../../../scripts/check_image_exists.sh" "${PROBE_IMAGE_ORG}" "${PROBE_IMAGE_NAME}" "${PROBE_IMAGE_TAG}" 0 || echo >&2 "Ignoring failed image check in dry-run mode." + "${ROOT_DIR}/scripts/check_image_exists.sh" "${PROBE_IMAGE_ORG}" "${PROBE_IMAGE_NAME}" "${PROBE_IMAGE_TAG}" 0 || echo >&2 "Ignoring failed image check in dry-run mode." else - "${SCRIPT_DIR}/../../../scripts/check_image_exists.sh" "${PROBE_IMAGE_ORG}" "${PROBE_IMAGE_NAME}" "${PROBE_IMAGE_TAG}" + "${ROOT_DIR}/scripts/check_image_exists.sh" "${PROBE_IMAGE_ORG}" "${PROBE_IMAGE_NAME}" "${PROBE_IMAGE_TAG}" fi load_external_config "cluster-${CLUSTER_NAME}" CLUSTER_ diff --git a/dp-terraform/helm/rhacs-terraform/terraform_cluster.sh b/dp-terraform/helm/rhacs-terraform/terraform_cluster.sh index edbc871b4c..17e6765fc9 100755 --- a/dp-terraform/helm/rhacs-terraform/terraform_cluster.sh +++ b/dp-terraform/helm/rhacs-terraform/terraform_cluster.sh @@ -2,11 +2,12 @@ set -euo pipefail SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" +ROOT_DIR="$SCRIPT_DIR/../../.." # shellcheck source=scripts/lib/external_config.sh -source "$SCRIPT_DIR/../../../scripts/lib/external_config.sh" +source "$ROOT_DIR/scripts/lib/external_config.sh" # shellcheck source=scripts/lib/helm.sh -source "$SCRIPT_DIR/../../../scripts/lib/helm.sh" +source "$ROOT_DIR/scripts/lib/helm.sh" if [[ $# -ne 2 ]]; then echo "Usage: $0 [environment] [cluster]" >&2 @@ -116,13 +117,12 @@ fi FLEETSHARD_SYNC_ORG="app-sre" FLEETSHARD_SYNC_IMAGE="acs-fleet-manager" -# Get HEAD for both main and production. This is the latest merged commit. -FLEETSHARD_SYNC_TAG="$(git rev-parse --short=7 HEAD)" +FLEETSHARD_SYNC_TAG="$(make -C "${ROOT_DIR}" tag)" if [[ "${HELM_DRY_RUN:-}" == "true" ]]; then - "${SCRIPT_DIR}/../../../scripts/check_image_exists.sh" "${FLEETSHARD_SYNC_ORG}" "${FLEETSHARD_SYNC_IMAGE}" "${FLEETSHARD_SYNC_TAG}" 0 || echo >&2 "Ignoring failed image check in dry-run mode." + "${ROOT_DIR}/scripts/check_image_exists.sh" "${FLEETSHARD_SYNC_ORG}" "${FLEETSHARD_SYNC_IMAGE}" "${FLEETSHARD_SYNC_TAG}" 0 || echo >&2 "Ignoring failed image check in dry-run mode." else - "${SCRIPT_DIR}/../../../scripts/check_image_exists.sh" "${FLEETSHARD_SYNC_ORG}" "${FLEETSHARD_SYNC_IMAGE}" "${FLEETSHARD_SYNC_TAG}" + "${ROOT_DIR}/scripts/check_image_exists.sh" "${FLEETSHARD_SYNC_ORG}" "${FLEETSHARD_SYNC_IMAGE}" "${FLEETSHARD_SYNC_TAG}" fi echo "Loading external config: audit-logs/${CLUSTER_NAME}" diff --git a/dp-terraform/ocm/install_addon.sh b/dp-terraform/ocm/install_addon.sh index fe2a7ed0ac..c0bd04e98f 100755 --- a/dp-terraform/ocm/install_addon.sh +++ b/dp-terraform/ocm/install_addon.sh @@ -2,9 +2,10 @@ set -euo pipefail SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" +ROOT_DIR="$SCRIPT_DIR/../.." # shellcheck source=scripts/lib/external_config.sh -source "$SCRIPT_DIR/../../scripts/lib/external_config.sh" +source "$ROOT_DIR/scripts/lib/external_config.sh" if [[ $# -ne 2 ]]; then echo "Usage: $0 [environment] [cluster]" >&2 @@ -89,13 +90,12 @@ fi FLEETSHARD_SYNC_ORG="app-sre" FLEETSHARD_SYNC_IMAGE="acs-fleet-manager" -# Get HEAD for both main and production. This is the latest merged commit. -FLEETSHARD_SYNC_TAG="$(git rev-parse --short=7 HEAD)" +FLEETSHARD_SYNC_TAG="$(make -C "${ROOT_DIR}" tag)" if [[ "${ADDON_DRY_RUN:-}" == "true" ]]; then - "${SCRIPT_DIR}/../../scripts/check_image_exists.sh" "${FLEETSHARD_SYNC_ORG}" "${FLEETSHARD_SYNC_IMAGE}" "${FLEETSHARD_SYNC_TAG}" 0 || echo >&2 "Ignoring failed image check in dry-run mode." + "${ROOT_DIR}/scripts/check_image_exists.sh" "${FLEETSHARD_SYNC_ORG}" "${FLEETSHARD_SYNC_IMAGE}" "${FLEETSHARD_SYNC_TAG}" 0 || echo >&2 "Ignoring failed image check in dry-run mode." else - "${SCRIPT_DIR}/../../scripts/check_image_exists.sh" "${FLEETSHARD_SYNC_ORG}" "${FLEETSHARD_SYNC_IMAGE}" "${FLEETSHARD_SYNC_TAG}" + "${ROOT_DIR}/scripts/check_image_exists.sh" "${FLEETSHARD_SYNC_ORG}" "${FLEETSHARD_SYNC_IMAGE}" "${FLEETSHARD_SYNC_TAG}" fi echo "Loading external config: audit-logs/${CLUSTER_NAME}"