You are viewing a plain text version of this content. The canonical link for it is here.
Posted to gitbox@yetus.apache.org by aw...@apache.org on 2022/05/23 15:17:59 UTC

[yetus-homebrew] branch main updated: YETUS-1185. release process for yetus-homebrew is broken (#6)

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

aw pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/yetus-homebrew.git


The following commit(s) were added to refs/heads/main by this push:
     new e161951  YETUS-1185. release process for yetus-homebrew is broken (#6)
e161951 is described below

commit e1619519135f5cb67e7856911c935cdb63c25639
Author: Allen Wittenauer <aw...@apache.org>
AuthorDate: Mon May 23 08:17:55 2022 -0700

    YETUS-1185. release process for yetus-homebrew is broken (#6)
    
    Signed-off-by: Nick Dimiduk <nd...@apache.org>
---
 .github/workflows/testing.yaml |  4 ++--
 .github/workflows/yetus.yml    |  4 ++--
 Formula/yetus.rb               |  2 +-
 release.sh                     | 46 +++++++++++++++++++++++++++++++++++++++++-
 update-homebrew.sh             |  4 ++--
 5 files changed, 52 insertions(+), 8 deletions(-)

diff --git a/.github/workflows/testing.yaml b/.github/workflows/testing.yaml
index 487e130..1b20e22 100644
--- a/.github/workflows/testing.yaml
+++ b/.github/workflows/testing.yaml
@@ -22,9 +22,9 @@ jobs:
           brew install go || true
           brew link --overwrite go || true
       - name: checkout
-        uses: actions/checkout@v2
+        uses: actions/checkout@v3
       - name: tests
         shell: bash
         run: |
           brew tap apache/yetus file://$(pwd)
-          brew install yetus --with-all
+          brew install yetus --with-all --overwrite
diff --git a/.github/workflows/yetus.yml b/.github/workflows/yetus.yml
index d486704..0f32d75 100644
--- a/.github/workflows/yetus.yml
+++ b/.github/workflows/yetus.yml
@@ -25,7 +25,7 @@ jobs:
 
     steps:
       - name: checkout
-        uses: actions/checkout@v2
+        uses: actions/checkout@v3
         with:
           path: src
           fetch-depth: 0
@@ -37,7 +37,7 @@ jobs:
           githubtoken: ${{ secrets.GITHUB_TOKEN }}
       - name: Artifact output
         if: ${{ always() }}
-        uses: actions/upload-artifact@v2
+        uses: actions/upload-artifact@v3
         with:
           name: apacheyetustestpatchactionout
           path: ${{ github.workspace }}/out
diff --git a/Formula/yetus.rb b/Formula/yetus.rb
index b160b4d..8c7ba27 100644
--- a/Formula/yetus.rb
+++ b/Formula/yetus.rb
@@ -20,7 +20,7 @@ class Yetus < Formula
   desc "Enable contribution and release processes for software projects"
   homepage "https://yetus.apache.org/"
   url "https://dlcdn.apache.org/yetus/0.13.0/apache-yetus-0.13.0-bin.tar.gz"
-  sha256 "a1022da63540ff9f722c9a4ab7b1dda5fb5a3d5faa2c3426d18582aed1f08a1e"
+  sha256 "a1022da63540ff9f722c9a4ab7b1dda5fb5a3d5faa2c3426d18582aed1f08a1e" # pragma: allowlist secret
 
   option "with-all", "Build with all dependencies. Note that some dependencies such as "\
     "Go, Perl::Critic and checkmake still need to be installed manually."
diff --git a/release.sh b/release.sh
index 4586fb3..20f7cd8 100755
--- a/release.sh
+++ b/release.sh
@@ -19,6 +19,10 @@
 
 USER_NAME=${SUDO_USER:=$USER}
 USER_ID=$(id -u "${USER_NAME}")
+GPG=$(command -v gpg)
+GPGAGENT=$(command -v gpg-agent)
+LOGDIR="/tmp/homebrew-sign.$$"
+mkdir -p "${LOGDIR}"
 
 usage() {
   cat <<EOF
@@ -29,6 +33,8 @@ EOF
 
 cleanup() {
   git checkout --force main
+  stopgpgagent
+  rm -rf "${LOGDIR}"
   exit 1
 }
 
@@ -47,10 +53,45 @@ verifyparams() {
   fi
 }
 
+startgpgagent()
+{
+    if [[ -n "${GPGAGENT}" && -z "${GPG_AGENT_INFO}" ]]; then
+      echo "starting gpg agent"
+      echo "default-cache-ttl 36000" > "${LOGDIR}/gpgagent.conf"
+      echo "max-cache-ttl 36000" >> "${LOGDIR}/gpgagent.conf"
+      # shellcheck disable=2046
+      eval $("${GPGAGENT}" --daemon \
+        --options "${LOGDIR}/gpgagent.conf" \
+        --log-file="${LOGDIR}/create-release-gpgagent.log")
+      GPGAGENTPID=$(pgrep "${GPGAGENT}")
+      GPG_AGENT_INFO="$HOME/.gnupg/S.gpg-agent:$GPGAGENTPID:1"
+      export GPG_AGENT_INFO
+    fi
+
+    if [[ -n "${GPG_AGENT_INFO}" ]]; then
+      echo "Warming the gpg-agent cache prior to calling maven"
+      # warm the agent's cache:
+      touch "${LOGDIR}/warm"
+      "${GPG}" --use-agent --armor --output "${LOGDIR}/warm.asc" --detach-sig "${LOGDIR}/warm"
+      rm "${LOGDIR}/warm.asc" "${LOGDIR}/warm"
+    else
+      yetus_error "ERROR: Unable to launch or acquire gpg-agent. Disable signing."
+    fi
+}
+
+stopgpgagent()
+{
+  if [[ -n "${GPGAGENTPID}" ]]; then
+    kill "${GPGAGENTPID}"
+  fi
+}
+
 verifyparams "$@"
 
 trap cleanup INT QUIT TRAP ABRT BUS SEGV TERM ERR
 
+startgpgagent
+
 set -x
 
 git clean -xdf
@@ -62,7 +103,10 @@ docker run -i --rm \
   -v "${PWD}:/src" \
   -u "${USER_ID}" \
   -w /src \
-  "apache/yetus:main" \
+  "ghcr.io/apache/yetus:${VERSION}" \
     ./update-homebrew.sh "${VERSION}"
 
 git commit -a -S -m "${JIRAISSUE}. Release ${VERSION}"
+
+stopgpgagent
+rm -rf "${LOGDIR}"
\ No newline at end of file
diff --git a/update-homebrew.sh b/update-homebrew.sh
index 8f395ef..9c36f48 100755
--- a/update-homebrew.sh
+++ b/update-homebrew.sh
@@ -42,7 +42,7 @@ sed -E -i "s,[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+,${VERSION},g" Formula/yetu
 URL=$(awk '/url/ {print $NF}' Formula/yetus.rb)
 URL=${URL//\"/}
 
-curl --location --fail --output "/tmp/yetus-binary.tgz" "${MIRRORURL}"
+curl --location --fail --output "/tmp/yetus-binary.tgz" "${URL}"
 
 
 if ! tar tzf /tmp/yetus-binary.tgz >/dev/null; then
@@ -64,7 +64,7 @@ echo "Got SHA256: ${SHA256}"
 
 while read -r; do
   if [[ "${REPLY}" =~ sha256 ]]; then
-    echo "  sha256 \"${SHA256}\"" >> "${newfile}"
+    echo "  sha256 \"${SHA256}\" # pragma: allowlist secret" >> "${newfile}"
   else
     echo "${REPLY}" >> "${newfile}"
   fi