Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync 6.x to master - 30/01/2022 #23774

Merged
merged 17 commits into from
Feb 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
252 changes: 143 additions & 109 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2018-2021 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2022 Contributors to the Eclipse Foundation
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
Expand All @@ -14,147 +15,137 @@
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
*/


// the label is unique and identifies the pod descriptor and its resulting pods
// without this, the agent could be using a pod created from a different descriptor
env.label = "glassfish-ci-pod-${UUID.randomUUID().toString()}"

// list of test ids
def jobs = [
"cdi_all",
"ql_gf_full_profile_all",
"ql_gf_web_profile_all",
"web_jsp"
]

// Docker image defined in this project in [glassfish]/etc/docker/Dockerfile
env.gfImage = "ee4jglassfish/ci:tini-jdk-11.0.10"

def jobs_all = [
def jobs = [
"verifyPhase",
"cdi_all",
"ql_gf_full_profile_all",
"ql_gf_web_profile_all",
"web_jsp",

"deployment_all",
"ejb_group_1",
"ejb_group_2",
"ejb_group_3",
"ejb_web_all",
"ql_gf_nucleus_all",
"nucleus_admin_all",
"jdbc_all",
"batch_all",
"persistence_all",
"connector_group_1",
"connector_group_2",
"connector_group_3",
"connector_group_4"
"ejb_group_embedded"
]

def parallelStagesMap = jobs.collectEntries {
["${it}": generateStage(it)]
}

def generateStage(job) {
return {
podTemplate(label: env.label) {
node(label) {
stage("${job}") {
container('glassfish-ci') {
// do the scm checkout
retry(10) {
sleep 60
checkout scm
}

// run the test
unstash 'build-bundles'

try {
retry(3) {
timeout(time: 2, unit: 'HOURS') {
sh """
export CLASSPATH=$WORKSPACE/glassfish7/javadb
./appserver/tests/gftest.sh run_test ${job}
"""
}
}
} finally {
// archive what we can...
archiveArtifacts artifacts: "${job}-results.tar.gz"
junit testResults: 'results/junitreports/*.xml', allowEmptyResults: false
}
}
}
if (job == 'verifyPhase') {
return generateMvnPodTemplate(job)
} else {
return generateAntPodTemplate(job)
}
}

def generateMvnPodTemplate(job) {
return {
podTemplate(
inheritFrom: "${env.label}",
containers: [
containerTemplate(
name: "glassfish-build",
image: "${env.gfImage}",
resourceRequestMemory: "7Gi",
resourceRequestCpu: "2650m"
)
]
) {
node(label) {
stage("${job}") {
container('glassfish-build') {
retry(5) {
sleep 1
checkout scm
}
timeout(time: 1, unit: 'HOURS') {
sh """
mvn clean install
"""
junit testResults: '**/*-reports/*.xml', allowEmptyResults: false
}
}
}
}
}
}
}

pipeline {

options {
// keep at most 50 builds
buildDiscarder(logRotator(numToKeepStr: '10'))

// preserve the stashes to allow re-running a test stage
preserveStashes()

// issue related to default 'implicit' checkout, disable it
skipDefaultCheckout()

// abort pipeline if previous stage is unstable
skipStagesAfterUnstable()

// show timestamps in logs
timestamps()

// global timeout, abort after 6 hours
timeout(time: 6, unit: 'HOURS')
def generateAntPodTemplate(job) {
return {
podTemplate(
inheritFrom: "${env.label}",
containers: [
containerTemplate(
name: "glassfish-build",
image: "${env.gfImage}",
resourceRequestMemory: "4Gi",
resourceRequestCpu: "2650m"
)
]
) {
node(label) {
stage("${job}") {
container('glassfish-build') {
retry(5) {
sleep 1
checkout scm
}
unstash 'build-bundles'
try {
timeout(time: 1, unit: 'HOURS') {
sh """
export CLASSPATH=$WORKSPACE/glassfish6/javadb
./appserver/tests/gftest.sh run_test ${job}
"""
}
} finally {
archiveArtifacts artifacts: "${job}-results.tar.gz"
junit testResults: 'results/junitreports/*.xml', allowEmptyResults: false
}
}
}
}
}
}
}

pipeline {

agent {
kubernetes {
label "${env.label}"
defaultContainer 'glassfish-ci'
yaml """
apiVersion: v1
kind: Pod
metadata:
spec:
volumes:
- name: "jenkins-home"
emptyDir: {}
- name: maven-repo-shared-storage
persistentVolumeClaim:
claimName: glassfish-maven-repo-storage
- name: settings-xml
secret:
secretName: m2-secret-dir
items:
- key: settings.xml
path: settings.xml
- name: settings-security-xml
secret:
secretName: m2-secret-dir
items:
- key: settings-security.xml
path: settings-security.xml
- name: maven-repo-local-storage
emptyDir: {}
containers:
- name: jnlp
image: jenkins/jnlp-slave:alpine
image: jenkins/inbound-agent:4.11-1-alpine-jdk11
imagePullPolicy: IfNotPresent
env:
- name: JAVA_TOOL_OPTIONS
value: -Xmx1G
value: "-Xmx768m -Xss768k"
resources:
# fixes random failure: minimum cpu usage per Pod is 200m, but request is 100m.
# affects performance on large repositories
limits:
memory: "1Gi"
cpu: "1"
- name: glassfish-ci
# Docker image defined in this project in [glassfish]/etc/docker/Dockerfile
image: ee4jglassfish/ci:tini-jdk-11.0.10
memory: "1200Mi"
cpu: "300m"
requests:
memory: "1200Mi"
cpu: "300m"
- name: glassfish-build
image: ${env.gfImage}
args:
- cat
tty: true
Expand All @@ -177,13 +168,38 @@ spec:
mountPath: "/home/jenkins/.m2/repository/org/glassfish/main"
env:
- name: "MAVEN_OPTS"
value: "-Duser.home=/home/jenkins"
value: "-Duser.home=/home/jenkins -Xmx2500m -Xss768k -XX:+UseStringDeduplication"
- name: "MVN_EXTRA"
value: "--batch-mode -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn"
- name: JAVA_TOOL_OPTIONS
value: "-Xmx2g -Xss768k -XX:+UseStringDeduplication"
resources:
limits:
memory: "12Gi"
cpu: "8000m"
requests:
memory: "7Gi"
cpu: "3"
cpu: "4000m"
volumes:
- name: "jenkins-home"
emptyDir: {}
- name: maven-repo-shared-storage
persistentVolumeClaim:
claimName: glassfish-maven-repo-storage
- name: settings-xml
secret:
secretName: m2-secret-dir
items:
- key: settings.xml
path: settings.xml
- name: settings-security-xml
secret:
secretName: m2-secret-dir
items:
- key: settings-security.xml
path: settings-security.xml
- name: maven-repo-local-storage
emptyDir: {}
"""
}
}
Expand All @@ -198,21 +214,37 @@ spec:
PORT_HTTPS=8181
}

options {
buildDiscarder(logRotator(numToKeepStr: '10'))

// to allow re-running a test stage
preserveStashes()

// issue related to default 'implicit' checkout, disable it
skipDefaultCheckout()

// abort pipeline if previous stage is unstable
skipStagesAfterUnstable()

// show timestamps in logs
timestamps()

// global timeout, abort after 6 hours
timeout(time: 6, unit: 'HOURS')
}

stages {

stage('build') {
agent {
kubernetes {
label "${env.label}"
}
}
steps {
container('glassfish-ci') {
container('glassfish-build') {
timeout(time: 1, unit: 'HOURS') {

// do the scm checkout
checkout scm

// do the build
sh '''
echo Maven version
mvn -v
Expand All @@ -223,10 +255,12 @@ spec:
echo Uname
uname -a

bash -xe ./gfbuild.sh build_re_dev
# Until we fix ANTLR in cmp-support-sqlstore, broken in parallel builds. Just -Pfast after the fix.
mvn clean install -Pfastest,staging -T4C
./gfbuild.sh archive_bundles
ls -la ./bundles
'''
archiveArtifacts artifacts: 'bundles/*.zip'
// junit testResults: 'test-results/build-unit-tests/results/junitreports/test_results_junit.xml'
stash includes: 'bundles/*', name: 'build-bundles'
}
}
Expand Down
Loading