Skip to content

Commit

Permalink
Record Launchable builds (#1918)
Browse files Browse the repository at this point in the history
* Record Launchable builds

* Fix formatting and update incremental

* Try trimming the session?
  • Loading branch information
basil committed Mar 31, 2023
1 parent 1e30dd0 commit 67d3cda
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 4 deletions.
19 changes: 16 additions & 3 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@ stage('prep') {
mavenEnv(jdk: 11) {
checkout scm
withEnv(['SAMPLE_PLUGIN_OPTS=-Dset.changelist']) {
sh 'bash prep.sh'
withCredentials([
usernamePassword(credentialsId: 'app-ci.jenkins.io', usernameVariable: 'GITHUB_APP', passwordVariable: 'GITHUB_OAUTH')
]) {
sh 'bash prep.sh'
}
}
dir('target') {
plugins = readFile('plugins.txt').split('\n')
Expand All @@ -39,7 +43,14 @@ stage('prep') {
lines = [lines[0], lines[-1]] // run PCT only on newest and oldest lines, to save resources
}
stash name: 'pct', includes: 'pct.jar'
lines.each {stash name: "megawar-$it", includes: "megawar-${it}.war"}
lines.each { line ->
def commitHashes = readFile "commit-hashes-${line}.txt"
launchable.install()
launchable("record build --name \"${BUILD_TAG}-${line}\" --no-commit-collection " + commitHashes)
launchable("record session --build \"${BUILD_TAG}-${line}\" --observation >launchable-session-${line}.txt")
stash name: "megawar-${line}", includes: "megawar-${line}.war"
stash name: "launchable-session-${line}.txt", includes: "launchable-session-${line}.txt"
}
}
stash name: 'pct.sh', includes: 'pct.sh'
stash name: 'excludes.txt', includes: 'excludes.txt'
Expand All @@ -56,14 +67,16 @@ lines.each {line ->
deleteDir()
unstash 'pct.sh'
unstash 'excludes.txt'
unstash "launchable-session-${line}.txt"
unstash 'pct'
unstash "megawar-$line"
launchable.install()
launchable('verify')
withEnv(["PLUGINS=$plugin", "LINE=$line", 'EXTRA_MAVEN_PROPERTIES=maven.test.failure.ignore=true:surefire.rerunFailingTestsCount=4']) {
sh 'mv megawar-$LINE.war megawar.war && bash pct.sh'
}
launchable("record tests --no-build maven './**/target/surefire-reports'")
def launchableSession = readFile("launchable-session-${line}.txt").trim()
launchable("record tests --session ${launchableSession} maven './**/target/surefire-reports'") // TODO add failsafe reports
}
}
}
Expand Down
16 changes: 15 additions & 1 deletion prep.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,20 @@ for LINE in $LINEZ; do
cd "megawar-${LINE}"
jar c0Mf "../../../target/megawar-${LINE}.war" *
popd
if [[ ${LINE} != weekly ]]; then
PROFILE="-P${LINE}"
fi
# TODO https://github.com/jenkinsci/maven-hpi-plugin/pull/464
$MVN \
-f sample-plugin \
hpi:resolve-test-dependencies \
${SAMPLE_PLUGIN_OPTS:-} \
${PROFILE:-} \
-DoverrideWar="../target/megawar-${LINE}.war" \
-DuseUpperBounds \
-Dhpi-plugin.version=3.42-rc1409.669de6d1a_866 \
-DcommitHashes=target/commit-hashes.txt
mv sample-plugin/target/commit-hashes.txt "target/commit-hashes-${LINE}.txt"
done

# Tracked by ./updatecli/updatecli.d/plugin-compat-tester.yml
Expand All @@ -46,4 +60,4 @@ pct="$($MVN -Dset.changelist -Dexpression=settings.localRepository -q -DforceStd
[ -f "${pct}" ] || $MVN dependency:get -Dartifact=org.jenkins-ci.tests:plugins-compat-tester-cli:${version}:jar -DremoteRepositories=repo.jenkins-ci.org::default::https://repo.jenkins-ci.org/public/,incrementals::default::https://repo.jenkins-ci.org/incrementals/ -Dtransitive=false
cp "${pct}" target/pct.jar

# produces: target/{megawar-*.war,pct.jar,plugins.txt,lines.txt}
# produces: target/{megawar-*.war,commit-hashes-*.txt,pct.jar,plugins.txt,lines.txt}

0 comments on commit 67d3cda

Please sign in to comment.