This is an automated email from the ASF dual-hosted git repository.
cdutz pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/plc4x.git
The following commit(s) were added to refs/heads/develop by this push:
new 3a0d903a5c chore: Updated the scripts in tools (deleted obsolete
ancient ones, updated the new ones)
3a0d903a5c is described below
commit 3a0d903a5cd917be780e121aa921d2d67a4cbb06
Author: Christofer Dutz <[email protected]>
AuthorDate: Thu Apr 10 23:06:30 2025 +0200
chore: Updated the scripts in tools (deleted obsolete ancient ones, updated
the new ones)
---
tools/NOTES.md | 22 ----
tools/check_sigs.sh | 77 ------------
tools/clean-site.sh | 35 ------
tools/common.sh | 193 -------------------------------
tools/download_staged_release.sh | 144 -----------------------
tools/release-0-update-generated-code.sh | 58 ++++++++--
tools/release-1-create-branch.sh | 51 ++++----
tools/release-2-prepare-release.sh | 90 +++++++++++++-
tools/release-3-perform-release.sh | 65 -----------
tools/validate-release.sh | 37 +++++-
10 files changed, 194 insertions(+), 578 deletions(-)
diff --git a/tools/NOTES.md b/tools/NOTES.md
deleted file mode 100644
index 09e2e7bfbf..0000000000
--- a/tools/NOTES.md
+++ /dev/null
@@ -1,22 +0,0 @@
-<!--
- 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
-
- https://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, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
- -->
-
-# Compare the local version with the staged one
-
-./mvnw -P with-c,with-dotnet,with-go,with-java,with-python,with-sandbox verify
artifact:compare
-Dreference.repo=https://repository.apache.org/content/repositories/staging/
-Dbuildinfo.reproducible
diff --git a/tools/check_sigs.sh b/tools/check_sigs.sh
deleted file mode 100755
index f2906dbb14..0000000000
--- a/tools/check_sigs.sh
+++ /dev/null
@@ -1,77 +0,0 @@
-#!/usr/bin/env bash
-
-# ----------------------------------------------------------------------------
-# 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
-#
-# https://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, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-# ----------------------------------------------------------------------------
-
-set -e
-
-# Checks the signatures of all bundles in the build/release directory
-# Or checks the bundles in the specified directory
-
-. "$(dirname "$0")"/common.sh
-
-setUsage "$(basename "$0") [bundle-directory]"
-handleHelp "$@"
-
-if [ $# -ge 1 ]
-then
- BUNDLE_DIR=$1; shift
-fi
-
-noExtraArgs "$@"
-
-[ -d "${BUNDLE_DIR}" ] || die "Bundle directory \"${BUNDLE_DIR}\" does not
exist"
-
-function checkFile() {
- FILE="$1"
- echo
- echo "Checking $FILE..."
-
- HASH=$(shasum -a 512 "${FILE}" | awk '{print$1}')
- CHECK=$(cat "${FILE}.sha512")
-
- if [ "$HASH" != "$CHECK" ]
- then
- echo "${FILE} SHA incorrect"
- exit 1;
- else
- echo "${FILE} SHA OK";
- fi
-
-}
-
-for bundle in "${BUNDLE_DIR}"/*.zip
-do
- checkFile "${bundle}"
-
- gpg --verify "${FILE}.asc"
-done
-
-for sbom in "${BUNDLE_DIR}"/*.json
-do
- gpg --verify "${sbom}.asc"
-done
-
-for sbom in "${BUNDLE_DIR}"/*.xml
-do
- gpg --verify "${sbom}.asc"
-done
-
-echo
-echo "SUCCESS: all checksum and signature files OK"
diff --git a/tools/clean-site.sh b/tools/clean-site.sh
deleted file mode 100755
index 84989259ee..0000000000
--- a/tools/clean-site.sh
+++ /dev/null
@@ -1,35 +0,0 @@
-#!/usr/bin/env bash
-
-# ----------------------------------------------------------------------------
-# 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
-#
-# https://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, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-# ----------------------------------------------------------------------------
-
-# Remove all the css and js directories except the ones in the root of the
site.
-find target/staging -type d | grep 'target\/staging\/.*\/css$' | xargs rm -r
-find target/staging -type d | grep 'target\/staging\/.*\/js$' | xargs rm -r
-
-# Delete some individual images.
-find target/staging -type f | grep 'target\/staging\/.*/images/close\.png$' |
xargs rm
-find target/staging -type f | grep 'target\/staging\/.*/images/close\.gif$' |
xargs rm
-find target/staging -type f | grep 'target\/staging\/.*/images/loading\.png$'
| xargs rm
-find target/staging -type f | grep 'target\/staging\/.*/images/loading\.gif$'
| xargs rm
-find target/staging -type f | grep 'target\/staging\/.*/images/next\.png$' |
xargs rm
-find target/staging -type f | grep 'target\/staging\/.*/images/prev\.png$' |
xargs rm
-
-# Delete any now empty directories.
-find target/staging -type d -empty | xargs rm -r
\ No newline at end of file
diff --git a/tools/common.sh b/tools/common.sh
deleted file mode 100755
index b1e49e22b1..0000000000
--- a/tools/common.sh
+++ /dev/null
@@ -1,193 +0,0 @@
-#!/usr/bin/env bash
-
-# ----------------------------------------------------------------------------
-# 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
-#
-# https://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, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-# ----------------------------------------------------------------------------
-
-BUILDTOOLS_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" > /dev/null && pwd)"
-
-PLC4X_ROOT_DIR=.
-# BUNDLE_DIR is results of maven release:perform's creation of release
candidate
-BUNDLE_DIR=${PLC4X_ROOT_DIR}/target/checkout/target
-
-PLC4X_ASF_GIT_URL=https://gitbox.apache.org/repos/asf/plc4x.git
-PLC4X_ASF_DIST_URL=https://downloads.apache.org/plc4x
-PLC4X_ASF_DIST_DYN_URL=https://www.apache.org/dyn/closer.cgi/plc4x
-PLC4X_ASF_SVN_RELEASE_URL=https://dist.apache.org/repos/dist/release/plc4x
-PLC4X_ASF_SVN_RC_URL=https://dist.apache.org/repos/dist/dev/plc4x
-
-USAGE=
-
-RELEASE_PROP_FILE=${PLC4X_ROOT_DIR}/plc4x.release.properties
-
-function die() { # [$* msgs]
- [ $# -gt 0 ] && echo "Error: $*"
- exit 1
-}
-
-function setUsage() { # $1: usage string
- USAGE=$1
-}
-
-function usage() { # [$*: msgs]
- [ $# -gt 0 ] && echo "Error: $*"
- echo "Usage: ${USAGE}"
- exit 1
-}
-
-function handleHelp() { # usage: handleHelp "$@"
- if [ "$1" == "-?" ] || [ "$1" == "--help" ]; then
- usage
- fi
-}
-
-function requireArg() { # usage: requireArgs "$@"
- if [ $# -lt 1 ] || [[ $1 =~ ^- ]]; then
- usage "missing argument"
- fi
-}
-
-function noExtraArgs() { # usage: noExtraArgs "$@"
- [ $# = 0 ] || usage "extra arguments"
-}
-
-function getAbsPath() { # $1: rel-or-abs-path
- echo "$(cd "$(dirname "$1")" >> /dev/null || exit $?; pwd)/$(basename
"$1")"
-}
-
-# shellcheck disable=SC2046
-function confirm () { # [$1: question]
- while true; do
- # call with a prompt string or use a default
- /bin/echo -n "${1:-Are you sure?}"
- read -r -p " [y/n] " response
- case $response in
- [yY]) return $(true) ;;
- [nN]) return $(false) ;;
- *) echo "illegal response '$response'" ;;
- esac
- done
-}
-
-function dieSuperceeded { # no args
- die "This tool is superceeded with the new maven build tooling. See
src/site/asciidoc/releasing.adoc."
-}
-
-function checkPLC4XSourceRootGitDie { # no args; dies if !ok
- [ -d "${PLC4X_ROOT_DIR}/.git" ] || die "Not an PLC4X source root git
directory \"${PLC4X_ROOT_DIR}\""
-}
-
-function checkUsingMgmtCloneWarn() { # no args; warns if plc4x root isn't a
mgmt clone
- CLONE_DIR="$(cd ${PLC4X_ROOT_DIR} > /dev/null || exit $?; pwd)"
- CLONE_DIRNAME="$(basename "${CLONE_DIR}")"
- if [ ! "$(echo ${CLONE_DIRNAME} | grep -o -E '^mgmt-plc4x')" ]; then
- echo "Warning: the PLC4X root dir \"${PLC4X_ROOT_DIR}\" is not a release
mgmt clone!"
- return 1
- else
- return 0
- fi
-}
-
-function checkBundleDir() { # no args returns true/false (0/1)
- if [ -d ${BUNDLE_DIR} ]; then
- return 0
- else
- return 1
- fi
-}
-
-function checkVerNum() { # $1: X.Y.Z returns true/false (0/1)
- [[ $1 =~ ^[0-9]{1,2}\.[0-9]{1,2}\.[0-9]{1,2}$ ]] && return 0
- return 1
-}
-
-function checkVerNumDie() { # $1: X.Y.Z dies if not ok
- checkVerNum "$1" || die "Not a X.Y.Z version number \"$1\""
-}
-
-function checkRcNum() { # $1: rc-num returns true/false (0/1)
- [[ $1 =~ ^[0-9]{1,2}$ ]] && return 0
- return 1
-}
-
-function checkRcNumDie() { # $1: rc-num dies if not ok
- checkRcNum "$1" || die "Not a release candidate number \"$1\""
-}
-
-function createReleaseProperties { # X.Y.Z
- VER="$1"
- checkVerNumDie "${VER}"
- echo "releaseNum=${VER}" > ${RELEASE_PROP_FILE}
-}
-
-function getReleaseProperty { # <property-name>
- PN=$1
- PNVAL=$(grep "${PN}" ${RELEASE_PROP_FILE})
- VAL=$(echo "${PNVAL}" | sed -e "s/^${PN}=//")
- echo "${VAL}"
-}
-
-function getPLC4XVer() { # [$1 == "bundle"]
- MSG="getPLC4XVer(): unknown mode \"$1\""
- VER=""
- if [ "$1" == "" ]; then
- VER=$(getReleaseProperty releaseNum)
- MSG="Unable to identify the release version id from ${RELEASE_PROP_FILE}"
- elif [ "$1" == "gradle" ]; then
- die "'getPLC4XVer() gradle' is no longer supported"
- elif [ "$1" == "bundle" ]; then
- # Get the X.Y.Z version from a build generated bundle's name
- BUNDLE=$(echo "${BUNDLE_DIR}"/apache-plc4x-*-source-release.tar.gz)
- VER=$(echo "${BUNDLE}" | grep -o -E '\d+\.\d+\.\d+')
- MSG="Unable to identify the version id from bundle ${BUNDLE}"
- fi
- [ "${VER}" ] || die "${MSG}"
- echo "$VER"
-}
-
-function getMajMinVerNum() { # $1: X.Y.Z returns X.Y
- VER=$1; shift
- checkVerNumDie "${VER}"
- MAJ_MIN_VER=$(echo "${VER}" | sed -e 's/\.[0-9][0-9]*$//')
- echo "${MAJ_MIN_VER}"
-}
-
-function getReleaseBranch() { # $1: X.Y.Z version
- MAJ_MIN_NUM=$(getMajMinVerNum "$1")
- echo "release/${MAJ_MIN_NUM}"
-}
-
-function getReleaseTag() { # $1: X.Y.Z [$2: rc-num]
- VER=$1; shift
- checkVerNumDie "${VER}"
- RC_SFX=""
- if [ $# -gt 0 ] && [ "$1" != "" ]; then
- RC_SFX="-RC$1"
- fi
- echo "${VER}${RC_SFX}"
-}
-
-function getReleaseTagComment() { # $1: X.Y.Z [$2: rc-num]
- VER=$1; shift
- checkVerNumDie "${VER}"
- RC_SFX=""
- if [ $# -gt 0 ] && [ "$1" != "" ]; then
- RC_SFX=" RC$1"
- fi
- echo "Apache PLC4X ${VER}${RC_SFX}"
-}
diff --git a/tools/download_staged_release.sh b/tools/download_staged_release.sh
deleted file mode 100755
index 977f551508..0000000000
--- a/tools/download_staged_release.sh
+++ /dev/null
@@ -1,144 +0,0 @@
-#!/usr/bin/env bash
-
-# ----------------------------------------------------------------------------
-# 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
-#
-# https://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, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-# ----------------------------------------------------------------------------
-
-set -e
-
-
-# Download the collection of files associated with an Apache PLC4X
-# Release or Release Candidate from the Apache Distribution area:
-# https://dist.apache.org/repos/dist/release/plc4x
-# or https://dist.apache.org/repos/dist/dev/plc4x
-# respectively.
-#
-# Prompts before taking actions unless "--nquery"
-# Prompts to perform signature validation (using buildTools/check_sigs.sh)
-# unless --nvalidate or --validate is specified.
-
-
-. `dirname $0`/common.sh
-
-
-
-setUsage "$(basename $0) [--nquery] [--validate|--nvalidate] <version>
[<rc-num>]"
-handleHelp "$@"
-
-
-NQUERY=
-if [ "$1" == "--nquery" ]; then
- NQUERY="--nquery"; shift
-fi
-
-VALIDATE=-1 # query
-if [ "$1" == "--validate" ]; then
- VALIDATE=1; shift
-elif [ "$1" == "--nvalidate" ]; then
- VALIDATE=0; shift
-fi
-
-requireArg "$@"
-VER=$1; shift
-checkVerNum "$VER" || usage "Not a X.Y.Z version number \"$VER\""
-
-RC_NUM=
-if [ $# -gt 0 ]; then
- RC_NUM=$1; shift
- checkRcNum "${RC_NUM}" || usage "Not a release candidate number
\"${RC_NUM}\""
-fi
-
-noExtraArgs "$@"
-
-# Release or Release Candidate mode
-IS_RC=
-if [ "${RC_NUM}" ]; then
- IS_RC=1
-fi
-
-BASE_URL=${PLC4X_ASF_SVN_RELEASE_URL}
-if [ ${IS_RC} ]; then
- BASE_URL=${PLC4X_ASF_SVN_RC_URL}
-fi
-
-RC_SFX=
-if [ ${IS_RC} ]; then
- RC_SFX=rc${RC_NUM}
-fi
-
-DST_BASE_DIR=downloaded-plc4x-${VER}${RC_SFX}
-[ -d "${DST_BASE_DIR}" ] && die "${DST_BASE_DIR} already exists"
-
-[ ${NQUERY} ] || confirm "Proceed to download to ${DST_BASE_DIR} from
${BASE_URL}?" || exit
-
-echo Downloading to "${DST_BASE_DIR}" ...
-
-function mywget() {
- # OSX lacks wget by default
- (set -x; curl -f -O "$1")
-}
-
-function getSignedAndHashedBundle() {
- mywget "${1}"
- mywget "${1}".asc
- mywget "${1}".sha512
-}
-
-function getSignedBundle() {
- mywget "${1}"
- mywget "${1}".asc
-}
-
-mkdir -p "${DST_BASE_DIR}"
-cd "${DST_BASE_DIR}"
-ABS_BASE_DIR=$(pwd)
-URL=${BASE_URL}
-mywget "${URL}"/KEYS
-
-DST_VER_DIR=${VER}
-URL=${BASE_URL}/${VER}
-if [ ${IS_RC} ]; then
- DST_VER_DIR=${DST_VER_DIR}/${RC_SFX}
- URL=${URL}/${RC_SFX}
-fi
-
-mkdir -p "${DST_VER_DIR}"
-cd "${DST_VER_DIR}"
-mywget "${URL}"/README.md
-mywget "${URL}"/RELEASE_NOTES
-getSignedAndHashedBundle "${URL}"/apache-plc4x-"${VER}"-source-release.zip
-getSignedBundle "${URL}"/apache-plc4x-parent-"${VER}"-sbom.json
-getSignedBundle "${URL}"/apache-plc4x-parent-"${VER}"-sbom.xml
-
-echo
-echo Done Downloading to "${DST_BASE_DIR}"
-
-[ ${VALIDATE} == 0 ] && exit
-[ ${VALIDATE} == 1 ] || [ ${NQUERY} ] || confirm "Do you want to check the
bundle signatures and compare source bundles?" || exit
-
-cd "${ABS_BASE_DIR}"
-
-echo
-echo "If the following bundle gpg signature checks fail, you may need to"
-echo "import the project's list of signing keys to your keyring"
-echo " $ gpg ${DST_BASE_DIR}/KEYS # show the included keys"
-echo " $ gpg --import ${DST_BASE_DIR}/KEYS"
-
-echo
-echo "Verifying the source bundle signatures..."
-(set -x; "$BUILDTOOLS_DIR"/check_sigs.sh "${DST_VER_DIR}")
diff --git a/tools/release-0-update-generated-code.sh
b/tools/release-0-update-generated-code.sh
index 08f60e87d7..ead4aa63eb 100755
--- a/tools/release-0-update-generated-code.sh
+++ b/tools/release-0-update-generated-code.sh
@@ -73,31 +73,73 @@ done
# Delete the PLC4C code (local)
echo " - Deleting: $DIRECTORY/plc4c/generated-sources"
rm -r "$DIRECTORY/plc4c/generated-sources"
-# TODO: delete the generated code for go, c# and python.
+# Delete the PLC4Go code (local)
+echo " - Deleting: generated files in $DIRECTORY/plc4c/generated-sources"
+find "$DIRECTORY/plc4go/protocols" -mindepth 2 -type f ! -name
'StaticHelper.go' -exec rm -v {} \;
+echo " - Deleting: generated files in $DIRECTORY/plc4net/drivers"
+for dir in "$DIRECTORY/plc4net/drivers"/*; do
+ # Delete generated classes
+ if [[ -d "$dir" && ! "$(basename "$dir")" =~ -test$ ]]; then
+ SRC_DIR="$dir/src"
+ if [[ -d "$SRC_DIR" ]]; then
+ echo "๐งน Deleting files in: $SRC_DIR"
+ find "$SRC_DIR" -type f -exec rm -v {} \;
+ fi
+ else
+ SRC_DIR="$dir/resources"
+ if [[ -d "$SRC_DIR" ]]; then
+ echo "๐งน Deleting files in: $SRC_DIR"
+ find "$SRC_DIR" -type f -exec rm -v {} \;
+ fi
+ fi
+done
+
+########################################################################################################################
+# 4. Make sure the NOTICE file has the current year in the second line
+########################################################################################################################
+
+NOTICE_FILE="../NOTICE"
+CURRENT_YEAR=$(date +%Y)
+EXPECTED="Copyright 2017-${CURRENT_YEAR} The Apache Software Foundation"
+
+# Extract the second line
+SECOND_LINE=$(sed -n '2p' "$NOTICE_FILE")
-# TODO: Possibly check, if the year in the NOTICE is outdated
+if [[ "$SECOND_LINE" != "$EXPECTED" ]]; then
+ echo "โ๏ธ Updating $NOTICE_FILE"
+
+ # Replace line 2 with the expected text
+ awk -v expected="$EXPECTED" 'NR==2 {$0=expected} {print}' "$NOTICE_FILE" >
"$NOTICE_FILE.tmp" &&
+ mv "$NOTICE_FILE.tmp" "$NOTICE_FILE"
+else
+ echo "โ
$NOTICE_FILE is already up to date."
+fi
########################################################################################################################
-# 4. Run the maven build for all modules with "update-generated-code" enabled
(Docker container)
+# 5 Run the maven build for all modules with "update-generated-code" enabled
(Docker container)
########################################################################################################################
-docker compose build
+if ! docker compose build; then
+ echo "โ Got non-0 exit code from building the release docker container,
aborting."
+ exit 1
+fi
+
if ! docker compose run releaser bash /ws/mvnw -e -P
with-c,with-dotnet,with-go,with-java,with-python,enable-all-checks,update-generated-code
-Dmaven.repo.local=/ws/out/.repository clean package -DskipTests; then
- echo "โ Got non-0 exit code from docker compose, aborting."
+ echo "โ Got non-0 exit code from running the code-generation inside
docker, aborting."
exit 1
fi
########################################################################################################################
-# 5. Make sure the generated driver documentation is up-to-date.
+# 6. Make sure the generated driver documentation is up-to-date.
########################################################################################################################
if ! docker compose run releaser bash /ws/mvnw -e -P with-java
-Dmaven.repo.local=/ws/out/.repository clean site -pl :plc4j-driver-all; then
- echo "โ Got non-0 exit code from docker compose, aborting."
+ echo "โ Got non-0 exit code from running the site code-generation inside
docker, aborting."
exit 1
fi
########################################################################################################################
-# 6. Commit and push any changed files
+# 7. Commit and push any changed files
########################################################################################################################
if [[ $(git status --porcelain) ]]; then
diff --git a/tools/release-1-create-branch.sh b/tools/release-1-create-branch.sh
index bc2a989147..4b62b5e34d 100755
--- a/tools/release-1-create-branch.sh
+++ b/tools/release-1-create-branch.sh
@@ -46,27 +46,6 @@ echo "Release Version: '$RELEASE_VERSION'"
echo "Release Branch Name: '$BRANCH_NAME'"
echo "New develop Version: '$NEW_VERSION'"
-########################################################################################################################
-# 2. Make sure the NOTICE file has the current year in the second line
-########################################################################################################################
-
-NOTICE_FILE="../NOTICE"
-CURRENT_YEAR=$(date +%Y)
-EXPECTED="Copyright 2017-${CURRENT_YEAR} The Apache Software Foundation"
-
-# Extract the second line
-SECOND_LINE=$(sed -n '2p' "$NOTICE_FILE")
-
-if [[ "$SECOND_LINE" != "$EXPECTED" ]]; then
- echo "โ๏ธ Updating $NOTICE_FILE"
-
- # Replace line 2 with the expected text
- awk -v expected="$EXPECTED" 'NR==2 {$0=expected} {print}' "$NOTICE_FILE" >
"$NOTICE_FILE.tmp" &&
- mv "$NOTICE_FILE.tmp" "$NOTICE_FILE"
-else
- echo "โ
$NOTICE_FILE is already up to date."
-fi
-
########################################################################################################################
# 3. Ask if the RELEASE_NOTES have been filled out at all (local)
########################################################################################################################
@@ -93,7 +72,10 @@ fi
# 5 Remove the "(Unreleased)" prefix from the current version of the
RELEASE_NOTES file (local)
########################################################################################################################
-sed -i '' "s/(Unreleased) Apache PLC4X $PROJECT_VERSION*/Apache PLC4X
$RELEASE_VERSION/" ../RELEASE_NOTES
+if ! sed -i '' "s/(Unreleased) Apache PLC4X $PROJECT_VERSION*/Apache PLC4X
$RELEASE_VERSION/" ../RELEASE_NOTES; then
+ echo "โ Got non-0 exit code from updating RELEASE_NOTES, aborting."
+ exit 1
+fi
########################################################################################################################
# 6. Add a new section for the new version to the RELEASE_NOTES file (local)
@@ -115,25 +97,40 @@ Bug Fixes\n\
==============================================================\n\
"
echo NEW_VERSION
-sed -i '' "1s/.*/$NEW_HEADER/" ../RELEASE_NOTES
+if ! sed -i '' "1s/.*/$NEW_HEADER/" ../RELEASE_NOTES; then
+ echo "โ Got non-0 exit code from adding a new header to RELEASE_NOTES,
aborting."
+ exit 1
+fi
########################################################################################################################
# 7. Commit the change (local)
########################################################################################################################
-git add --all
-git commit -m "chore: prepared the RELEASE_NOTES for the next version."
+if ! git add --all; then
+ echo "โ Got non-0 exit code from adding all changes files, aborting."
+ exit 1
+fi
+if ! git commit -m "chore: prepared the RELEASE_NOTES for the next version.";
then
+ echo "โ Got non-0 exit code from committing changes files, aborting."
+ exit 1
+fi
########################################################################################################################
# 8. Push the changes (local)
########################################################################################################################
-git push
+if ! git push; then
+ echo "โ Got non-0 exit code from pushing changes, aborting."
+ exit 1
+fi
########################################################################################################################
# 9. Switch to the release branch (local)
########################################################################################################################
-git checkout "$BRANCH_NAME"
+if ! git checkout "$BRANCH_NAME"; then
+ echo "โ Got non-0 exit code from switching branches to the release branch,
aborting."
+ exit 1
+fi
echo "โ
Release branch creation complete. We have switched the local branch to
the release branch. Please continue with 'release-2-prepare-release.sh' as soon
as the release branch is ready for being released."
\ No newline at end of file
diff --git a/tools/release-2-prepare-release.sh
b/tools/release-2-prepare-release.sh
index 65364e017f..cfa1fd69b2 100755
--- a/tools/release-2-prepare-release.sh
+++ b/tools/release-2-prepare-release.sh
@@ -21,10 +21,13 @@
DIRECTORY=$(pwd)
+########################################################################################################################
# 0. Check if there are uncommitted changes as these would automatically be
committed (local)
+########################################################################################################################
+
if [[ $(git status --porcelain) ]]; then
# Changes
- echo "There are untracked files or changed files, aborting."
+ echo "โ There are untracked files or changed files, aborting."
exit 1
fi
@@ -33,11 +36,92 @@ RELEASE_VERSION=${PROJECT_VERSION%"-SNAPSHOT"}
IFS='.' read -ra VERSION_SEGMENTS <<< "$RELEASE_VERSION"
NEW_VERSION="${VERSION_SEGMENTS[0]}.${VERSION_SEGMENTS[1]}.$((VERSION_SEGMENTS[2]
+ 1))-SNAPSHOT"
+########################################################################################################################
# 1. Do a simple release-prepare command
+########################################################################################################################
+
if ! docker compose run releaser bash /ws/mvnw -e -P
with-c,with-dotnet,with-go,with-java,with-python,enable-all-checks,update-generated-code
-Dmaven.repo.local=/ws/out/.repository release:prepare
-DautoVersionSubmodules=true -DreleaseVersion="$RELEASE_VERSION"
-DdevelopmentVersion="$NEW_VERSION" -Dtag="v$RELEASE_VERSION"; then
- echo "Got non-0 exit code from docker compose, aborting."
+ echo "โ Got non-0 exit code from docker compose, aborting."
exit 1
fi
+########################################################################################################################
# 2. Push the changes (local)
-git push
\ No newline at end of file
+########################################################################################################################
+
+if ! git push; then
+ echo "โ Got non-0 exit code from pushing changes to git, aborting."
+ exit 1
+fi
+
+########################################################################################################################
+# 3. Do a simple release-perform command skip signing of artifacts and deploy
to local directory (inside the Docker container)
+########################################################################################################################
+
+echo "Performing Release:"
+docker compose build
+if ! docker compose run releaser bash /ws/mvnw -e
-Dmaven.repo.local=/ws/out/.repository
-DaltDeploymentRepository=snapshot-repo::default::file:/ws/out/.local-artifacts-dir
release:perform; then
+ echo "โ Got non-0 exit code from docker compose, aborting."
+ exit 1
+fi
+
+########################################################################################################################
+# 4. Sign all artifacts
+########################################################################################################################
+
+echo "Signing artifacts:"
+find ../out/.local-artifacts-dir -print | grep -E
'^((.*\.pom)|(.*\.jar)|(.*\.kar)|(.*\.nar)|(.*-features\.xml)|(.*-cyclonedx\.json)|(.*-cyclonedx\.xml)|(.*-site\.xml)|(.*\.zip))$'
| while read -r line ; do
+ echo "Processing $line"
+ if ! gpg -ab "$line"; then
+ echo "โ Got non-0 exit code from signing artifact, aborting."
+ exit 1
+ fi
+done
+
+########################################################################################################################
+# 5. Deploy the artifacts to Nexus
+########################################################################################################################
+
+echo "Deploying artifacts:"
+if ! ../mvnw -f ../jenkins.pom -X -P deploy-releases wagon:upload; then
+ echo "โ Got non-0 exit code from staging artifacts, aborting."
+ exit 1
+fi
+
+########################################################################################################################
+# 6. Prepare a directory for the release candidate
+########################################################################################################################
+
+echo "Staging release candidate:"
+read -r -p 'Release-Candidate number: ' rcNumber
+RELEASE_CANDIDATE="rc$rcNumber"
+RELEASE_VERSION=$(find
../out/.local-artifacts-dir/org/apache/plc4x/plc4x-parent/ -maxdepth 1 -type d
| grep -vE 'plc4x-parent/$' | xargs -n 1 basename)
+mkdir -p "../out/stage/${RELEASE_VERSION}/${RELEASE_CANDIDATE}"
+cp ../README.md "../out/stage/${RELEASE_VERSION}/${RELEASE_CANDIDATE}/README"
+cp ../RELEASE_NOTES "../out/stage/${RELEASE_VERSION}/${RELEASE_CANDIDATE}"
+cp
"../out/.local-artifacts-dir/org/apache/plc4x/plc4x-parent/${RELEASE_VERSION}/plc4x-parent-${RELEASE_VERSION}-source-release.zip"
"../out/stage/${RELEASE_VERSION}/${RELEASE_CANDIDATE}/apache-plc4x-${RELEASE_VERSION}-source-release.zip"
+cp
"../out/.local-artifacts-dir/org/apache/plc4x/plc4x-parent/${RELEASE_VERSION}/plc4x-parent-${RELEASE_VERSION}-source-release.zip.asc"
"../out/stage/${RELEASE_VERSION}/${RELEASE_CANDIDATE}/apache-plc4x-${RELEASE_VERSION}-source-release.zip.asc"
+cp
"../out/.local-artifacts-dir/org/apache/plc4x/plc4x-parent/${RELEASE_VERSION}/plc4x-parent-${RELEASE_VERSION}-source-release.zip.sha512"
"../out/stage/${RELEASE_VERSION}/${RELEASE_CANDIDATE}/apache-plc4x-${RELEASE_VERSION}-source-release.zip.sha512"
+cp
"../out/.local-artifacts-dir/org/apache/plc4x/plc4x-parent/${RELEASE_VERSION}/plc4x-parent-${RELEASE_VERSION}-cyclonedx.json"
"../out/stage/${RELEASE_VERSION}/${RELEASE_CANDIDATE}/apache-plc4x-${RELEASE_VERSION}-cyclonedx.json"
+cp
"../out/.local-artifacts-dir/org/apache/plc4x/plc4x-parent/${RELEASE_VERSION}/plc4x-parent-${RELEASE_VERSION}-cyclonedx.json.asc"
"../out/stage/${RELEASE_VERSION}/${RELEASE_CANDIDATE}/apache-plc4x-${RELEASE_VERSION}-cyclonedx.json.asc"
+cp
"../out/.local-artifacts-dir/org/apache/plc4x/plc4x-parent/${RELEASE_VERSION}/plc4x-parent-${RELEASE_VERSION}-cyclonedx.xml"
"../out/stage/${RELEASE_VERSION}/${RELEASE_CANDIDATE}/apache-plc4x-${RELEASE_VERSION}-cyclonedx.xml"
+cp
"../out/.local-artifacts-dir/org/apache/plc4x/plc4x-parent/${RELEASE_VERSION}/plc4x-parent-${RELEASE_VERSION}-cyclonedx.xml.asc"
"../out/stage/${RELEASE_VERSION}/${RELEASE_CANDIDATE}/apache-plc4x-${RELEASE_VERSION}-cyclonedx.xml.asc"
+
+########################################################################################################################
+# 7. Upload the release candidate artifacts to SVN
+########################################################################################################################
+
+cd "../out/stage/${RELEASE_VERSION}" || exit
+svn import "${RELEASE_CANDIDATE}"
"https://dist.apache.org/repos/dist/dev/plc4x/${RELEASE_VERSION}/${RELEASE_CANDIDATE}"
-m"Staging of ${RELEASE_CANDIDATE} of PLC4X ${RELEASE_VERSION}"
+
+########################################################################################################################
+# 8. TODO: Make sure the currently used GPG key is available in the KEYS file
+########################################################################################################################
+
+########################################################################################################################
+# 9. TODO: Close the Nexus staging repository
+########################################################################################################################
+
+########################################################################################################################
+# 10. TODO: Send out the [VOTE] and [DISCUSS] emails
+########################################################################################################################
diff --git a/tools/release-3-perform-release.sh
b/tools/release-3-perform-release.sh
deleted file mode 100755
index a1e56553be..0000000000
--- a/tools/release-3-perform-release.sh
+++ /dev/null
@@ -1,65 +0,0 @@
-#!/usr/bin/env bash
-
-# ----------------------------------------------------------------------------
-# 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
-#
-# https://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, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-# ----------------------------------------------------------------------------
-
-# 0. Check if the release properties file exists.
-
-# 1. Do a simple release-perform command skip signing of artifacts and deploy
to local directory (inside the Docker container)
-echo "Performing Release:"
-docker compose build
-if ! docker compose run releaser bash /ws/mvnw -e
-Dmaven.repo.local=/ws/out/.repository
-DaltDeploymentRepository=snapshot-repo::default::file:/ws/out/.local-artifacts-dir
release:perform; then
- echo "Got non-0 exit code from docker compose, aborting."
- exit 1
-fi
-
-# 2. Sign all artifacts
-echo "Signing artifacts:"
-find ../out/.local-artifacts-dir -print | grep -E
'^((.*\.pom)|(.*\.jar)|(.*\.kar)|(.*\.nar)|(.*-features\.xml)|(.*-cyclonedx\.json)|(.*-cyclonedx\.xml)|(.*-site\.xml)|(.*\.zip))$'
| while read -r line ; do
- echo "Processing $line"
- gpg -ab "$line"
-done
-
-# 3. Deploy the artifacts to Nexus
-echo "Deploying artifacts:"
-../mvnw -f ../jenkins.pom -X -P deploy-releases wagon:upload
-
-# 4. Prepare a directory for the release candidate
-echo "Staging release candidate:"
-read -r -p 'Release-Candidate number: ' rcNumber
-RELEASE_CANDIDATE="rc$rcNumber"
-RELEASE_VERSION=$(find
../out/.local-artifacts-dir/org/apache/plc4x/plc4x-parent/ -maxdepth 1 -type d
| grep -vE 'plc4x-parent/$' | xargs -n 1 basename)
-mkdir -p "../out/stage/${RELEASE_VERSION}/${RELEASE_CANDIDATE}"
-cp ../README.md "../out/stage/${RELEASE_VERSION}/${RELEASE_CANDIDATE}/README"
-cp ../RELEASE_NOTES "../out/stage/${RELEASE_VERSION}/${RELEASE_CANDIDATE}"
-cp
"../out/.local-artifacts-dir/org/apache/plc4x/plc4x-parent/${RELEASE_VERSION}/plc4x-parent-${RELEASE_VERSION}-source-release.zip"
"../out/stage/${RELEASE_VERSION}/${RELEASE_CANDIDATE}/apache-plc4x-${RELEASE_VERSION}-source-release.zip"
-cp
"../out/.local-artifacts-dir/org/apache/plc4x/plc4x-parent/${RELEASE_VERSION}/plc4x-parent-${RELEASE_VERSION}-source-release.zip.asc"
"../out/stage/${RELEASE_VERSION}/${RELEASE_CANDIDATE}/apache-plc4x-${RELEASE_VERSION}-source-release.zip.asc"
-cp
"../out/.local-artifacts-dir/org/apache/plc4x/plc4x-parent/${RELEASE_VERSION}/plc4x-parent-${RELEASE_VERSION}-source-release.zip.sha512"
"../out/stage/${RELEASE_VERSION}/${RELEASE_CANDIDATE}/apache-plc4x-${RELEASE_VERSION}-source-release.zip.sha512"
-cp
"../out/.local-artifacts-dir/org/apache/plc4x/plc4x-parent/${RELEASE_VERSION}/plc4x-parent-${RELEASE_VERSION}-cyclonedx.json"
"../out/stage/${RELEASE_VERSION}/${RELEASE_CANDIDATE}/apache-plc4x-${RELEASE_VERSION}-cyclonedx.json"
-cp
"../out/.local-artifacts-dir/org/apache/plc4x/plc4x-parent/${RELEASE_VERSION}/plc4x-parent-${RELEASE_VERSION}-cyclonedx.json.asc"
"../out/stage/${RELEASE_VERSION}/${RELEASE_CANDIDATE}/apache-plc4x-${RELEASE_VERSION}-cyclonedx.json.asc"
-cp
"../out/.local-artifacts-dir/org/apache/plc4x/plc4x-parent/${RELEASE_VERSION}/plc4x-parent-${RELEASE_VERSION}-cyclonedx.xml"
"../out/stage/${RELEASE_VERSION}/${RELEASE_CANDIDATE}/apache-plc4x-${RELEASE_VERSION}-cyclonedx.xml"
-cp
"../out/.local-artifacts-dir/org/apache/plc4x/plc4x-parent/${RELEASE_VERSION}/plc4x-parent-${RELEASE_VERSION}-cyclonedx.xml.asc"
"../out/stage/${RELEASE_VERSION}/${RELEASE_CANDIDATE}/apache-plc4x-${RELEASE_VERSION}-cyclonedx.xml.asc"
-
-# 5. Upload the release candidate artifacts to SVN
-cd "../out/stage/${RELEASE_VERSION}" || exit
-svn import "${RELEASE_CANDIDATE}"
"https://dist.apache.org/repos/dist/dev/plc4x/${RELEASE_VERSION}/${RELEASE_CANDIDATE}"
-m"Staging of ${RELEASE_CANDIDATE} of PLC4X ${RELEASE_VERSION}"
-
-# 6. Close the Nexus staging repository
-
-# 7. Send out the [VOTE] and [DISCUSS] emails
\ No newline at end of file
diff --git a/tools/validate-release.sh b/tools/validate-release.sh
index 7a1c50defc..885ec25f4d 100755
--- a/tools/validate-release.sh
+++ b/tools/validate-release.sh
@@ -19,13 +19,42 @@
# under the License.
# ----------------------------------------------------------------------------
-# 0. Check if the release properties file exists.
+########################################################################################################################
+# 0. Check Docker Memory Availability
+########################################################################################################################
+
+# Minimum required memory in bytes (12 GB)
+REQUIRED_MEM=$((12 * 1024 * 1024 * 1024))
+
+# Extract total memory from `docker system info`
+TOTAL_MEM=$(docker system info --format '{{.MemTotal}}')
+
+# Check if TOTAL_MEM was retrieved successfully
+if [[ -z "$TOTAL_MEM" || "$TOTAL_MEM" -eq 0 ]]; then
+ echo "โ Unable to determine total Docker memory. Is Docker running?"
+ exit 1
+fi
+
+# Compare and exit if not enough memory
+if (( TOTAL_MEM < REQUIRED_MEM )); then
+ echo "โ Docker runtime has insufficient memory: $(awk "BEGIN {printf
\"%.2f\", $TOTAL_MEM/1024/1024/1024}") GB"
+ echo " At least 12 GB is required. Aborting."
+ exit 1
+fi
+
+########################################################################################################################
+# 1. Check if the release properties file exists.
+########################################################################################################################
+
+########################################################################################################################
+# 2. Do a simple release-perform command skip signing of artifacts and deploy
to local directory
+# (inside the Docker container)
+########################################################################################################################
-# 1. Do a simple release-perform command skip signing of artifacts and deploy
to local directory (inside the Docker container)
echo "Validate Release:"
docker compose build
-if ! docker compose run releaser bash /ws/mvnw -e
-Dmaven.repo.local=/ws/out/.repository
-Dreference.repo=https://repository.apache.org/content/repositories/staging/
-Dbuildinfo.reproducible verify artifact:compare;
+if ! docker compose run releaser bash /ws/mvnw -e -P with-java
-Dmaven.repo.local=/ws/out/.repository
-Dreference.repo=https://repository.apache.org/content/repositories/staging/
-Dbuildinfo.reproducible verify artifact:compare;
then
- echo "Got non-0 exit code from docker compose, aborting."
+ echo "โ Got non-0 exit code from docker compose, aborting."
exit 1
fi