Skip to content

Commit 248a0c2

Browse files
committed
[skip ci] update verification scripts
1 parent 1e013da commit 248a0c2

File tree

6 files changed

+165
-14
lines changed

6 files changed

+165
-14
lines changed

etc/bin/reset-verify.sh

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#
2+
# Licensed to the Apache Software Foundation (ASF) under one
3+
# or more contributor license agreements. See the NOTICE file
4+
# distributed with this work for additional information
5+
# regarding copyright ownership. The ASF licenses this file
6+
# to you under the Apache License, Version 2.0 (the
7+
# "License"); you may not use this file except in compliance
8+
# with the License. You may obtain a copy of the License at
9+
#
10+
# https://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing,
13+
# software distributed under the License is distributed on an
14+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
# KIND, either express or implied. See the License for the
16+
# specific language governing permissions and limitations
17+
# under the License.
18+
#
19+
20+
RELEASE_TAG=$1
21+
DOWNLOAD_LOCATION="${2:-downloads}"
22+
DOWNLOAD_LOCATION=$(realpath "${DOWNLOAD_LOCATION}")
23+
24+
if [ -z "${RELEASE_TAG}" ]; then
25+
echo "Usage: $0 [release-tag] <optional download location>"
26+
exit 1
27+
fi
28+
29+
VERSION=${RELEASE_TAG#v}
30+
31+
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
32+
CWD=$(pwd)
33+
34+
cd "${DOWNLOAD_LOCATION}"
35+
rm *.zip *.asc *.sha512
36+
cd grails
37+
find . -mindepth 1 -path ./etc -prune -o -exec rm -rf {} +
38+
cd etc
39+
find . -mindepth 1 -path ./bin -prune -o -exec rm -rf {} +
40+
cd bin
41+
find . -mindepth 1 -path ./results -prune -o -exec rm -rf {} +
42+
cd "${CWD}"
43+
44+
rm -rf "apache-grails-${VERSION}-incubating-bin"
45+
rm -rf "apache-grails-wrapper-${VERSION}-incubating-bin"
46+
rm -rf "profile-wrapper-check"

etc/bin/verify-cli-distribution.sh

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,21 @@ cleanup() {
4444
}
4545
trap cleanup EXIT
4646

47+
error() {
48+
echo "❌ CLI Verification failed ❌"
49+
exit 1
50+
}
51+
trap error ERR
52+
4753
echo "Verifying checksum..."
4854
shasum -a 512 -c "apache-grails-${VERSION}-incubating-bin.zip.sha512"
4955
echo "✅ Checksum Verified"
5056

51-
echo "Verifying GPG signature..."
57+
echo "Importing GPG key to independent GPG home ..."
5258
gpg --homedir "${GRAILS_GPG_HOME}" --import "${SCRIPT_DIR}/../../KEYS"
59+
echo "✅ GPG Key Imported"
60+
61+
echo "Verifying GPG signature..."
5362
gpg --homedir "${GRAILS_GPG_HOME}" --verify "apache-grails-${VERSION}-incubating-bin.zip.asc" "apache-grails-${VERSION}-incubating-bin.zip"
5463
echo "✅ GPG Verified"
5564

@@ -75,4 +84,14 @@ for FILE in "${REQUIRED_FILES[@]}"; do
7584
echo "✅ Found required file: $FILE"
7685
done
7786

78-
echo "✅ All cli binary distribution checks passed successfully for Apache Grails ${VERSION}."
87+
export GRAILS_REPO_URL=https://repository.apache.org/content/groups/staging
88+
cd "${SRC_DIR}"
89+
echo "Checking Shell CLI ..."
90+
./grails-shell-cli create-app ShellApp
91+
echo "✅ Generated Shell App"
92+
93+
echo "Checking Forge CLI ..."
94+
./grails-forge-cli create-app -x -g mongodb ForgeApp
95+
echo "✅ Generated Forge App"
96+
97+
echo "✅✅✅ All cli binary distribution checks passed successfully for Apache Grails ${VERSION}."

etc/bin/verify-jar-artifacts.sh

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,14 @@ cleanup() {
5151
rm -rf "${GRAILS_GPG_HOME}"
5252
}
5353
trap cleanup EXIT
54+
error() {
55+
echo "❌ JAR Verification failed ❌"
56+
}
57+
trap error ERR
58+
59+
echo "Importing GPG key to independent GPG home ..."
5460
gpg --homedir "${GRAILS_GPG_HOME}" --import "${SCRIPT_DIR}/../../KEYS"
61+
echo "✅ GPG Key Imported"
5562

5663
REPO_BASE_URL="https://repository.apache.org/content/repositories/${STAGING_REPO_ID}"
5764

@@ -93,7 +100,6 @@ while IFS= read -r line; do
93100
echo "... Skipping download, already exists: ${JAR_FILE}"
94101
fi
95102

96-
97103
if [ ! -f "${FILE_NAME}.asc" ]; then
98104
echo "... Downloading signature: ${ASC_URL}"
99105
curl -sSfLO "${ASC_URL}"
@@ -125,4 +131,35 @@ while IFS= read -r line; do
125131
echo "✅ Verified: ${JAR_FILE}"
126132
done < "${ARTIFACTS_FILE}"
127133

134+
# check to make sure the base profile jar contains the wrapper since it's dynamically generated & copied into position as part of the build
135+
echo "🔍 Locating base profile jar for wrapper inspection..."
136+
cd "${DOWNLOAD_LOCATION}"
137+
mkdir -p "profile-wrapper-check"
138+
cp "${DOWNLOAD_LOCATION}/grails/etc/bin/results/first/grails-profiles-base-${VERSION}.jar" "profile-wrapper-check/base.jar"
139+
echo "✅ Located base profile jar, extracting ..."
140+
unzip "profile-wrapper-check/base.jar" -d "profile-wrapper-check"
141+
echo "✅ Extracted base profile jar ..."
142+
143+
cd "profile-wrapper-check"
144+
if [ ! -s "META-INF/grails-profile/skeleton/grailsw" ]; then
145+
echo "❌ Missing grailsw in base profile jar"
146+
exit 1
147+
else
148+
echo "✅ Found grailsw in base profile jar"
149+
fi
150+
151+
if [ ! -s "META-INF/grails-profile/skeleton/grailsw.bat" ]; then
152+
echo "❌ Missing grailsw.bat in base profile jar"
153+
exit 1
154+
else
155+
echo "✅ Found grailsw.bat in base profile jar"
156+
fi
157+
158+
if [ ! -s "META-INF/grails-profile/skeleton/grails-wrapper.jar" ]; then
159+
echo "❌ Missing grails-wrapper.jar in base profile jar"
160+
exit 1
161+
else
162+
echo "✅ Found grails-wrapper.jar in base profile jar"
163+
fi
164+
128165
echo "✅✅✅ All artifacts verified successfully. ✅✅✅"

etc/bin/verify-source-distribution.sh

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ fi
3030

3131
VERSION=${RELEASE_TAG#v}
3232

33-
cd $DOWNLOAD_LOCATION
33+
cd "${DOWNLOAD_LOCATION}"
3434
ZIP_FILE=$(ls "apache-grails-${VERSION}-incubating-src.zip" 2>/dev/null | head -n 1)
3535

36-
if [ -z "$ZIP_FILE" ]; then
37-
echo "Error: Could not find apache-grails-${VERSION}-incubating-src.zip in $DOWNLOAD_LOCATION"
36+
if [ -z "${ZIP_FILE}" ]; then
37+
echo "Error: Could not find apache-grails-${VERSION}-incubating-src.zip in ${DOWNLOAD_LOCATION}"
3838
exit 1
3939
fi
4040

@@ -48,13 +48,26 @@ echo "Verifying checksum..."
4848
shasum -a 512 -c "apache-grails-${VERSION}-incubating-src.zip.sha512"
4949
echo "✅ Checksum Verified"
5050

51-
echo "Verifying GPG signature..."
51+
echo "Importing GPG key to independent GPG home ..."
5252
gpg --homedir "${GRAILS_GPG_HOME}" --import "${SCRIPT_DIR}/../../KEYS"
53+
echo "✅ GPG Key Imported"
54+
55+
echo "Verifying GPG signature..."
5356
gpg --homedir "${GRAILS_GPG_HOME}" --verify "apache-grails-${VERSION}-incubating-src.zip.asc" "apache-grails-${VERSION}-incubating-src.zip"
5457
echo "✅ GPG Verified"
5558

5659
SRC_DIR="grails"
57-
rm -rf "${SRC_DIR}" || true
60+
61+
if [ -d "${SRC_DIR}" ]; then
62+
echo "Previous grails directory found, purging"
63+
cd grails
64+
find . -mindepth 1 -path ./etc -prune -o -exec rm -rf {} +
65+
cd etc
66+
find . -mindepth 1 -path ./bin -prune -o -exec rm -rf {} +
67+
cd bin
68+
find . -mindepth 1 -path ./results -prune -o -exec rm -rf {} +
69+
cd "${DOWNLOAD_LOCATION}"
70+
fi
5871
echo "Extracting zip file..."
5972
unzip -q "apache-grails-${VERSION}-incubating-src.zip"
6073

etc/bin/verify-wrapper-distribution.sh

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,17 +40,24 @@ fi
4040

4141
export GRAILS_GPG_HOME=$(mktemp -d)
4242
cleanup() {
43-
echo "❌ Wrapper Verification failed ❌"
4443
rm -rf "${GRAILS_GPG_HOME}"
4544
}
4645
trap cleanup EXIT
46+
error() {
47+
echo "❌ Wrapper Verification failed ❌"
48+
exit 1
49+
}
50+
trap cleanup ERR
4751

4852
echo "Verifying checksum..."
4953
shasum -a 512 -c "apache-grails-wrapper-${VERSION}-incubating-bin.zip.sha512"
5054
echo "✅ Checksum Verified"
5155

52-
echo "Verifying GPG signature..."
56+
echo "Importing GPG key to independent GPG home ..."
5357
gpg --homedir "${GRAILS_GPG_HOME}" --import "${SCRIPT_DIR}/../../KEYS"
58+
echo "✅ GPG Key Imported"
59+
60+
echo "Verifying GPG signature..."
5461
gpg --homedir "${GRAILS_GPG_HOME}" --verify "apache-grails-wrapper-${VERSION}-incubating-bin.zip.asc" "apache-grails-wrapper-${VERSION}-incubating-bin.zip"
5562
echo "✅ GPG Verified"
5663

@@ -85,4 +92,4 @@ echo "Checking forge command"
8592
./grailsw -t forge create-app -x -g mongodb ForgeApp
8693
echo "✅ Generated Forge App"
8794

88-
echo "✅ All wrapper binary distribution checks passed successfully for Apache Grails ${VERSION}."
95+
echo "✅✅ All wrapper binary distribution checks passed successfully for Apache Grails ${VERSION}."

etc/bin/verify.sh

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ fi
3131

3232
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
3333
CWD=$(pwd)
34+
VERSION=${RELEASE_TAG#v}
3435

3536
cleanup() {
3637
echo "❌ Verification failed. ❌"
@@ -61,8 +62,36 @@ echo "Using Java at ..."
6162
which java
6263
java -version
6364

65+
echo "Writing out custom repo script"
66+
echo """
67+
allprojects {
68+
buildscript {
69+
repositories {
70+
mavenCentral()
71+
maven { url = 'https://repo.grails.org/grails/restricted' }
72+
maven { url = 'https://repository.apache.org/content/groups/staging' }
73+
}
74+
}
75+
76+
repositories {
77+
mavenCentral()
78+
maven { url = 'https://repo.grails.org/grails/restricted' }
79+
maven { url = 'https://repository.apache.org/content/groups/staging' }
80+
}
81+
}
82+
83+
""" > "${DOWNLOAD_LOCATION}/custom-repos.gradle"
84+
85+
echo "Be sure to do the following:"
86+
echo "☑️ Run the wrapper ShellApp: cd ${DOWNLOAD_LOCATION}/apache-grails-wrapper-${VERSION}-incubating-bin/ShellApp && ./gradlew bootRun --init-script ~/grails-verify/custom-repos.gradle"
87+
echo "☑️ Run the wrapper ForgeApp: cd ${DOWNLOAD_LOCATION}/apache-grails-wrapper-${VERSION}-incubating-bin/ForgeApp && ./gradlew bootRun --init-script ~/grails-verify/custom-repos.gradle"
88+
echo "☑️ Run the cli ShellApp: cd ${DOWNLOAD_LOCATION}/apache-grails-${VERSION}-incubating-bin/ShellApp && ./gradlew bootRun --init-script ~/grails-verify/custom-repos.gradle"
89+
echo "☑️ Run the cli ForgeApp: cd ${DOWNLOAD_LOCATION}/apache-grails-${VERSION}-incubating-bin/ForgeApp && ./gradlew bootRun --init-script ~/grails-verify/custom-repos.gradle"
90+
echo "☑️ run the reproducible build test (see below)"
91+
6492
# I have no idea why this needs done manually, but if it's run from this script gradle happily ignores the settings.gradle and tries to build (so it fails)
65-
echo "Unable to bootstrap gradle manually. Please bootstrap by running the gradle `wrapper` task in grails & grails/grails-gradle."
66-
echo "After bootstrapping, call verify-reproducible.sh '${DOWNLOAD_LOCATION}'"
93+
echo "\tUnable to bootstrap gradle manually. Please bootstrap by running the gradle `wrapper` task in grails & grails/grails-gradle."
94+
echo "\tAfter bootstrapping, call verify-reproducible.sh '${DOWNLOAD_LOCATION}'"
95+
echo "\n"
6796

68-
echo "✅ Verification finished, see above instructions for reproducible build testing"
97+
echo "✅✅ Verification finished, see above instructions for remaining manual testing."

0 commit comments

Comments
 (0)