diff --git a/hack/common.sh b/hack/common.sh index 2c7d5d8733..929a7a249f 100644 --- a/hack/common.sh +++ b/hack/common.sh @@ -15,6 +15,8 @@ GO_LINT_IMG="${GO_LINT_IMG:-${GO_LINT_IMG_LOCATION}:${GO_LINT_IMG_TAG}}" # Current DEV version of the CSV DEFAULT_CSV_VERSION="4.14.0" CSV_VERSION="${CSV_VERSION:-${DEFAULT_CSV_VERSION}}" +REPLACES_VERSION="${REPLACES_VERSION:-}" +SKIP_RANGE=">=0.0.1 <${CSV_VERSION}" VERSION="${VERSION:-${CSV_VERSION}}" LDFLAGS="-X github.com/red-hat-storage/ocs-operator/v4/version.Version=${CSV_VERSION}" diff --git a/hack/docker-common.sh b/hack/docker-common.sh index cb4fa0d8ad..df99b8caaf 100644 --- a/hack/docker-common.sh +++ b/hack/docker-common.sh @@ -14,5 +14,3 @@ if [ -z "$IMAGE_BUILD_CMD" ]; then echo -e '\033[1;31m' "podman or docker not found on system" '\033[0m' exit 1 fi - -IMAGE_RUN_CMD="${IMAGE_RUN_CMD:-${IMAGE_BUILD_CMD} run --rm -it}" diff --git a/hack/generate-latest-csv.sh b/hack/generate-latest-csv.sh index c654d3a7a0..2a653e7f46 100755 --- a/hack/generate-latest-csv.sh +++ b/hack/generate-latest-csv.sh @@ -4,28 +4,29 @@ set -e source hack/common.sh -export SKIP_MINIMUM="0.0.1" -export SKIP_RANGE=">=${SKIP_MINIMUM} <${CSV_VERSION}" - # Current dependency images our DEV CSV are pinned to +export OCS_IMAGE=${OCS_IMAGE:-${OPERATOR_FULL_IMAGE_NAME}} +export OCS_METRICS_EXPORTER_IMAGE=${OCS_METRICS_EXPORTER_IMAGE:-${METRICS_EXPORTER_FULL_IMAGE_NAME}} export ROOK_IMAGE=${ROOK_IMAGE:-${LATEST_ROOK_IMAGE}} +export CEPH_IMAGE=${CEPH_IMAGE:-${LATEST_CEPH_IMAGE}} export NOOBAA_CORE_IMAGE=${NOOBAA_CORE_IMAGE:-${LATEST_NOOBAA_CORE_IMAGE}} export NOOBAA_DB_IMAGE=${NOOBAA_DB_IMAGE:-${LATEST_NOOBAA_DB_IMAGE}} -export CEPH_IMAGE=${CEPH_IMAGE:-${LATEST_CEPH_IMAGE}} -export OCS_IMAGE=${OCS_IMAGE:-${OPERATOR_FULL_IMAGE_NAME}} -export OCS_METRICS_EXPORTER_IMAGE=${OCS_METRICS_EXPORTER_IMAGE:-${METRICS_EXPORTER_FULL_IMAGE_NAME}} -export OCS_MUST_GATHER_IMAGE=${OCS_MUST_GATHER_IMAGE:-${LATEST_MUST_GATHER_IMAGE}} export ROOK_CSIADDONS_IMAGE=${ROOK_CSIADDONS_IMAGE:-${LATEST_ROOK_CSIADDONS_IMAGE}} +export OCS_MUST_GATHER_IMAGE=${OCS_MUST_GATHER_IMAGE:-${LATEST_MUST_GATHER_IMAGE}} echo "=== Generating DEV CSV with the following vars ===" echo -e "\tCSV_VERSION=$CSV_VERSION" +echo -e "\tREPLACES_VERSION=$REPLACES_VERSION" +echo -e "\tSKIP_RANGE=$SKIP_RANGE" +echo -e "\tOCS_IMAGE=$OCS_IMAGE" +echo -e "\tOCS_METRICS_EXPORTER_IMAGE=$OCS_METRICS_EXPORTER_IMAGE" echo -e "\tROOK_IMAGE=$ROOK_IMAGE" echo -e "\tCEPH_IMAGE=$CEPH_IMAGE" echo -e "\tNOOBAA_CORE_IMAGE=$NOOBAA_CORE_IMAGE" echo -e "\tNOOBAA_DB_IMAGE=$NOOBAA_DB_IMAGE" -echo -e "\tOCS_IMAGE=$OCS_IMAGE" -echo -e "\tOCS_METRICS_EXPORTER_IMAGE=$OCS_METRICS_EXPORTER_IMAGE" -echo -e "\tOCS_MUST_GATHER_IMAGE=$OCS_MUST_GATHER_IMAGE" echo -e "\tROOK_CSIADDONS_IMAGE=$ROOK_CSIADDONS_IMAGE" +echo -e "\tOCS_MUST_GATHER_IMAGE=$OCS_MUST_GATHER_IMAGE" + +hack/source-manifests.sh hack/generate-unified-csv.sh diff --git a/hack/generate-unified-csv.sh b/hack/generate-unified-csv.sh index ef51e1f4d1..955e66436b 100755 --- a/hack/generate-unified-csv.sh +++ b/hack/generate-unified-csv.sh @@ -8,49 +8,24 @@ CSV_MERGER="tools/csv-merger/csv-merger" (cd tools/csv-merger/ && go build -ldflags="${LDFLAGS}") -function help_txt() { - echo "Environment Variables" - echo " OCS_IMAGE: (required) The ocs operator container image to integrate with" - echo " OCS_METRICS_EXPORTER_IMAGE: (required) The ocs metrics exporter container image to integrate with" - echo " NOOBAA_CORE_IMAGE: (required) The noobaa core container image to integrate with" - echo " NOOBAA_DB_IMAGE: (required) DB container image that is used by noobaa" - echo " ROOK_IMAGE: (required) The rook operator container image to integrate with" - echo " CEPH_IMAGE: (required) The ceph daemon container image to be deployed with storage clusters" - echo " CSV_VERSION: (required) The ocs-operator csv version that will be generated" - echo " REPLACES_CSV_VERSION (optional) The ocs-operator csv version this new csv will be updating" - echo " SKIP_RANGE (optional) The skip range value set for this csv" - echo " ROOK_CSI_CEPH_IMAGE (optional) Sets custom image env var on the rook deployment spec" - echo " ROOK_CSI_REGISTRAR_IMAGE (optional) Sets custom image env var on the rook deployment spec" - echo " ROOK_CSI_RESIZER_IMAGE (optional) Sets custom image env var on the rook deployment spec" - echo " ROOK_CSI_PROVISIONER_IMAGE (optional) Sets custom image env var on the rook deployment spec" - echo " ROOK_CSI_SNAPSHOTTER_IMAGE (optional) Sets custom image env var on the rook deployment spec" - echo " ROOK_CSI_ATTACHER_IMAGE (optional) Sets custom image env var on the rook deployment spec" - echo "" - echo "Example usage:" - echo " ROOK_IMAGE= CSV_VERSION= $0" -} - # check required env vars -if [ -z "$NOOBAA_CORE_IMAGE" ] || [ -z "$NOOBAA_DB_IMAGE" ] || \ - [ -z "$ROOK_IMAGE" ] || [ -z "$CSV_VERSION" ] || [ -z "$OCS_IMAGE" ] || [ -z "$OCS_METRICS_EXPORTER_IMAGE" ] || \ - [ -z "$CEPH_IMAGE" ]; then - help_txt - echo "" +if [ -z "$CSV_VERSION" ] || [ -z "$OCS_IMAGE" ] || [ -z "$OCS_METRICS_EXPORTER_IMAGE" ] || \ +[ -z "$ROOK_IMAGE" ] || [ -z "$CEPH_IMAGE" ] || [ -z "$NOOBAA_CORE_IMAGE" ] || [ -z "$NOOBAA_DB_IMAGE" ] \ +; then echo "ERROR: Missing required environment variables" exit 1 fi -hack/source-manifests.sh - # Merge component-level operators into ocs CSV $CSV_MERGER \ --csv-version="$CSV_VERSION" \ --replaces-csv-version="$REPLACES_CSV_VERSION" \ --skip-range="$SKIP_RANGE" \ - --rook-csv-filepath=$ROOK_CSV \ - --ocs-csv-filepath=$OCS_CSV \ + --ocs-image="$OCS_IMAGE" \ + --ocs-metrics-exporter-image="$OCS_METRICS_EXPORTER_IMAGE" \ --rook-image="$ROOK_IMAGE" \ --ceph-image="$CEPH_IMAGE" \ + --rook-csiaddons-image="$ROOK_CSIADDONS_IMAGE" \ --rook-csi-ceph-image="$ROOK_CSI_CEPH_IMAGE" \ --rook-csi-registrar-image="$ROOK_CSI_REGISTRAR_IMAGE" \ --rook-csi-resizer-image="$ROOK_CSI_RESIZER_IMAGE" \ @@ -59,11 +34,10 @@ $CSV_MERGER \ --rook-csi-attacher-image="$ROOK_CSI_ATTACHER_IMAGE" \ --noobaa-core-image="$NOOBAA_CORE_IMAGE" \ --noobaa-db-image="$NOOBAA_DB_IMAGE" \ - --ocs-image="$OCS_IMAGE" \ - --ocs-metrics-exporter-image="$OCS_METRICS_EXPORTER_IMAGE" \ --ocs-must-gather-image="$OCS_MUST_GATHER_IMAGE" \ + --rook-csv-filepath=$ROOK_CSV \ + --ocs-csv-filepath=$OCS_CSV \ --crds-directory="$CRDS_DIR" \ --manifests-directory=$EXTRA_MANIFESTS_DIR \ --olm-bundle-directory="$BUNDLE_MANIFESTS_DIR" \ - --timestamp="$TIMESTAMP" \ - --rook-csiaddons-image="$ROOK_CSIADDONS_IMAGE" + --timestamp="$TIMESTAMP" diff --git a/hack/source-manifests.sh b/hack/source-manifests.sh index e8494fcba9..3cf4f66bc2 100755 --- a/hack/source-manifests.sh +++ b/hack/source-manifests.sh @@ -1,23 +1,12 @@ #!/usr/bin/env bash -# example: ROOK_IMAGE=build-e858f56d/ceph-amd64:latest OCS_IMAGE=placeholder CSV_VERSION=1.1.1 hack/generate-manifests.sh - set -e source hack/common.sh - -function help_txt() { - echo "Environment Variables" - echo " ROOK_IMAGE: (required) The rook operator container image to integrate with" - echo "" - echo "Example usage:" - echo " ROOK_IMAGE= $0" -} +source hack/docker-common.sh # check required env vars -if [ -z "$ROOK_IMAGE" ]; then - help_txt - echo "" +if [ -z "$CSV_VERSION" ] || [ -z "$OCS_IMAGE" ] || [ -z "$ROOK_IMAGE" ]; then echo "ERROR: Missing required environment variables" exit 1 fi diff --git a/hack/verify-operator-bundle.sh b/hack/verify-operator-bundle.sh index 0afe3bd584..80e199dc04 100755 --- a/hack/verify-operator-bundle.sh +++ b/hack/verify-operator-bundle.sh @@ -4,4 +4,4 @@ set -e source hack/ensure-operator-sdk.sh -${OPERATOR_SDK} bundle validate "$(dirname $OCS_FINAL_DIR)" --verbose +${OPERATOR_SDK} bundle validate "$(dirname "$OCS_FINAL_DIR")" --verbose