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

Record Launchable builds #1918

Merged
merged 3 commits into from
Mar 31, 2023
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a prototype, so it is probably OK to consume an incremental build here. But if others feel strongly otherwise, I can release a new version of Maven HPI plugin, update the plugin parent POM to consume it, and remove the -Dhpi-plugin.version hack from this file. I have a feeling this code might change again soon, so this seems easier for now, but it is harmless to have this -DcommitHashes option in Maven HPI plugin since this is the only consumer.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is just fine for this stage of the prototype.

$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}