Skip to content

Commit

Permalink
build: Continued fine-tuning the reproducible build release-scripts.
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisdutz committed Mar 13, 2024
1 parent a89d016 commit 645eeba
Show file tree
Hide file tree
Showing 9 changed files with 139 additions and 8 deletions.
2 changes: 1 addition & 1 deletion build-reproducible.sh
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ function renameArtifacts() {
pwd
}

# Package the remaiing files into one tgz archive
# Package the remaining files into one tgz archive
function packageDirectory() {
echo "Packaging ..."
tar -cvf reproducible-build-candidate.tgz local-snapshots-dir/
Expand Down
22 changes: 22 additions & 0 deletions tools/NOTES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<!--
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
2 changes: 1 addition & 1 deletion tools/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ services:
releaser:
build:
context: ..
dockerfile: Dockerfile
dockerfile: ./Dockerfile
# Builds all modules and uses an alternate maven local repo and deploys artifacts to a local directory.
command: ["/ws/mvnw", "-e", "-Dskip-pgp-signing=true", "-P", "with-c,with-dotnet,with-go,with-java,with-python,with-sandbox,enable-all-checks,apache-release", "-Dmaven.repo.local=/ws/out/.repository", "-DaltDeploymentRepository=snapshot-repo::default::file:/ws/out/.local-snapshots-dir", "clean", "deploy"]
volumes:
Expand Down
5 changes: 3 additions & 2 deletions tools/release-0-update-generated-code.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,15 @@ rm -r "$DIRECTORY/plc4c/generated-sources"
# TODO: Possibly check, if the year in the NOTICE is outdated

# 3. Run the maven build for all modules with "update-generated-code" enabled (Docker container)
docker compose run --rm releaser bash /ws/mvnw -e -P with-c,with-dotnet,with-go,with-java,with-python,with-sandbox,enable-all-checks,update-generated-code -Dmaven.repo.local=/ws/out/.repository clean package -DskipTests
docker compose build
docker compose run releaser bash /ws/mvnw -e -P with-c,with-dotnet,with-go,with-java,with-python,with-sandbox,enable-all-checks,update-generated-code -Dmaven.repo.local=/ws/out/.repository clean package -DskipTests
if [ $? -ne 0 ]; then
echo "Got non-0 exit code from docker compose, aborting."
exit 1
fi

# 4. Make sure the generated driver documentation is up-to-date.
docker compose run --rm releaser bash /ws/mvnw -e -P with-java -Dmaven.repo.local=/ws/out/.repository clean site -pl :plc4j-driver-all
docker compose run releaser bash /ws/mvnw -e -P with-java -Dmaven.repo.local=/ws/out/.repository clean site -pl :plc4j-driver-all
if [ $? -ne 0 ]; then
echo "Got non-0 exit code from docker compose, aborting."
exit 1
Expand Down
2 changes: 1 addition & 1 deletion tools/release-1-create-branch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ case $yn in
esac

# 3. Do a simple maven branch command with pushChanges=false
../mvnw -f ../pom.xml -e -P with-c,with-dotnet,with-go,with-java,with-python,with-sandbox,enable-all-checks,update-generated-code -Dmaven.repo.local=$DIRECTORY/../out/.repository release:branch -DautoVersionSubmodules=true -DpushChanges=false -DdevelopmentVersion="$NEW_VERSION" -DbranchName="$BRANCH_NAME"
docker compose run releaser bash /ws/mvnw -e -P with-c,with-dotnet,with-go,with-java,with-python,with-sandbox,enable-all-checks,update-generated-code -Dmaven.repo.local=/ws/out/.repository release:branch -DautoVersionSubmodules=true -DpushChanges=false -DdevelopmentVersion="$NEW_VERSION" -DbranchName="$BRANCH_NAME"
if [ $? -ne 0 ]; then
echo "Got non-0 exit code from docker compose, aborting."
exit 1
Expand Down
2 changes: 1 addition & 1 deletion tools/release-2-prepare-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ 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
../mvnw -f ../pom.xml -e -P with-c,with-dotnet,with-go,with-java,with-python,with-sandbox,enable-all-checks,update-generated-code -Dmaven.repo.local=$DIRECTORY/../out/.repository release:prepare -DautoVersionSubmodules=true -DreleaseVersion="$RELEASE_VERSION" -DdevelopmentVersion="$NEW_VERSION" -Dtag="v$RELEASE_VERSION"
docker compose run releaser bash /ws/mvnw -e -P with-c,with-dotnet,with-go,with-java,with-python,with-sandbox,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"
if [ $? -ne 0 ]; then
echo "Got non-0 exit code from docker compose, aborting."
exit 1
Expand Down
3 changes: 2 additions & 1 deletion tools/release-3-perform-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@

# 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 run --rm releaser bash /ws/mvnw -e -Dmaven.repo.local=/ws/out/.repository -DaltDeploymentRepository=snapshot-repo::default::file:/ws/out/.local-artifacts-dir release:perform
docker compose build
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
if [ $? -ne 0 ]; then
echo "Got non-0 exit code from docker compose, aborting."
exit 1
Expand Down
2 changes: 1 addition & 1 deletion tools/release-abort.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ DIRECTORY=$(pwd)
PRE_RELEASE_VERSION=0.12.0-SNAPSHOT

# Set the local development version back to the initial one.
../mvnw -f ../pom.xml -e -P with-c,with-dotnet,with-go,with-java,with-python,with-sandbox,update-generated-code -Dmaven.repo.local="$DIRECTORY/../out/.repository" versions:set -DnewVersion="$PRE_RELEASE_VERSION"
docker compose run releaser bash /ws/mvnw -e -P with-c,with-dotnet,with-go,with-java,with-python,with-sandbox,update-generated-code -Dmaven.repo.local=/ws/out/.repository versions:set -DnewVersion="$PRE_RELEASE_VERSION"

# Delete left-over files from the last attempt.
find .. -type f -name 'release.properties' -delete
Expand Down
107 changes: 107 additions & 0 deletions tools/validate-release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
#!/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
#
# 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, 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.
#

#
# 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
#
# 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.
#

#
# 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
#
# 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.
#

#
# 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
#
# 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.
#

# ----------------------------------------------------------------------------
# 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 "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;
then
echo "Got non-0 exit code from docker compose, aborting."
exit 1
fi

0 comments on commit 645eeba

Please sign in to comment.