You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@solr.apache.org by ho...@apache.org on 2021/04/21 20:14:01 UTC

[solr-operator] branch release-0.3 updated: Fix issues with headers and signing for artifacts.

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

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


The following commit(s) were added to refs/heads/release-0.3 by this push:
     new 5799556  Fix issues with headers and signing for artifacts.
5799556 is described below

commit 5799556d0f1674a5417c99971b88f4f22b820f03
Author: Houston Putman <ho...@apache.org>
AuthorDate: Wed Apr 21 15:13:44 2021 -0500

    Fix issues with headers and signing for artifacts.
---
 hack/headers/header.txt                    | 11 +++++++----
 hack/release/artifacts/build_helm.sh       | 11 ++++++++---
 hack/release/artifacts/create_artifacts.sh |  6 ++++--
 hack/release/artifacts/create_crds.sh      | 15 ++++++++-------
 hack/release/upload/upload_helm.sh         | 10 +++++++++-
 hack/release/wizard/releaseWizard.yaml     | 14 +++++++++++++-
 6 files changed, 49 insertions(+), 18 deletions(-)

diff --git a/hack/headers/header.txt b/hack/headers/header.txt
index 07d2fa4..0ed96c4 100644
--- a/hack/headers/header.txt
+++ b/hack/headers/header.txt
@@ -1,8 +1,11 @@
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
 
-     http://www.apache.org/licenses/LICENSE-2.0
+    http://www.apache.org/licenses/LICENSE-2.0
 
 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
diff --git a/hack/release/artifacts/build_helm.sh b/hack/release/artifacts/build_helm.sh
index 536744e..8524283 100755
--- a/hack/release/artifacts/build_helm.sh
+++ b/hack/release/artifacts/build_helm.sh
@@ -69,9 +69,7 @@ echo "Packaging helm chart for version ${VERSION} at: ${HELM_RELEASE_DIR}"
 mkdir -p "${HELM_RELEASE_DIR}"
 rm -rf "${HELM_RELEASE_DIR}"/*
 
-# Package and Index the helm charts, create release artifacts to upload in GithubRelease
-
-helm dependency build helm/solr-operator
+# Package and Index the helm charts
 
 SIGNING_INFO=()
 CREATED_SECURE_RING=false
@@ -95,3 +93,10 @@ if [[ "${CREATED_SECURE_RING}" = true ]]; then
 fi
 
 helm repo index "${HELM_RELEASE_DIR}"
+
+{
+  cat hack/headers/header.yaml.txt
+  printf "\n\n"
+  cat "${HELM_RELEASE_DIR}/index.yaml"
+} > "${HELM_RELEASE_DIR}/index.yaml.tmp" && mv "${HELM_RELEASE_DIR}/index.yaml.tmp" "${HELM_RELEASE_DIR}/index.yaml"
+
diff --git a/hack/release/artifacts/create_artifacts.sh b/hack/release/artifacts/create_artifacts.sh
index c5a0abc..f32892b 100755
--- a/hack/release/artifacts/create_artifacts.sh
+++ b/hack/release/artifacts/create_artifacts.sh
@@ -89,8 +89,9 @@ echo "Setting up Solr Operator ${VERSION} release artifacts at '${ARTIFACTS_DIR}
       cd "${artifact_directory}"
 
       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}"
+          gpg "${GPG_USER[@]}" --pinentry-mode loopback -ab "${artifact}"
         fi
         if [ ! -f "${artifact}.sha512" ]; then
           sha512sum -b "${artifact}" > "${artifact}.sha512"
@@ -100,8 +101,9 @@ echo "Setting up Solr Operator ${VERSION} release artifacts at '${ARTIFACTS_DIR}
   done
 
   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}"
+      gpg "${GPG_USER[@]}" --pinentry-mode loopback -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 527275e..3723c6b 100755
--- a/hack/release/artifacts/create_crds.sh
+++ b/hack/release/artifacts/create_crds.sh
@@ -65,6 +65,8 @@ echo "Setting up Solr Operator ${VERSION} CRDs at ${ARTIFACTS_DIR}/crds."
 mkdir -p "${ARTIFACTS_DIR}"/crds
 rm -rf "${ARTIFACTS_DIR}"/crds/*
 
+header_end="+$((1 + $(grep -c '^' hack/headers/header.yaml.txt)))"
+
 # Create Release CRD files
 {
   cat hack/headers/header.yaml.txt
@@ -72,15 +74,14 @@ rm -rf "${ARTIFACTS_DIR}"/crds/*
 } > "${ARTIFACTS_DIR}/crds/all.yaml"
 for filename in config/crd/bases/*.yaml; do
     output_file=${filename#"config/crd/bases/solr.apache.org_"}
-    # Create individual file with Apache Header
+    # Copy individual yaml with condensed name
+    cp "${filename}" "${ARTIFACTS_DIR}/crds/${output_file}"
+
+    # Add to aggregate file, without header
     {
-      cat hack/headers/header.yaml.txt;
+      tail -n "${header_end}" "${filename}";
       printf "\n"
-      cat "${filename}";
-    } > "${ARTIFACTS_DIR}/crds/${output_file}"
-
-    # Add to aggregate file
-    cat "${filename}" >> "${ARTIFACTS_DIR}/crds/all.yaml"
+    } >> "${ARTIFACTS_DIR}/crds/all.yaml"
 done
 
 # Fetch the correct dependency Zookeeper CRD, package with other CRDS
diff --git a/hack/release/upload/upload_helm.sh b/hack/release/upload/upload_helm.sh
index a462403..c463e7f 100755
--- a/hack/release/upload/upload_helm.sh
+++ b/hack/release/upload/upload_helm.sh
@@ -73,6 +73,8 @@ if [[ -n "${GPG_KEY:-}" ]]; then
   GPG_USER=(-u "${GPG_KEY}")
 fi
 
+export YAML_HEADER_FILE="$(pwd)/hack/headers/header.yaml.txt"
+
 echo "Pulling Helm chart from the staged url and uploading to release Helm repo. ${CHART_REPO}"
 
 # Put in a sub-shell so that the Password can't leak
@@ -102,8 +104,14 @@ echo "Pulling Helm chart from the staged url and uploading to release Helm repo.
     # Add the newly released Helm chart to the index
     helm repo index . --merge "index.yaml"
 
+    {
+      cat "${YAML_HEADER_FILE}"
+      printf "\n\n"
+      cat "index.yaml"
+    } > "index.yaml.tmp" && mv "index.yaml.tmp" "index.yaml"
+
     # Generate signature and checksum for new index file
-    gpg "${GPG_USER[@]}" -ab "index.yaml"
+    gpg "${GPG_USER[@]}" --pinentry-mode loopback -ab "index.yaml"
     sha512sum -b "index.yaml" > "index.yaml.sha512"
 
     # Upload the newly released Helm charts
diff --git a/hack/release/wizard/releaseWizard.yaml b/hack/release/wizard/releaseWizard.yaml
index cfdb8a4..22c7048 100644
--- a/hack/release/wizard/releaseWizard.yaml
+++ b/hack/release/wizard/releaseWizard.yaml
@@ -600,7 +600,7 @@ groups:
   todos:
   - !Todo
     id: run_tests
-    title: Run tests & lint
+    title: Run tests & lint clean checkout of {{ release_branch }} branch
     depends: clean_git_checkout
     commands: !Commands
       root_folder: '{{ git_checkout_folder }}'
@@ -610,6 +610,18 @@ groups:
         cmd: git checkout {{ release_branch }}
         stdout: true
       - !Command
+        cmd: git clean -df && git checkout -- .
+        comment: Make sure checkout is clean and up to date
+        logfile: git_clean.log
+        tee: true
+      - !Command
+        cmd: git pull --ff-only
+        tee: true
+      - !Command
+        cmd: git reset --hard origin/{{ release_branch }}
+        comment: Make sure checkout is the same as the remote branch. The release candidate should only have one local commit, the version change.
+        tee: true
+      - !Command
         cmd: "make check"
     post_description: Check that the task passed. If it failed, commit fixes for the failures before proceeding.
   - !Todo