This is an automated email from the ASF dual-hosted git repository.

houston pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/solr-operator.git


The following commit(s) were added to refs/heads/main by this push:
     new 84a7781  Ability to easily run smoke-tester (#434)
84a7781 is described below

commit 84a7781e498a92a66d62eac2a3515c1646bd5ce6
Author: Houston Putman <[email protected]>
AuthorDate: Tue Apr 12 11:16:10 2022 -0400

    Ability to easily run smoke-tester (#434)
    
    Smoke tests can now be ran with "make smoke-test" which will skip the GPG 
checking unless the environment option "GPG_KEY" is provided.
---
 .../workflows/{docker.yaml => smoke-tests.yaml}    | 32 +++++++++--
 .github/workflows/tests.yaml                       |  1 +
 Makefile                                           |  9 +++-
 hack/release/artifacts/build_helm.sh               |  2 +-
 hack/release/artifacts/bundle_source.sh            |  2 +-
 hack/release/artifacts/create_artifacts.sh         | 10 ++--
 hack/release/artifacts/create_crds.sh              |  2 +-
 hack/release/smoke_test/smoke_test.sh              | 26 ++++-----
 hack/release/smoke_test/test_cluster.sh            | 62 ++++++++++++++--------
 hack/release/smoke_test/test_source.sh             |  2 +-
 hack/release/smoke_test/verify_all.sh              | 33 +++++++-----
 hack/release/smoke_test/verify_docker.sh           | 11 +++-
 12 files changed, 128 insertions(+), 64 deletions(-)

diff --git a/.github/workflows/docker.yaml b/.github/workflows/smoke-tests.yaml
similarity index 56%
rename from .github/workflows/docker.yaml
rename to .github/workflows/smoke-tests.yaml
index 19993ad..07c7a61 100644
--- a/.github/workflows/docker.yaml
+++ b/.github/workflows/smoke-tests.yaml
@@ -13,23 +13,47 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-name: Docker Build
+name: Build Artifacts and Smoke Test
 
 on:
   pull_request:
     branches:
       - 'main'
+      - 'release-*'
+    paths-ignore:
+      - '.github/workflows/**'
+      - '!.github/workflows/smoke-tests.yml'
+      - 'dev-docs/**'
+      - 'docs/**'
+      - 'example/**'
+      - 'hack/release/upload/**'
+      - 'hack/release/version/**'
+      - 'hack/release/wizard/**'
+      - '.gitignore'
+      - '.asf.yaml'
+      - 'README.md'
+      - 'CONTRIBUTING.md'
+      - 'LICENSE'
+      - 'NOTICE'
 
 jobs:
   test:
-    name: Build Docker Image
+    name: Smoke Test Artifacts
 
     runs-on: ubuntu-latest
 
+    strategy:
+      matrix:
+        go: [ '1.17' ]
+
     steps:
       # Setup
       - uses: actions/checkout@v2
+      - name: Setup go
+        uses: actions/setup-go@v2
+        with:
+          go-version: ${{ matrix.go }}
 
-      # Cleanup & Install dependencies
+      # Build the release artifacts, and run a full smoke test (minus 
signatures)
       - run: docker --version
-      - run: make docker-build
+      - run: make smoke-test
diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml
index 9211af3..093c187 100644
--- a/.github/workflows/tests.yaml
+++ b/.github/workflows/tests.yaml
@@ -19,6 +19,7 @@ on:
   pull_request:
     branches:
       - 'main'
+      - 'release-*'
 
 jobs:
   test:
diff --git a/Makefile b/Makefile
index 178631f..98fd833 100644
--- a/Makefile
+++ b/Makefile
@@ -113,7 +113,7 @@ fetch-licenses-full: go-licenses ## Fetch all licenses
        $(GO_LICENSES) save . --save_path licenses --force
 
 build-release-artifacts: clean prepare docker-build ## Build all release 
artifacts for the Solr Operator
-       ./hack/release/artifacts/create_artifacts.sh -d $(or 
$(ARTIFACTS_DIR),release-artifacts)
+       ./hack/release/artifacts/create_artifacts.sh -d $(or 
$(ARTIFACTS_DIR),release-artifacts) -v $(VERSION)
 
 ##@ Build
 
@@ -158,6 +158,13 @@ undeploy: prepare-deploy-kustomize ## Undeploy controller 
from the K8s cluster s
 
 ##@ Tests and Checks
 
+smoke-test: build-release-artifacts ## Run a full smoke test on a set of local 
release artifacts, based on the current working directory.
+       ./hack/release/smoke_test/smoke_test.sh \
+               -l $(or $(ARTIFACTS_DIR),release-artifacts) \
+               -v $(VERSION) \
+               -i "${IMG}:${TAG}" \
+               -s $(GIT_SHA)
+
 check: lint test ## Do all checks, lints and tests for the Solr Operator
 
 lint: check-zk-op-version check-mod vet check-format check-licenses 
check-manifests check-generated check-helm ## Lint the codebase to check for 
formatting and correctness
diff --git a/hack/release/artifacts/build_helm.sh 
b/hack/release/artifacts/build_helm.sh
index 445a736..527a94d 100755
--- a/hack/release/artifacts/build_helm.sh
+++ b/hack/release/artifacts/build_helm.sh
@@ -56,7 +56,7 @@ done
 shift "$((OPTIND-1))"   # Discard the options and sentinel --
 
 if [[ -z "${VERSION:-}" ]]; then
-  VERSION=$(make version)
+  VERSION=$(make -s version)
 fi
 if [[ -z "${ARTIFACTS_DIR:-}" ]]; then
   echo "Specify an base artifact directory -d, or through the ARTIFACTS_DIR 
env var" >&2 && exit 1
diff --git a/hack/release/artifacts/bundle_source.sh 
b/hack/release/artifacts/bundle_source.sh
index 3f797e1..18ca762 100755
--- a/hack/release/artifacts/bundle_source.sh
+++ b/hack/release/artifacts/bundle_source.sh
@@ -53,7 +53,7 @@ done
 shift "$((OPTIND-1))"   # Discard the options and sentinel --
 
 if [[ -z "${VERSION:-}" ]]; then
-  VERSION=$(make version)
+  VERSION=$(make -s version)
 fi
 if [[ -z "${ARTIFACTS_DIR:-}" ]]; then
   echo "Specify an base artifact directory -d, or through the ARTIFACTS_DIR 
env var" >&2 && exit 1
diff --git a/hack/release/artifacts/create_artifacts.sh 
b/hack/release/artifacts/create_artifacts.sh
index f9ce593..b66555b 100755
--- a/hack/release/artifacts/create_artifacts.sh
+++ b/hack/release/artifacts/create_artifacts.sh
@@ -59,7 +59,7 @@ done
 shift "$((OPTIND-1))"   # Discard the options and sentinel --
 
 if [[ -z "${VERSION:-}" ]]; then
-  VERSION=$(make version)
+  VERSION=$(make -s version)
 fi
 if [[ -z "${ARTIFACTS_DIR:-}" ]]; then
   echo "Specify an base artifact directory -d, or through the ARTIFACTS_DIR 
env var" >&2 && exit 1
@@ -90,8 +90,8 @@ echo "Setting up Solr Operator ${VERSION} release artifacts 
at '${ARTIFACTS_DIR}
 
       for artifact in $(find * -type f -maxdepth 0 ! \( -name '*.asc' -o -name 
'*.sha512' -o -name '*.prov' \) ); do
         echo "Signing ${artifact_directory}/${artifact}"
-        if [ ! -f "${artifact}.asc" ]; then
-          gpg "${GPG_USER[@]}" -ab "${artifact}"
+        if [[ -n "${GPG_KEY:-}" ]] && [ ! -f "${artifact}.asc" ]; then
+          gpg -u "${GPG_KEY}" -ab "${artifact}"
         fi
         if [ ! -f "${artifact}.sha512" ]; then
           sha512sum -b "${artifact}" > "${artifact}.sha512"
@@ -102,8 +102,8 @@ echo "Setting up Solr Operator ${VERSION} release artifacts 
at '${ARTIFACTS_DIR}
 
   for artifact in $(find * -type f -maxdepth 0 ! \( -name '*.asc' -o -name 
'*.sha512' -o -name '*.prov' \) ); do
     echo "Signing ${artifact}"
-    if [ ! -f "${artifact}.asc" ]; then
-      gpg "${GPG_USER[@]}" -ab "${artifact}"
+    if [[ -n "${GPG_KEY:-}" ]] && [ ! -f "${artifact}.asc" ]; then
+      gpg -u "${GPG_KEY}" -ab "${artifact}"
     fi
     if [ ! -f "${artifact}.sha512" ]; then
       sha512sum -b "${artifact}" > "${artifact}.sha512"
diff --git a/hack/release/artifacts/create_crds.sh 
b/hack/release/artifacts/create_crds.sh
index 894dba3..a033586 100755
--- a/hack/release/artifacts/create_crds.sh
+++ b/hack/release/artifacts/create_crds.sh
@@ -53,7 +53,7 @@ done
 shift "$((OPTIND-1))"   # Discard the options and sentinel --
 
 if [[ -z "${VERSION:-}" ]]; then
-  VERSION=$(make version)
+  VERSION=$(make -s version)
 fi
 if [[ -z "${ARTIFACTS_DIR:-}" ]]; then
   echo "Specify an base artifact directory -d, or through the ARTIFACTS_DIR 
env var" >&2 && exit 1
diff --git a/hack/release/smoke_test/smoke_test.sh 
b/hack/release/smoke_test/smoke_test.sh
index 442ee95..60e8b40 100755
--- a/hack/release/smoke_test/smoke_test.sh
+++ b/hack/release/smoke_test/smoke_test.sh
@@ -23,18 +23,18 @@ set -u
 
 show_help() {
 cat << EOF
-Usage: ./hack/release/smoke_test/smoke_test.sh [-h] [-i IMAGE] [-s GIT_SHA] 
[-k KUBERNETES_VERSION] [-t SOLR_VERSION] -v VERSION -l LOCATION -g GPG_KEY
+Usage: ./hack/release/smoke_test/smoke_test.sh [-h] [-i IMAGE] [-s GIT_SHA] 
[-k KUBERNETES_VERSION] [-t SOLR_VERSION] [-g GPG_KEY] -v VERSION -l LOCATION
 
 Smoke test the Solr Operator release artifacts.
 
     -h  Display this help and exit
     -v  Version of the Solr Operator
+    -l  Base location of the staged artifacts. Can be a URL or relative or 
absolute file path.
     -i  Solr Operator Docker image to use  (Optional, defaults to 
apache/solr-operator:<version>)
     -s  GitSHA of the last commit for this version of Solr (Optional, check 
will not happen if not provided)
-    -l  Base location of the staged artifacts. Can be a URL or relative or 
absolute file path.
-    -g  GPG Key (fingerprint) used to sign the artifacts
+    -g  GPG Key (fingerprint) used to sign the artifacts (Optional, will not 
check signatures if not provided)
     -k  Kubernetes Version to test with (Optional, defaults to a compatible 
version)
-    -t  Solr Version to test with (Optional, defaults to a compatible version)
+    -t  Solr Image (or version/tag of the official Solr image) to test with 
(Optional, defaults to a compatible version)
 EOF
 }
 
@@ -57,7 +57,7 @@ while getopts hv:i:l:s:g:k:t: opt; do
             ;;
         k)  KUBERNETES_VERSION=$OPTARG
             ;;
-        t)  SOLR_VERSION=$OPTARG
+        t)  SOLR_IMAGE=$OPTARG
             ;;
         *)
             show_help >&2
@@ -76,14 +76,16 @@ fi
 if [[ -z "${LOCATION:-}" ]]; then
   echo "Specify an base artifact location -l, or through the LOCATION env var" 
>&2 && exit 1
 fi
-if [[ -z "${GPG_KEY:-}" ]]; then
-  echo "Specify a gpg key fingerprint through -g, or through the GPG_KEY env 
var" >&2 && exit 1
-fi
+
+# Pass through the following options to child scripts, if they were given
 if [[ -n "${KUBERNETES_VERSION:-}" ]]; then
   export KUBERNETES_VERSION="${KUBERNETES_VERSION}"
 fi
-if [[ -n "${SOLR_VERSION:-}" ]]; then
-  export SOLR_VERSION="${SOLR_VERSION}"
+if [[ -n "${SOLR_IMAGE:-}" ]]; then
+  export SOLR_IMAGE="${SOLR_IMAGE}"
+fi
+if [[ -n "${GPG_KEY:-}" ]]; then
+  export GPG_KEY="${GPG_KEY}"
 fi
 
 PULL_PASS_THROUGH=""
@@ -103,9 +105,9 @@ if [[ -z "${GOBIN:-}" ]]; then
 fi
 export PATH="${PATH}:${GOBIN}"
 
-./hack/release/smoke_test/verify_all.sh -v "${VERSION}" -l "${LOCATION}" -g 
"${GPG_KEY}"
+./hack/release/smoke_test/verify_all.sh -v "${VERSION}" -l "${LOCATION}"
 ./hack/release/smoke_test/verify_docker.sh -v "${VERSION}" -i "${IMAGE}" 
"${GIT_SHA_PASS_THROUGH[@]}" "${PULL_PASS_THROUGH}"
 ./hack/release/smoke_test/test_source.sh -v "${VERSION}" -l "${LOCATION}"
-./hack/release/smoke_test/test_cluster.sh -v "${VERSION}" -i "${IMAGE}" -l 
"${LOCATION}" -g "${GPG_KEY}"
+./hack/release/smoke_test/test_cluster.sh -v "${VERSION}" -i "${IMAGE}" -l 
"${LOCATION}"
 
 printf "\n\n********************\nSuccessfully smoke tested the Solr Operator 
%s!\n" "${VERSION}"
diff --git a/hack/release/smoke_test/test_cluster.sh 
b/hack/release/smoke_test/test_cluster.sh
index a4473ca..2f950eb 100755
--- a/hack/release/smoke_test/test_cluster.sh
+++ b/hack/release/smoke_test/test_cluster.sh
@@ -23,17 +23,17 @@ set -u
 
 show_help() {
 cat << EOF
-Usage: ./hack/release/smoke_test/test_cluster.sh [-h] [-i IMAGE] [-k 
KUBERNETES_VERSION] [-t SOLR_VERSION] -v VERSION -l LOCATION -g GPG_KEY
+Usage: ./hack/release/smoke_test/test_cluster.sh [-h] [-i IMAGE] [-k 
KUBERNETES_VERSION] [-t SOLR_IMAGE] [-g GPG_KEY] -v VERSION -l LOCATION
 
 Test the release candidate in a Kind cluster
 
     -h  Display this help and exit
     -v  Version of the Solr Operator
-    -i  Solr Operator docker image to use  (Optional, defaults to 
apache/solr-operator:<version>)
     -l  Base location of the staged artifacts. Can be a URL or relative or 
absolute file path.
-    -g  GPG Key (fingerprint) used to sign the artifacts
-    -k  Kubernetes Version to test with (full tag, e.g. v1.21.2)
-    -t  Solr Version, or image, to test with (full tag, e.g. 8.10.0)
+    -i  Solr Operator docker image to use (Optional, defaults to 
apache/solr-operator:<version>)
+    -g  GPG Key (fingerprint) used to sign the artifacts (Optional, if not 
provided then the helm chart will not be verified)
+    -k  Kubernetes Version to test with (full tag, e.g. v1.21.2) (Optional, 
defaults to a compatible version)
+    -t  Full solr image, or image tag (for the official Solr image), to test 
with (e.g. apache/solr-nightly:9.0.0, 8.11). (Optional, defaults to a 
compatible version)
 EOF
 }
 
@@ -54,7 +54,7 @@ while getopts hv:i:l:g:k:t: opt; do
             ;;
         k)  KUBERNETES_VERSION=$OPTARG
             ;;
-        t)  SOLR_VERSION=$OPTARG
+        t)  SOLR_IMAGE=$OPTARG
             ;;
         *)
             show_help >&2
@@ -73,14 +73,14 @@ fi
 if [[ -z "${LOCATION:-}" ]]; then
   echo "Specify an base artifact location -l, or through the LOCATION env var" 
>&2 && exit 1
 fi
-if [[ -z "${GPG_KEY:-}" ]]; then
-  echo "Specify a gpg key fingerprint through -g, or through the GPG_KEY env 
var" >&2 && exit 1
-fi
 if [[ -z "${KUBERNETES_VERSION:-}" ]]; then
   KUBERNETES_VERSION="v1.21.2"
 fi
-if [[ -z "${SOLR_VERSION:-}" ]]; then
-  SOLR_VERSION="8.11.1"
+if [[ -z "${SOLR_IMAGE:-}" ]]; then
+  SOLR_IMAGE="${SOLR_VERSION:-8.11}"
+fi
+if [[ "${SOLR_IMAGE}" != *":"* ]]; then
+  SOLR_IMAGE="solr:${SOLR_IMAGE}"
 fi
 
 # If LOCATION is not a URL, then get the absolute path
@@ -117,8 +117,19 @@ fi
 echo "Create test Kubernetes ${KUBERNETES_VERSION} cluster in Kind. This will 
allow us to test the CRDs, Helm chart and the Docker image."
 kind create cluster --name "${CLUSTER_NAME}" --image 
"kindest/node:${KUBERNETES_VERSION}"
 
-# Load the docker image into the cluster
-kind load docker-image --name "${CLUSTER_NAME}" "${IMAGE}"
+# Load the docker images into the cluster
+if (docker image inspect "${IMAGE}" &>/dev/null); then
+  kind load docker-image --name "${CLUSTER_NAME}" "${IMAGE}"
+  printf "\nUsing local version of Solr Operator image \"${IMAGE}\".\nIf you 
want to use an updated version of this image, run \"docker pull ${SOLR_IMAGE}\" 
before running the smoke test again.\n\n"
+else
+  printf "\nUsing the remote Solr Operator image \"${IMAGE}\", since it was 
not found in the local Docker image list.\n\n"
+fi
+if (docker image inspect "${SOLR_IMAGE}" &>/dev/null); then
+  kind load docker-image --name "${CLUSTER_NAME}" "${SOLR_IMAGE}"
+  printf "\nUsing local version of Solr image \"${SOLR_IMAGE}\".\nIf you want 
to use an updated version of this image, run \"docker pull ${SOLR_IMAGE}\" 
before running the smoke test again.\n\n"
+else
+  printf "\nUsing the remote Solr image \"${SOLR_IMAGE}\", since it was not 
found in the local Docker image list.\n\n"
+fi
 
 # Add a temporary directory for backups
 docker exec "${CLUSTER_NAME}-control-plane" bash -c "mkdir -p /tmp/backup"
@@ -126,21 +137,28 @@ docker exec "${CLUSTER_NAME}-control-plane" bash -c 
"mkdir -p /tmp/backup"
 echo "Import Solr Keys"
 curl -sL0 "https://dist.apache.org/repos/dist/release/solr/KEYS"; | gpg 
--import --quiet
 
-# First generate the old-style public key ring, if it doesn't already exist 
and contain the information we want
-if ! (gpg --no-default-keyring --keyring=~/.gnupg/pubring.gpg --list-keys 
"${GPG_KEY}"); then
-  gpg --export >~/.gnupg/pubring.gpg
+# First generate the old-style public key ring, if it doesn't already exist 
and contain the information we want.
+# Only do this if a GPG Key was provided
+VERIFY_OR_NOT=""
+if [[ -n "${GPG_KEY:-}" ]]; then
+  VERIFY_OR_NOT="--verify"
+  if ! (gpg --no-default-keyring --keyring=~/.gnupg/pubring.gpg --list-keys 
"${GPG_KEY}"); then
+    gpg --export >~/.gnupg/pubring.gpg
+  fi
 fi
 
 # Install the Solr Operator
 kubectl create -f "${LOCATION}/crds/all-with-dependencies.yaml" || kubectl 
replace -f "${LOCATION}/crds/all-with-dependencies.yaml"
-helm install --kube-context "${KUBE_CONTEXT}" --verify solr-operator 
"${OP_HELM_CHART}" --set image.tag="${IMAGE##*:}" \
+helm install --kube-context "${KUBE_CONTEXT}" ${VERIFY_OR_NOT} solr-operator 
"${OP_HELM_CHART}" \
+    --set-string image.tag="${IMAGE##*:}" \
     --set image.repository="${IMAGE%%:*}" \
     --set image.pullPolicy="Never"
 
 printf "\nInstall a test Solr Cluster\n"
-helm install --kube-context "${KUBE_CONTEXT}" --verify example 
"${SOLR_HELM_CHART}" \
+helm install --kube-context "${KUBE_CONTEXT}" ${VERIFY_OR_NOT} example 
"${SOLR_HELM_CHART}" \
     --set replicas=3 \
-    --set image.tag=${SOLR_VERSION} \
+    --set image.repository="${SOLR_IMAGE%%:*}" \
+    --set-string image.tag="${SOLR_IMAGE##*:}" \
     --set solrOptions.javaMemory="-Xms1g -Xmx3g" \
     --set podOptions.resources.limits.memory="1G" \
     --set podOptions.resources.requests.cpu="300m" \
@@ -201,7 +219,7 @@ spec:
       name: "example"
   numThreads: 4
   image:
-    tag: 8.7.0
+    tag: "8.11"
 EOF
 
 printf "\nWait for the Solr Prometheus Exporter to be ready\n"
@@ -262,10 +280,10 @@ fi
 
 printf "\nDo a rolling restart and make sure the cluster is healthy 
afterwards\n"
 
-helm upgrade --kube-context "${KUBE_CONTEXT}"  --verify example 
"${SOLR_HELM_CHART}" --reuse-values  \
+helm upgrade --kube-context "${KUBE_CONTEXT}" ${VERIFY_OR_NOT} example 
"${SOLR_HELM_CHART}" --reuse-values  \
     --set-string podOptions.annotations.restart="true"
 printf '\nWait for the rolling restart to begin.\n\n'
-grep -q "3              3       3            0" <(exec kubectl get solrcloud 
example -w); kill $!
+grep -q "3              [[:digit:]]       [[:digit:]]            0" <(exec 
kubectl get solrcloud example -w); kill $!
 
 printf '\nWait for all 3 Solr nodes to become ready.\n\n'
 grep -q "3              3       3            3" <(exec kubectl get solrcloud 
example -w); kill $!
diff --git a/hack/release/smoke_test/test_source.sh 
b/hack/release/smoke_test/test_source.sh
index a55493f..fe212cd 100755
--- a/hack/release/smoke_test/test_source.sh
+++ b/hack/release/smoke_test/test_source.sh
@@ -89,7 +89,7 @@ echo "Download source artifact, verify and run 'make check'"
   make check
 
   # Check the version
-  FOUND_VERSION=$(make version)
+  FOUND_VERSION=$(make -s version)
   if [[ "$FOUND_VERSION" != "${VERSION}" ]]; then
     echo "Version in source release should be ${VERSION}, but found 
${FOUND_VERSION}" >&2
     exit 1
diff --git a/hack/release/smoke_test/verify_all.sh 
b/hack/release/smoke_test/verify_all.sh
index 264bf2b..89f559b 100755
--- a/hack/release/smoke_test/verify_all.sh
+++ b/hack/release/smoke_test/verify_all.sh
@@ -23,7 +23,7 @@ set -u
 
 show_help() {
 cat << EOF
-Usage: ./hack/release/smoke_test/verify_all.sh [-h] -v VERSION -l LOCATION -g 
GPG_KEY
+Usage: ./hack/release/smoke_test/verify_all.sh [-h] [-g GPG_KEY] -v VERSION -l 
LOCATION
 
 Verify checksums and signatures of all release artifacts.
 Check that the docker image contains the necessary LICENSE and NOTICE.
@@ -31,7 +31,7 @@ Check that the docker image contains the necessary LICENSE 
and NOTICE.
     -h  Display this help and exit
     -v  Version of the Solr Operator
     -l  Base location of the staged artifacts. Can be a URL or relative or 
absolute file path.
-    -g  GPG Key (fingerprint) used to sign the artifacts
+    -g  GPG Key (fingerprint) used to sign the artifacts. (Optional, if 
missing then fingerprints will not be checked)
 EOF
 }
 
@@ -62,9 +62,6 @@ fi
 if [[ -z "${LOCATION:-}" ]]; then
   echo "Specify an base artifact location through -l, or through the LOCATION 
env var" >&2 && exit 1
 fi
-if [[ -z "${GPG_KEY:-}" ]]; then
-  echo "Specify a gpg key fingerprint through -g, or through the GPG_KEY env 
var" >&2 && exit 1
-fi
 
 TMP_DIR=$(mktemp -d "${TMPDIR:-/tmp}/solr-operator-smoke-verify-XXXXXX")
 
@@ -76,9 +73,13 @@ fi
 echo "Import Solr Keys"
 curl -sL0 "https://dist.apache.org/repos/dist/release/solr/KEYS"; | gpg 
--import --quiet
 
-# First generate the old-style public key ring, if it doesn't already exist 
and contain the information we want
-if ! (gpg --no-default-keyring --keyring=~/.gnupg/pubring.gpg --list-keys 
"${GPG_KEY}"); then
-  gpg --export >~/.gnupg/pubring.gpg
+
+# First generate the old-style public key ring, if it doesn't already exist 
and contain the information we want.
+# Only do this if a GPG Key was provided
+if [[ -n "${GPG_KEY:-}" ]]; then
+  if ! (gpg --no-default-keyring --keyring=~/.gnupg/pubring.gpg --list-keys 
"${GPG_KEY}"); then
+    gpg --export >~/.gnupg/pubring.gpg
+  fi
 fi
 
 echo "Download all artifacts and verify signatures"
@@ -107,12 +108,14 @@ echo "Download all artifacts and verify signatures"
         echo "Veryifying: ${artifact_directory}/${artifact}"
         sha512sum -c "${artifact}.sha512" \
           || { echo "Invalid sha512 for ${artifact}. Aborting!"; exit 1; }
-        gpg --verify "${artifact}.asc" "${artifact}" \
-          || { echo "Invalid signature for ${artifact}. Aborting!"; exit 1; }
+        if [[ -n "${GPG_KEY:-}" ]]; then
+          gpg --verify "${artifact}.asc" "${artifact}" \
+            || { echo "Invalid signature for ${artifact}. Aborting!"; exit 1; }
+        fi
       done
 
-      # If a helm chart has a provenance file, verify it
-      if [[ -f "${artifact}.prov" ]]; then
+      # If a helm chart has a provenance file, and a GPG Key was provided, 
then verify the provenance file
+      if [[ -f "${artifact}.prov" && -n "${GPG_KEY:-}" ]]; then
         helm verify "${artifact}"
       fi
     )
@@ -122,8 +125,10 @@ echo "Download all artifacts and verify signatures"
     echo "Veryifying: ${artifact}"
     sha512sum -c "${artifact}.sha512" \
       || { echo "Invalid sha512 for ${artifact}. Aborting!"; exit 1; }
-    gpg --verify "${artifact}.asc" "${artifact}" \
-      || { echo "Invalid signature for ${artifact}. Aborting!"; exit 1; }
+    if [[ -n "${GPG_KEY:-}" ]]; then
+      gpg --verify "${artifact}.asc" "${artifact}" \
+        || { echo "Invalid signature for ${artifact}. Aborting!"; exit 1; }
+    fi
   done
 )
 
diff --git a/hack/release/smoke_test/verify_docker.sh 
b/hack/release/smoke_test/verify_docker.sh
index 0d9832b..46b9086 100755
--- a/hack/release/smoke_test/verify_docker.sh
+++ b/hack/release/smoke_test/verify_docker.sh
@@ -76,15 +76,22 @@ echo "Verify the Docker image ${IMAGE}"
 docker run --rm --entrypoint='sh' "${IMAGE}" -c "ls /etc/licenses/LICENSE ; ls 
/etc/licenses/NOTICE; ls /etc/licenses/dependencies/*"
 
 # Check for Version and other information
-docker run --rm -it --entrypoint='sh' "${IMAGE}" -c "/solr-operator || true" | 
grep "solr-operator Version: ${VERSION}" \
+SOLR_OP_LOGS=$(docker run --rm --entrypoint='sh' "${IMAGE}" -c "/solr-operator 
2>&1 || true")
+echo "${SOLR_OP_LOGS}" | grep "solr-operator Version: ${VERSION}" \
   || {
+     printf "\n\n" >&2
      echo "Could not find correct Version in Operator startup logs: 
${VERSION}" >&2;
+     printf "\n\n" >&2
+     echo "${SOLR_OP_LOGS}" >&2;
      exit 1
     }
 if [[ -n "${GIT_SHA:-}" ]]; then
-  docker run --rm -it --entrypoint='sh' "${IMAGE}" -c "/solr-operator || true" 
| grep "solr-operator Git SHA: ${GIT_SHA}" \
+  echo "${SOLR_OP_LOGS}" | grep "solr-operator Git SHA: ${GIT_SHA}" \
     || {
+     printf "\n\n" >&2
      echo "Could not find correct Git SHA in Operator startup logs: 
${GIT_SHA}" >&2;
+     printf "\n\n" >&2
+     echo "${SOLR_OP_LOGS}" >&2;
      exit 1
     }
 fi

Reply via email to