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

chirino pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/main by this push:
     new 9dc1e2dbfa1 CAMEL-20814: Publish buildinfo and provide a build 
container to improve release reproducibility. (#14275)
9dc1e2dbfa1 is described below

commit 9dc1e2dbfa1f2d36c36e3e45afd16e8b485d6215
Author: Hiram Chirino <hi...@hiramchirino.com>
AuthorDate: Thu May 30 09:51:21 2024 -0400

    CAMEL-20814: Publish buildinfo and provide a build container to improve 
release reproducibility. (#14275)
    
    This allows you to `./builder mvn install` on a unix type system with only 
docker installed to do a camel build.  This has the added benefit of using a 
consistent JDK/Maven version which should aid in build reproducibility.
---
 Dockerfile | 29 +++++++++++++++++++++++++++++
 builder    | 34 ++++++++++++++++++++++++++++++++++
 pom.xml    | 21 +++++++++++++++++++++
 3 files changed, 84 insertions(+)

diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 00000000000..39c1ef97aae
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,29 @@
+#
+# 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.
+#
+
+# This has a JDK and Maven we can use.
+FROM registry.access.redhat.com/ubi9/openjdk-21
+USER root
+
+#
+# the builder script will run this container under as your uid:guid so that 
the files it creates
+# in the host env are owned by you, lets make sure there is uid:guid to match 
in the container.
+RUN for i in $(seq 50 184); do echo 
"default$i:x:$i:$i:default:/home/default:/bin/bash" >> /etc/passwd; done; 
+RUN for i in $(seq 186 2000); do echo 
"default$i:x:$i:$i:default:/home/default:/bin/bash" >> /etc/passwd; done
+
+CMD ["/bin/bash"]
+WORKDIR /src
\ No newline at end of file
diff --git a/builder b/builder
new file mode 100755
index 00000000000..4cecc1767a1
--- /dev/null
+++ b/builder
@@ -0,0 +1,34 @@
+#!/bin/sh
+# ----------------------------------------------------------------------------
+# 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.
+# ----------------------------------------------------------------------------
+set -e
+
+# This script gives you a reproducible build enviroment, since the enviroment 
is containerizedL
+# Example usage: ./builder mvn clean install -Dquickly
+
+docker build . -t apache-camel-builder
+
+# Run the builder container as the current user, and mount his home dirs
+# so that host .m2 repos can be reused and provide access to release gpg keys 
and such.
+docker run --rm -it \
+    --user "`id -u`:`id -g`" \
+    -v "`pwd`:/src" \
+    -v "${HOME}:/home/default" \
+    -v "${HOME}:${HOME}" \
+    apache-camel-builder $*
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 8d8105ef7f7..370562adef4 100644
--- a/pom.xml
+++ b/pom.xml
@@ -134,6 +134,7 @@
         
<maven-remote-resources-plugin-version>3.2.0</maven-remote-resources-plugin-version>
         <maven-surefire-plugin-version>3.2.5</maven-surefire-plugin-version>
         <versions-maven-plugin-version>2.16.2</versions-maven-plugin-version>
+        <maven-artifact-plugin-version>3.5.1</maven-artifact-plugin-version>
 
         <camel.javadoc.offline>false</camel.javadoc.offline>
 
@@ -214,6 +215,24 @@
                     <outputDirectory>target</outputDirectory>
                 </configuration>
             </plugin>
+
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-artifact-plugin</artifactId>
+                <version>${maven-artifact-plugin-version}</version>
+                <executions>
+                    <execution>
+                        <id>buildinfo</id>
+                        <phase>verify</phase>
+                        <goals>
+                            <goal>buildinfo</goal>
+                        </goals>
+                        <configuration>
+                            <attach>true</attach>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
         </plugins>
 
         <pluginManagement>
@@ -327,6 +346,8 @@
                                     <exclude>camel-sbom/*.xml</exclude>
                                     <exclude>doap.rdf</exclude>
                                     <exclude>mvnw*</exclude>
+                                    <exclude>Dockerfile</exclude>
+                                    <exclude>builder*</exclude>
                                 </excludes>
                             </licenseSet>
                         </licenseSets>

Reply via email to