From 0a2b18bdd5cc7b355a6b3df6f75affe18bce0b73 Mon Sep 17 00:00:00 2001 From: Melissa Date: Thu, 16 Nov 2023 07:27:44 -0800 Subject: [PATCH] Restructure common operators scripts --- .gitignore | 1 + .one-pipeline.yaml | 25 ++- Dockerfile.e2e | 2 +- Makefile | 34 +--- ebcDockerBuilderRCO.jenkinsfile | 4 +- scripts/e2e-release.sh | 131 -------------- scripts/e2e.sh | 182 -------------------- scripts/installers/install-go.sh | 40 ----- scripts/installers/install-manifest-tool.sh | 34 ---- scripts/installers/install-operator-sdk.sh | 43 ----- scripts/installers/install-opm.sh | 33 ---- scripts/installers/install-podman.sh | 26 --- 12 files changed, 23 insertions(+), 532 deletions(-) delete mode 100755 scripts/e2e-release.sh delete mode 100755 scripts/e2e.sh delete mode 100755 scripts/installers/install-go.sh delete mode 100755 scripts/installers/install-manifest-tool.sh delete mode 100755 scripts/installers/install-operator-sdk.sh delete mode 100755 scripts/installers/install-opm.sh delete mode 100755 scripts/installers/install-podman.sh diff --git a/.gitignore b/.gitignore index 846b0636b..3c6d80d0c 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ build/_test bin/controller-gen bin/kustomize bundle/tests/scorecard/kuttl/kubeconfig +operators vendor # Created by https://www.gitignore.io/api/go,vim,emacs,visualstudiocode ### Emacs ### diff --git a/.one-pipeline.yaml b/.one-pipeline.yaml index d491d016c..f7b63f197 100644 --- a/.one-pipeline.yaml +++ b/.one-pipeline.yaml @@ -8,12 +8,7 @@ setup: git clone --single-branch --branch $(get_env common-operators-branch) https://$(get_env git-token)@github.ibm.com/websphere/operators.git - cp operators/scripts/pipeline/* ./scripts/pipeline/ - cp -rf operators/scripts/build ./scripts/ - cp -rf operators/scripts/configure-cluster ./scripts - cp -rf operators/scripts/test ./scripts/ - - ./scripts/pipeline/code-setup-stage.sh + ./operators/scripts/pipeline/code-setup-stage.sh detect-secrets: image: icr.io/continuous-delivery/pipeline/pipeline-base-ubi:3.12 @@ -35,7 +30,7 @@ test: #!/usr/bin/env bash echo $STAGE - ./scripts/pipeline/unit-test-stage.sh + ./operators/scripts/pipeline/unit-test-stage.sh static-scan: dind: true @@ -45,7 +40,7 @@ static-scan: #!/usr/bin/env bash echo $STAGE - ./scripts/pipeline/static-scan-stage.sh + ./operators/scripts/pipeline/static-scan-stage.sh compliance-checks: image: icr.io/continuous-delivery/pipeline/pipeline-base-ubi:3.3 @@ -73,7 +68,7 @@ compliance-checks: #!/usr/bin/env bash echo $STAGE - ./scripts/pipeline/compliance-checks-stage.sh + ./operators/scripts/pipeline/compliance-checks-stage.sh containerize: dind: true @@ -86,7 +81,7 @@ containerize: # instruct bash to exit if any command fails set -e - ./scripts/pipeline/containerize-stage.sh + ./operators/scripts/pipeline/containerize-stage.sh sign-artifact: abort_on_failure: false @@ -95,7 +90,7 @@ sign-artifact: #!/usr/bin/env bash echo $STAGE - ./scripts/pipeline/sign-artifact-stage.sh + ./operators/scripts/pipeline/sign-artifact-stage.sh deploy: image: icr.io/continuous-delivery/pipeline/pipeline-base-ubi:3.12 @@ -113,7 +108,7 @@ dynamic-scan: #!/usr/bin/env bash echo $STAGE - ./scripts/pipeline/dynamic-scan-stage.sh + ./operators/scripts/pipeline/dynamic-scan-stage.sh acceptance-test: dind: true @@ -124,7 +119,7 @@ acceptance-test: echo $STAGE - ./scripts/pipeline/acceptance-test-stage.sh + ./operators/scripts/pipeline/acceptance-test-stage.sh scan-artifact: abort_on_failure: false @@ -133,7 +128,7 @@ scan-artifact: #!/usr/bin/env bash echo $STAGE - ./scripts/pipeline/scan-artifact-stage.sh + ./operators/scripts/pipeline/scan-artifact-stage.sh release: abort_on_failure: false @@ -142,4 +137,4 @@ release: #!/usr/bin/env bash echo $STAGE - ./scripts/pipeline/release-stage.sh \ No newline at end of file + ./operators/scripts/pipeline/release-stage.sh \ No newline at end of file diff --git a/Dockerfile.e2e b/Dockerfile.e2e index 2f3843d8e..a1d069efb 100644 --- a/Dockerfile.e2e +++ b/Dockerfile.e2e @@ -12,6 +12,6 @@ RUN wget --no-verbose --header "Accept: application/octet-stream" "https://golan COPY . . -RUN scripts/installers/install-operator-sdk.sh +RUN operators/scripts/installers/install-operator-sdk.sh CMD [ "bash" ] diff --git a/Makefile b/Makefile index 5e53a6536..48cd86a32 100644 --- a/Makefile +++ b/Makefile @@ -169,23 +169,11 @@ $(ENVTEST): $(LOCALBIN) .PHONY: setup setup: ## Ensure Operator SDK is installed. - ./scripts/installers/install-operator-sdk.sh ${OPERATOR_SDK_RELEASE_VERSION} + ./operators/scripts/installers/install-operator-sdk.sh ${OPERATOR_SDK_RELEASE_VERSION} .PHONY: setup-go setup-go: ## Ensure Go is installed. - ./scripts/installers/install-go.sh ${GO_RELEASE_VERSION} - -.PHONY: setup-manifest -setup-manifest: ## Install manifest tool. - ./scripts/installers/install-manifest-tool.sh - -# Install Podman. -install-podman: - ./scripts/installers/install-podman.sh - -# Install OPM. -install-opm: - ./scripts/installers/install-opm.sh + ./operators/scripts/installers/install-go.sh ${GO_RELEASE_VERSION} ##@ Development @@ -339,29 +327,25 @@ catalog-build: opm ## Build a catalog image. $(OPM) index add $(SKIP_TLS_VERIFY) --container-tool $(CONTAINER_COMMAND) --mode semver --tag $(CATALOG_IMG) --bundles $(BUNDLE_IMGS) $(FROM_INDEX_OPT) --permissive kind-e2e-test: - ./scripts/test/e2e-kind.sh --test-tag "${TRAVIS_BUILD_NUMBER}" + ./operators/scripts/test/e2e-kind.sh --test-tag "${TRAVIS_BUILD_NUMBER}" build-manifest: setup-manifest - ./scripts/build/build-manifest.sh --registry "${PUBLISH_REGISTRY}" --image "${OPERATOR_IMAGE}" --tag "${RELEASE_TARGET}" + ./operators/scripts/build/build-manifest.sh --registry "${PUBLISH_REGISTRY}" --image "${OPERATOR_IMAGE}" --tag "${RELEASE_TARGET}" build-operator-pipeline: - ./scripts/build/build-operator.sh --registry "${REGISTRY}" --image "${PIPELINE_OPERATOR_IMAGE}" --tag "${RELEASE_TARGET}" + ./operators/scripts/build/build-operator.sh --registry "${REGISTRY}" --image "${PIPELINE_OPERATOR_IMAGE}" --tag "${RELEASE_TARGET}" build-manifest-pipeline: - ./scripts/build/build-manifest.sh --registry "${REGISTRY}" --image "${IMAGE}" --tag "${RELEASE_TARGET}" + ./operators/scripts/build/build-manifest.sh --registry "${REGISTRY}" --image "${IMAGE}" --tag "${RELEASE_TARGET}" build-bundle-pipeline: - ./scripts/build/build-bundle.sh --prod-image "${PIPELINE_PRODUCTION_IMAGE}" --registry "${REGISTRY}" --image "${PIPELINE_OPERATOR_IMAGE}" --tag "${RELEASE_TARGET}" + ./operators/scripts/build/build-bundle.sh --prod-image "${PIPELINE_PRODUCTION_IMAGE}" --registry "${REGISTRY}" --image "${PIPELINE_OPERATOR_IMAGE}" --tag "${RELEASE_TARGET}" build-catalog-pipeline: opm ## Build a catalog image. - ./scripts/build/build-catalog.sh -n "v${OPM_VERSION}" -b "${REDHAT_BASE_IMAGE}" -o "${OPM}" --container-tool "docker" -r "${REGISTRY}" -i "${PIPELINE_OPERATOR_IMAGE}-bundle:${RELEASE_TARGET}" -p "${PIPELINE_PRODUCTION_IMAGE}-bundle" -a "${PIPELINE_OPERATOR_IMAGE}-catalog:${RELEASE_TARGET}" -t "${PWD}/operator-build" -v "${VERSION}" - -test-e2e: - ./scripts/e2e-release.sh --registry-name default-route --registry-namespace openshift-image-registry \ - --test-tag "${TRAVIS_BUILD_NUMBER}" --target "${RELEASE_TARGET}" + ./operators/scripts/build/build-catalog.sh -n "v${OPM_VERSION}" -b "${REDHAT_BASE_IMAGE}" -o "${OPM}" --container-tool "docker" -r "${REGISTRY}" -i "${PIPELINE_OPERATOR_IMAGE}-bundle:${RELEASE_TARGET}" -p "${PIPELINE_PRODUCTION_IMAGE}-bundle" -a "${PIPELINE_OPERATOR_IMAGE}-catalog:${RELEASE_TARGET}" -t "${PWD}/operator-build" -v "${VERSION}" test-pipeline-e2e: - ./scripts/test/e2e-ocp.sh -u "${DOCKER_USERNAME}" -p "${DOCKER_PASSWORD}" \ + ./operators/scripts/test/e2e-ocp.sh -u "${DOCKER_USERNAME}" -p "${DOCKER_PASSWORD}" \ --cluster-url "${CLUSTER_URL}" --cluster-user "${CLUSTER_USER}" --cluster-token "${CLUSTER_TOKEN}" \ --registry-name "${PIPELINE_REGISTRY}" --registry-image "${PIPELINE_OPERATOR_IMAGE}" \ --registry-user "${PIPELINE_USERNAME}" --registry-password "${PIPELINE_PASSWORD}" \ diff --git a/ebcDockerBuilderRCO.jenkinsfile b/ebcDockerBuilderRCO.jenkinsfile index 31157d24e..6ae9f04f8 100644 --- a/ebcDockerBuilderRCO.jenkinsfile +++ b/ebcDockerBuilderRCO.jenkinsfile @@ -92,7 +92,7 @@ def gitCloneAndStash() { git branch: "main", url: "git@github.ibm.com:websphere/operators.git" sh "git checkout ${COMMON_OPERATORS_BRANCH}" } - sh "cp -rf operators/scripts/build runtime-component-operator/scripts/" + sh "cp -rf operators runtime-component-operator/" dir('runtime-component-operator') { stash(name: 'runtime-component-operator') } @@ -105,7 +105,7 @@ def void doWork(){ // Unstash the git repo unstash(name: 'runtime-component-operator') - sh "./scripts/build/build-initialize.sh" + sh "./operators/scripts/build/build-initialize.sh" sh "${command}" } diff --git a/scripts/e2e-release.sh b/scripts/e2e-release.sh deleted file mode 100755 index a79fbd9fd..000000000 --- a/scripts/e2e-release.sh +++ /dev/null @@ -1,131 +0,0 @@ -#!/bin/bash - -######################################################################################### -# -# Script to run e2e tests for specified target. -# -######################################################################################### - -set -Eeo pipefail - -readonly usage="Usage: $0 -u -p --cluster-url --cluster-token --registry-name --registry-namespace --target " -readonly script_dir="$(dirname "$0")" -readonly release_blocklist="${script_dir}/release-blocklist.txt" - -main() { - parse_args "$@" - - if [[ -z "${TARGET}" ]]; then - echo "****** Missing target release for bundle build, see usage" - echo "${usage}" - exit 1 - fi - - if [[ -z "${RELEASE}" ]]; then - echo "****** Missing docker authentication information, see usage" - fi - - if [[ -z "${DOCKER_USERNAME}" || -z "${DOCKER_PASSWORD}" ]]; then - echo "****** Missing docker authentication information, see usage" - echo "${usage}" - exit 1 - fi - - if [[ -z "${CLUSTER_URL}" ]] || [[ -z "${CLUSTER_TOKEN}" ]]; then - echo "****** Missing OCP URL or token, see usage" - echo "${usage}" - exit 1 - fi - - if [[ -z "${REGISTRY_NAME}" ]] || [[ -z "${REGISTRY_NAMESPACE}" ]]; then - echo "****** Missing OCP registry name or registry namespace, see usage" - echo "${usage}" - exit 1 - fi - - if [[ -z "${TEST_TAG}" ]]; then - echo "****** Missing test tag, see usage" - echo "${usage}" - exit 1 - fi - - # Bundle target release(s) - if [[ "${TARGET}" != "releases" ]]; then - run_e2e "${TARGET}" - else - test_releases - fi -} - -run_e2e() { - local tag="${1}" - local release_tag="${tag//\./}" - "${script_dir}/e2e.sh" -u "${DOCKER_USERNAME}" -p "${DOCKER_PASSWORD}" \ - --cluster-url "${CLUSTER_URL}" --cluster-token "${CLUSTER_TOKEN}" \ - --registry-name "${REGISTRY_NAME}" --registry-namespace "${REGISTRY_NAMESPACE}" \ - --test-tag "${release_tag}-${TEST_TAG}" --release "${tag}" -} - -test_releases() { - tags="$(git tag -l)" - while read -r tag; do - if [[ -z "${tag}" ]]; then - break - fi - - # Skip any releases listed in the release blocklist - if grep -q "^${tag}$" "${release_blocklist}"; then - echo "Release ${tag} found in blocklist. Skipping..." - continue - fi - - run_e2e "${tag}" - done <<< "${tags}" -} - -parse_args() { - while [ $# -gt 0 ]; do - case "$1" in - -u) - shift - readonly DOCKER_USERNAME="${1}" - ;; - -p) - shift - readonly DOCKER_PASSWORD="${1}" - ;; - --cluster-url) - shift - readonly CLUSTER_URL="${1}" - ;; - --cluster-token) - shift - readonly CLUSTER_TOKEN="${1}" - ;; - --registry-name) - shift - readonly REGISTRY_NAME="${1}" - ;; - --registry-namespace) - shift - readonly REGISTRY_NAMESPACE="${1}" - ;; - --target) - shift - readonly TARGET="${1}" - ;; - --test-tag) - shift - readonly TEST_TAG="${1}" - ;; - *) - echo "Error: Invalid argument - $1" - echo "$usage" - exit 1 - ;; - esac - shift - done -} - -main "$@" diff --git a/scripts/e2e.sh b/scripts/e2e.sh deleted file mode 100755 index d63ed0eab..000000000 --- a/scripts/e2e.sh +++ /dev/null @@ -1,182 +0,0 @@ -#!/bin/bash - -readonly usage="Usage: e2e.sh -u -p --cluster-url --cluster-token --registry-name --registry-namespace --release --test-tag " -readonly SERVICE_ACCOUNT="travis-tests" -readonly OC_CLIENT_VERSION="latest-4.10" -readonly CONTROLLER_MANAGER_NAME="rco-controller-manager" - -# setup_env: Download oc cli, log into our persistent cluster, and create a test project -setup_env() { - echo "****** Installing OC CLI..." - # Install kubectl and oc - curl -L https://mirror.openshift.com/pub/openshift-v4/clients/ocp/${OC_CLIENT_VERSION}/openshift-client-linux.tar.gz | tar xvz - sudo mv oc kubectl /usr/local/bin/ - - # Start a cluster and login - echo "****** Logging into remote cluster..." - oc login "${CLUSTER_URL}" --token="${CLUSTER_TOKEN}" - - # Set variables for rest of script to use - readonly DEFAULT_REGISTRY=$(oc get route "${REGISTRY_NAME}" -o jsonpath="{ .spec.host }" -n "${REGISTRY_NAMESPACE}") - readonly TEST_NAMESPACE="rco-test-${TRAVIS_BUILD_NUMBER}" - readonly BUILD_IMAGE=${DEFAULT_REGISTRY}/${TEST_NAMESPACE}/operator - readonly BUNDLE_IMAGE="${DEFAULT_REGISTRY}/${TEST_NAMESPACE}/operator-bundle:latest" - - echo "****** Creating test namespace ${TEST_NAMESPACE} for release ${RELEASE}" - oc new-project "${TEST_NAMESPACE}" || oc project "${TEST_NAMESPACE}" - - ## Switch to release branch - if [[ "${RELEASE}" != "daily" ]]; then - git checkout -q "${RELEASE}" - fi - - ## Create service account for Kuttl tests - oc apply -f config/rbac/kuttl-rbac.yaml -} - -## cleanup_env : Delete generated resources that are not bound to a test TEST_NAMESPACE. -cleanup_env() { - oc delete project "${TEST_NAMESPACE}" -} - -push_images() { - echo "****** Logging into private registry..." - oc sa get-token "${SERVICE_ACCOUNT}" -n default | docker login -u unused --password-stdin "${DEFAULT_REGISTRY}" || { - echo "Failed to log into docker registry as ${SERVICE_ACCOUNT}, exiting..." - exit 1 - } - - echo "****** Creating pull secret using Docker config..." - oc create secret generic regcred --from-file=.dockerconfigjson="${HOME}/.docker/config.json" --type=kubernetes.io/dockerconfigjson - - docker push "${BUILD_IMAGE}" || { - echo "Failed to push ref: ${BUILD_IMAGE} to docker registry, exiting..." - exit 1 - } - - docker push "${BUNDLE_IMAGE}" || { - echo "Failed to push ref: ${BUNDLE_IMAGE} to docker registry, exiting..." - exit 1 - } -} - -main() { - parse_args "$@" - - if [[ -z "${RELEASE}" ]]; then - echo "****** Missing release, see usage" - fi - - if [[ -z "${DOCKER_USERNAME}" || -z "${DOCKER_PASSWORD}" ]]; then - echo "****** Missing docker authentication information, see usage" - echo "${usage}" - exit 1 - fi - - if [[ -z "${CLUSTER_URL}" ]] || [[ -z "${CLUSTER_TOKEN}" ]]; then - echo "****** Missing OCP URL or token, see usage" - echo "${usage}" - exit 1 - fi - - if [[ -z "${REGISTRY_NAME}" ]] || [[ -z "${REGISTRY_NAMESPACE}" ]]; then - echo "****** Missing OCP registry name or registry namespace, see usage" - echo "${usage}" - exit 1 - fi - - if [[ -z "${TEST_TAG}" ]]; then - echo "****** Missing test tag, see usage" - echo "${usage}" - exit 1 - fi - - echo "****** Setting up test environment..." - setup_env - - ## login to docker to avoid rate limiting during build - echo "${DOCKER_PASSWORD}" | docker login -u "${DOCKER_USERNAME}" --password-stdin - - echo "****** Building image" - docker build -t "${BUILD_IMAGE}" . - - echo "****** Building bundle..." - IMG="${BUILD_IMAGE}" BUNDLE_IMG="${BUNDLE_IMAGE}" make kustomize bundle bundle-build - - echo "****** Pushing operator and operator bundle images into registry..." - push_images - - echo "****** Installing bundle..." - operator-sdk run bundle --install-mode OwnNamespace --pull-secret-name regcred "${BUNDLE_IMAGE}" --timeout 5m || { - echo "****** Installing bundle failed..." - exit 1 - } - - # Wait for operator deployment to be ready - while [[ $(oc get deploy "${CONTROLLER_MANAGER_NAME}" -o jsonpath='{ .status.readyReplicas }') -ne "1" ]]; do - echo "****** Waiting for ${CONTROLLER_MANAGER_NAME} to be ready..." - sleep 10 - done - - echo "****** ${CONTROLLER_MANAGER_NAME} deployment is ready..." - - echo "****** Starting scorecard tests..." - operator-sdk scorecard --verbose --selector=suite=kuttlsuite --namespace "${TEST_NAMESPACE}" --service-account scorecard-kuttl --wait-time 30m ./bundle || { - echo "****** Scorecard tests failed..." - exit 1 - } - result=$? - - echo "****** Cleaning up test environment..." - cleanup_env - - return $result -} - -parse_args() { - while [ $# -gt 0 ]; do - case "$1" in - -u) - shift - readonly DOCKER_USERNAME="${1}" - ;; - -p) - shift - readonly DOCKER_PASSWORD="${1}" - ;; - --cluster-url) - shift - readonly CLUSTER_URL="${1}" - ;; - --cluster-token) - shift - readonly CLUSTER_TOKEN="${1}" - ;; - --registry-name) - shift - readonly REGISTRY_NAME="${1}" - ;; - --registry-namespace) - shift - readonly REGISTRY_NAMESPACE="${1}" - ;; - --release) - shift - readonly RELEASE="${1}" - ;; - --test-tag) - shift - readonly TEST_TAG="${1}" - ;; - *) - echo "Error: Invalid argument - $1" - echo "$usage" - exit 1 - ;; - esac - shift - done -} - -main "$@" - diff --git a/scripts/installers/install-go.sh b/scripts/installers/install-go.sh deleted file mode 100755 index 68ae2c9c5..000000000 --- a/scripts/installers/install-go.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/bash - -set -o errexit - -main() { - DEFAULT_RELEASE_VERSION="$(grep '^go [0-9]\+.[0-9]\+' go.mod | cut -d ' ' -f 2)" - RELEASE_VERSION=$(wget --no-verbose "https://go.dev/dl/?mode=json&include=$DEFAULT_RELEASE_VERSION" -O - | jq '.[0].version' | sed -e 's#"##g') - if [ -n "$1" ]; then - RELEASE_VERSION="go$1" - fi - - if [[ -x "$(command -v go)" ]]; then - if go version | grep -q "$RELEASE_VERSION"; then - go version - exit 0 - else - echo "****** Another go version detected" - fi - fi - - - if [[ "$(uname)" = "Darwin" ]]; then - binary_url="https://golang.org/dl/${RELEASE_VERSION}.darwin-amd64.tar.gz" - elif [[ "$(uname -p)" = "s390x" ]]; then - binary_url="https://golang.org/dl/${RELEASE_VERSION}.linux-s390x.tar.gz" - elif [[ "$(uname -p)" = "ppc64le" ]]; then - binary_url="https://golang.org/dl/${RELEASE_VERSION}.linux-ppc64le.tar.gz" - else - binary_url="https://golang.org/dl/${RELEASE_VERSION}.linux-amd64.tar.gz" - fi - - echo "****** Installing Go version $RELEASE_VERSION on $(uname)" - - rm -rf /usr/local/go && wget --no-verbose --header "Accept: application/octet-stream" "${binary_url}" -O - | tar -xz -C /usr/local/ - export PATH=$PATH:/usr/local/go/bin - - go version -} - -main "$@" diff --git a/scripts/installers/install-manifest-tool.sh b/scripts/installers/install-manifest-tool.sh deleted file mode 100755 index 9896d61dd..000000000 --- a/scripts/installers/install-manifest-tool.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash - -set -o errexit -set -o nounset - -main() { - if [[ -x "$(command -v manifest-tool)" ]]; then - manifest-tool --version - exit 0 - fi - - DEFAULT_RELEASE=v1.0.2 - RELEASE_VERSION=${1:-$DEFAULT_RELEASE} - - ## Define current arc variable - case "$(uname -p)" in - "ppc64le") - readonly arch="ppc64le" - ;; - "s390x") - readonly arch="s390x" - ;; - *) - readonly arch="amd64" - ;; - esac - - echo "****** Installing manifest-tool version ${RELEASE_VERSION} on $(uname)" - wget "https://github.com/estesp/manifest-tool/releases/download/${RELEASE_VERSION}/manifest-tool-linux-${arch}" -O manifest-tool - chmod +x manifest-tool - sudo mv manifest-tool /usr/local/bin/manifest-tool -} - -main $@ diff --git a/scripts/installers/install-operator-sdk.sh b/scripts/installers/install-operator-sdk.sh deleted file mode 100755 index 434798ba3..000000000 --- a/scripts/installers/install-operator-sdk.sh +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/bash - -set -o errexit -set -o nounset - -main() { - DEFAULT_RELEASE_VERSION=v1.27.0 - RELEASE_VERSION=${1:-$DEFAULT_RELEASE_VERSION} - - if [[ -x "$(command -v operator-sdk)" ]]; then - if operator-sdk version | grep -q "$RELEASE_VERSION"; then - operator-sdk version - exit 0 - else - echo "****** Another operator-sdk version detected" - fi - fi - - ## doesn't support zLinux yet - if [[ $(uname -p) = "s390x" ]]; then - echo "****** zLinux build detected, skipping operator-sdk install" - exit 0 - fi - - if [[ "$(uname)" = "Darwin" ]]; then - binary_url="https://github.com/operator-framework/operator-sdk/releases/download/$RELEASE_VERSION/operator-sdk_darwin_amd64" - elif [[ "$(uname -p)" = "ppc64le" ]]; then - binary_url="https://github.com/operator-framework/operator-sdk/releases/download/$RELEASE_VERSION/operator-sdk_linux_ppc64le" - elif [[ "$(uname -p)" = "s390x" ]]; then - binary_url="https://github.com/operator-framework/operator-sdk/releases/download/$RELEASE_VERSION/operator-sdk_linux_s390x" - else - binary_url="https://github.com/operator-framework/operator-sdk/releases/download/$RELEASE_VERSION/operator-sdk_linux_amd64" - fi - - echo "****** Installing operator-sdk version $RELEASE_VERSION on $(uname)" - curl -L -o operator-sdk "${binary_url}" - chmod +x operator-sdk - sudo mv operator-sdk /usr/local/bin/operator-sdk - - operator-sdk version -} - -main "$@" diff --git a/scripts/installers/install-opm.sh b/scripts/installers/install-opm.sh deleted file mode 100755 index 7df53567b..000000000 --- a/scripts/installers/install-opm.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/bash - -set -o errexit -set -o nounset - -main() { - if [[ -x "$(command -v opm)" ]]; then - opm version - exit 0 - fi - - readonly DEFAULT_RELEASE_VERSION=latest-4.12 - readonly RELEASE_VERSION=${1:-$DEFAULT_RELEASE_VERSION} - readonly base_url="https://mirror.openshift.com/pub/openshift-v4/x86_64/clients/ocp/${RELEASE_VERSION}" - - if [[ "$(uname)" = "Darwin" ]]; then - binary_url="${base_url}/opm-mac.tar.gz" - elif [[ "$(uname)" = "Linux" ]]; then - binary_url="${base_url}/opm-linux.tar.gz" - else - echo "****** opm installer only supports Linux and macOS systems. Skipping..." - exit 0 - fi - - echo "****** Installing opm version ${RELEASE_VERSION} on $(uname)" - curl -L "${binary_url}" | tar xvz - chmod +x opm - sudo mv opm /usr/local/bin/opm - - opm version -} - -main "$@" diff --git a/scripts/installers/install-podman.sh b/scripts/installers/install-podman.sh deleted file mode 100755 index 01f024c30..000000000 --- a/scripts/installers/install-podman.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash - -set -o errexit -set -o nounset - -main() { - if [[ -x "$(command -v podman)" ]]; then - podman version - exit 0 - fi - - if [[ "$(lsb_release -i --short)" != "Ubuntu" ]]; then - echo "Installer only works on Ubuntu" - exit 1 - fi - - . /etc/os-release - echo "deb https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_${VERSION_ID}/ /" | sudo tee /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list - curl -L "https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_${VERSION_ID}/Release.key" | sudo apt-key add - - sudo apt-get update - sudo apt-get -y install podman - - podman version -} - -main "$@"