Skip to content

Commit

Permalink
Jenkins DSL
Browse files Browse the repository at this point in the history
  • Loading branch information
Karm committed Dec 16, 2020
1 parent 3682639 commit 47b1fca
Show file tree
Hide file tree
Showing 17 changed files with 2,251 additions and 0 deletions.
10 changes: 10 additions & 0 deletions jenkins/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Mandrel Jenkins jobs

Mandrel jobs use [Jenkins Job DSL](https://github.com/jenkinsci/job-dsl-plugin), a Groovy-based DSL.

Useful links:

- [Job DSL API viewer on Jenkins](https://ci.modcluster.io/plugin/job-dsl/api-viewer/index.html)

## Update job
- If you run [mandrel-jobs](https://ci.modcluster.io/job/mandrel-jobs/) you regenerate Jenkins jobs definitions.
84 changes: 84 additions & 0 deletions jenkins/jobs/graal_windows_quarkus_tests.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
matrixJob('graal-windows-quarkus-tests') {
axes {
text('GRAAL_VERSION',
'20.3.0',
'20.2.0'
)
text('QUARKUS_VERSION',
'1.10.2.Final',
'master'
)
labelExpression('LABEL', ['w2k19'])
}
description('Run Quarkus TS with GraalVM distros.')
displayName('Windows (Graal) :: Quarkus TS')
logRotator {
numToKeep(3)
}
childCustomWorkspace('${SHORT_COMBINATION}')
wrappers {
timestamps()
timeout {
absolute(360)
}
}
combinationFilter('(GRAAL_VERSION=="20.3.0" && QUARKUS_VERSION=="master") ||' +
' (GRAAL_VERSION=="20.2.0" && QUARKUS_VERSION=="1.10.2.Final")')
parameters {
stringParam('QUARKUS_REPO', 'https://github.com/quarkusio/quarkus.git', 'Quarkus repository.')
}
steps {
batchFile('''
REM Prepare Mandrel
@echo off
call vcvars64
IF NOT %ERRORLEVEL% == 0 ( exit 1 )
set "GRAALVM_HOME=C:\\Program Files\\graalvm-ce-java11-%GRAAL_VERSION%"
set "JAVA_HOME=%GRAALVM_HOME%"
set "PATH=%JAVA_HOME%\\bin;%PATH%"
if not exist "%GRAALVM_HOME%\\bin\\native-image.cmd" (
echo "Cannot find native-image tool. Quitting..."
exit 1
) else (
echo "native-image.cmd is present, good."
cmd /C native-image --version
)
REM Prepare Quarkus
git clone %QUARKUS_REPO%
cd quarkus
git fetch --tags
git checkout %QUARKUS_VERSION%
REM Build and test Quarkus
set "MODULES=-pl !google-cloud-functions,!google-cloud-functions-http,!kubernetes/maven-invoker-way,!kubernetes-client"
mvnw clean install -DskipTests -pl '!docs' & mvnw verify -f integration-tests/pom.xml --fail-at-end --batch-mode -DfailIfNoTests=false -Dnative %MODULES%
''')
}
publishers {
archiveJunit('**/target/*-reports/*.xml') {
allowEmptyResults(false)
retainLongStdout(false)
healthScaleFactor(1.0)
}
archiveArtifacts('**/target/*-reports/*.xml')

extendedEmail {
recipientList('[email protected]')
triggers {
failure {
sendTo {
recipientList()
attachBuildLog(true)
}
}
}
}
wsCleanup()
}
}
180 changes: 180 additions & 0 deletions jenkins/jobs/mandrel_20_1_linux_build.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,180 @@
job('mandrel-20.1-linux-build') {
label 'centos8'
displayName('Linux Build :: 20.1')
description('''
Linux build for 20.1 branch.
''')
logRotator {
numToKeep(5)
}
parameters {
choiceParam(
'REPOSITORY',
[
'https://github.com/graalvm/mandrel.git',
'https://github.com/jerboaa/graal.git',
'https://github.com/Karm/graal.git',
'https://github.com/zakkak/mandrel.git',
],
'Mandrel repo'
)
choiceParam(
'HEADS_OR_TAGS',
[
'heads',
'tags',

],
'To be used with the repository, e.g. to use a certain head or a tag.'
)
stringParam(
'BRANCH_OR_TAG',
'mandrel/20.1',
'e.g. your PR branch or a specific tag such as 20.1'
)
choiceParam(
'OPENJDK',
[
'openjdk-11.0.9_11',
'openjdk-11-ea',
'openjdk-11-latest'

],
'OpenJDK including Static libs'
)
choiceParam(
'PACKAGING_REPOSITORY',
[
'https://github.com/mandrel/mandrel-packaging.git',
'https://github.com/zakkak/mandrel-packaging.git',
'https://github.com/Karm/mandrel-packaging.git'

],
'Mandrel packaging scripts.'
)
choiceParam(
'PACKAGING_REPOSITORY_HEADS_OR_TAGS',
[
'heads',
'tags',

],
'To be used with the repository, e.g. to use a certain head or a tag.'
)
stringParam(
'PACKAGING_REPOSITORY_BRANCH_OR_TAG',
'20.1',
'e.g. master if you use heads or some tag if you use tags.'
)
stringParam(
'MANDREL_VERSION_SUBSTRING',
'20.1-SNAPSHOT',
'''Used as a part of Mandrel version, i.e. <pre>export MANDREL_VERSION="${MANDREL_VERSION_SUBSTRING}
git rev.: $( git log --pretty=format:%h -n1 ) </pre> it defaults to <pre>${BRANCH_OR_TAG}</pre>.
Could be e.g. 20.1.0.0.Alpha1. It must not contain spaces as it is used in tarball name too.'''
)
}
multiscm {
git {
remote {
url('${PACKAGING_REPOSITORY}')
}
branches('refs/${PACKAGING_REPOSITORY_HEADS_OR_TAGS}/${PACKAGING_REPOSITORY_BRANCH_OR_TAG}')
extensions {
localBranch('${PACKAGING_REPOSITORY_BRANCH_OR_TAG}')
}
}
git {
remote {
url('${REPOSITORY}')
}
branches('refs/${HEADS_OR_TAGS}/${BRANCH_OR_TAG}')
extensions {
localBranch('${BRANCH_OR_TAG}')
relativeTargetDirectory('mandrel')
}
}
git {
remote {
url('https://github.com/graalvm/mx.git')
}
branches('*/master')
extensions {
localBranch('master')
relativeTargetDirectory('mx')
}
}
}
triggers {
scm('H H/2 * * *')
}
steps {
shell('echo MANDREL_VERSION_SUBSTRING=${MANDREL_VERSION_SUBSTRING}')
buildDescription(/MANDREL_VERSION_SUBSTRING=([^\s]*)/, '\\1')
shell('''
export MAVEN_REPO=${HOME}/.m2/repository
export MANDREL_REPO=${WORKSPACE}/mandrel
export JAVA_HOME=/usr/java/${OPENJDK}
export MX_HOME=${WORKSPACE}/mx
export PATH=${JAVA_HOME}/bin:${MX_HOME}:${PATH}
pushd mandrel
export MANDREL_VERSION="${MANDREL_VERSION_SUBSTRING} $( git log --pretty=format:%h -n1)"
export MANDREL_VERSION_UNTIL_SPACE="$( echo ${MANDREL_VERSION} | sed -e 's/\\([^ ]*\\).*/\\1/;t' )"
export JAVA_VERSION="$(java --version | sed -e 's/.*build \\([^) ]*\\)).*/\\1/;t;d' )"
export MANDREL_HOME=${WORKSPACE}/mandrel-java11-${MANDREL_VERSION_UNTIL_SPACE}
popd
${JAVA_HOME}/bin/java -ea build.java --maven-local-repository ${MAVEN_REPO} \\
--mandrel-repo ${MANDREL_REPO} --mx-home ${MX_HOME} \\
--mandrel-version ${MANDREL_VERSION} --mandrel-home ${MANDREL_HOME} \\
--archive-suffix tar.gz
TAR_NAME="$( ls mandrel-*.tar.gz )"
sha1sum ${TAR_NAME}>${TAR_NAME}.sha1
sha256sum ${TAR_NAME}>${TAR_NAME}.sha256
cat >./MANDREL.md <<EOL
This is a dev build of Mandrel from https://github.com/graalvm/mandrel.
Mandrel ${MANDREL_VERSION}
OpenJDK used: ${JAVA_VERSION}
EOL
if [[ ! -e "${MANDREL_HOME}/bin/native-image" ]]; then
echo "Cannot find native-image tool. Quitting..."
exit 1
fi
cat >./Hello.java <<EOL
public class Hello {
public static void main(String[] args) {
System.out.println("Hello.");
}
}
EOL
export JAVA_HOME=${MANDREL_HOME}
export PATH=${JAVA_HOME}/bin:${PATH}
javac Hello.java
native-image Hello
if [[ "`./hello`" == "Hello." ]]; then echo Done; else echo Native image fail;exit 1;fi
''')
}
publishers {
archiveArtifacts('*.tar.gz,MANDREL.md,*.sha1,*.sha256')
wsCleanup()
extendedEmail {
recipientList('[email protected],[email protected]')
triggers {
failure {
sendTo {
recipientList()
attachBuildLog(true)
}
}
}
}
downstreamParameterized {
trigger(['mandrel-linux-quarkus-tests/LABEL=el8,MANDREL_VERSION=20.1,QUARKUS_VERSION=1.7.5.Final/',
'mandrel-linux-integration-tests/MANDREL_VERSION=20.1,label=el8']) {
condition('SUCCESS')
parameters {
currentBuild()
}
}
}
}
}
Loading

0 comments on commit 47b1fca

Please sign in to comment.