-
Notifications
You must be signed in to change notification settings - Fork 138
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#3360] Create native executable command line client
The build jobs have been changed to consistently use the eclipse/hono-builder container image for building Hono. This image contains specific versions of Maven, the GraalVM SDK with the native-image compiler plugin and the UPX tool for compressing binary artifacts. The release build job has been extended with an additional invocation of mvn clean install used to build the native executable of the CLI. The native executable needs to be built in a separate run because in the first build the JAR file artifacts are being signed by the Eclipse JAR signer service which results in signature errors during the native executable build. Signed-off-by: Kai Hudalla <kai.hudalla@bosch.io>
- Loading branch information
1 parent
bba7910
commit 0dfa63c
Showing
5 changed files
with
530 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
# Copyright (c) 2022 Contributors to the Eclipse Foundation | ||
# | ||
# See the NOTICE file(s) distributed with this work for additional | ||
# information regarding copyright ownership. | ||
# | ||
# This program and the accompanying materials are made available under the | ||
# terms of the Eclipse Public Li2cense 2.0 which is available at | ||
# http://www.eclipse.org/legal/epl-2.0 | ||
# | ||
# SPDX-License-Identifier: EPL-2.0 | ||
|
||
# This Dockerfile is based on https://github.com/findepi/graalvm-docker. | ||
# It has been adapted to use Mandrel instead of Oracle's GraalVM distribution and has been | ||
# extended with steps for installing Maven, GnuPG (required for creating signatures of | ||
# artifacts to be deployed to Maven Central) and UPX. | ||
# The resulting image can be used to build Hono from source, including the native executable | ||
# of the hono-cli artifact. | ||
|
||
FROM debian:stable-slim | ||
|
||
ARG MANDREL_VERSION=22.2.0.0-Final | ||
# either java11 or java17 | ||
ARG JDK_VERSION=java17 | ||
ARG MVN_VERSION=3.8.6 | ||
|
||
ENV GRAALVM_HOME=/graalvm | ||
ENV MAVEN_HOME=/maven | ||
ENV JAVA_HOME=${GRAALVM_HOME} | ||
|
||
RUN set -xeu && \ | ||
export DEBIAN_FRONTEND=noninteractive && \ | ||
apt-get update && \ | ||
apt-get install -y --no-install-recommends \ | ||
ca-certificates \ | ||
git \ | ||
curl \ | ||
gcc \ | ||
g++ \ | ||
libfreetype6-dev \ | ||
libz-dev \ | ||
gpg \ | ||
pinentry-tty \ | ||
openssh-client \ | ||
upx-ucl \ | ||
&& \ | ||
mkdir ${GRAALVM_HOME} && \ | ||
curl -fsSL "https://github.com/graalvm/mandrel/releases/download/mandrel-${MANDREL_VERSION}/mandrel-${JDK_VERSION}-linux-amd64-${MANDREL_VERSION}.tar.gz" \ | ||
| tar -zxC ${GRAALVM_HOME} --strip-components 1 && \ | ||
find ${GRAALVM_HOME} -name "*src.zip" -printf "Deleting %p\n" -exec rm {} + && \ | ||
{ test ! -d ${GRAALVM_HOME}/legal || tar czf ${GRAALVM_HOME}/legal.tgz ${GRAALVM_HOME}/legal/; } && \ | ||
{ test ! -d ${GRAALVM_HOME}/legal || rm -r ${GRAALVM_HOME}/legal; } && \ | ||
rm -rf ${GRAALVM_HOME}/man `# does not exist in java11 package` && \ | ||
mkdir ${MAVEN_HOME} && \ | ||
curl -fsSL "https://dlcdn.apache.org/maven/maven-3/${MVN_VERSION}/binaries/apache-maven-${MVN_VERSION}-bin.tar.gz" \ | ||
| tar -zxC ${MAVEN_HOME} --strip-components 1 && \ | ||
echo Cleaning up... && \ | ||
apt-get remove -y \ | ||
curl \ | ||
&& \ | ||
apt-get autoremove -y && \ | ||
apt-get clean && rm -r "/var/lib/apt/lists"/* && \ | ||
echo 'PATH="${GRAALVM_HOME}/bin:$PATH"' | install --mode 0644 /dev/stdin /etc/profile.d/graal-on-path.sh && \ | ||
echo 'PATH="${MAVEN_HOME}/bin:$PATH"' | install --mode 0644 /dev/stdin /etc/profile.d/maven-on-path.sh && \ | ||
echo OK | ||
|
||
# This applies to all container processes. However, `bash -l` will source `/etc/profile` and set $PATH on its own. For this reason, we | ||
# *also* set $PATH in /etc/profile.d/* | ||
ENV PATH=${GRAALVM_HOME}/bin:${MAVEN_HOME}/bin:$PATH | ||
ENV SHELL=/bin/bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2022 Contributors to the Eclipse Foundation | ||
* | ||
* See the NOTICE file(s) distributed with this work for additional | ||
* information regarding copyright ownership. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License 2.0 which is available at | ||
* http://www.eclipse.org/legal/epl-2.0 | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
*******************************************************************************/ | ||
|
||
/** | ||
* Jenkins pipeline script for Hono release including the CLI native executable. | ||
* | ||
*/ | ||
|
||
pipeline { | ||
agent { | ||
kubernetes { | ||
yamlFile 'jenkins/HonoBuilderPod.yaml' | ||
defaultContainer 'hono-builder' | ||
} | ||
} | ||
|
||
options { | ||
buildDiscarder(logRotator(numToKeepStr: '3')) | ||
disableConcurrentBuilds() | ||
timeout(time: 45, unit: 'MINUTES') | ||
} | ||
|
||
parameters { | ||
string( | ||
name: "BRANCH", | ||
description: "The branch to build and release from.\nExamples:\n refs/heads/master\nrefs/heads/1.4.x", | ||
defaultValue: "refs/heads/master", | ||
trim: true) | ||
} | ||
|
||
stages { | ||
|
||
stage("Check build environment") { | ||
steps { | ||
sh '''#!/bin/bash | ||
printenv SHELL | ||
git --version | ||
mvn --version | ||
java --version | ||
native-image --version | ||
upx --version | ||
''' | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.