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

2.176.2 #20

Merged
merged 8 commits into from
Jul 19, 2019
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
11 changes: 6 additions & 5 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,12 @@ def plugins
stage('prep') {
mavenEnv {
checkout scm
// TODO rename to prep.sh & pct.sh, respectively, for clarity
sh 'bash ci-1.sh'
sh 'bash prep.sh'
dir('sample-plugin/target') {
plugins = readFile('plugins.txt').split(' ')
stash name: 'pct', includes: 'megawar.war,pct.jar'
}
stash name: 'ci', includes: 'ci-2.sh'
stash name: 'ci', includes: 'pct.sh'
}
}

Expand All @@ -40,8 +39,8 @@ plugins.each { plugin ->
deleteDir()
unstash 'ci'
unstash 'pct'
withEnv(["PLUGIN=$plugin"]) {
sh 'bash ci-2.sh'
withEnv(["PLUGINS=$plugin"]) {
sh 'bash pct.sh'
}
warnError('some plugins could not be run in PCT') {
sh 'if fgrep -q "<status>INTERNAL_ERROR</status>" pct-report.xml; then echo PCT failed; exit 1; fi'
Expand All @@ -50,3 +49,5 @@ plugins.each { plugin ->
}
}
parallel branches

// TODO incrementalify and publish
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,11 @@ and the specified Jenkins LTS version.
If there is a PCT failure, fix it in the plugin with the failing test,
and when that fix is released, try updating the BOM again.

TODO could use a script to run the full build locally with just a single plugin and a single test.
To reproduce a PCT failure locally, use something like

```sh
PLUGINS=structs,mailer TEST=InjectedTest bash local-test.sh
```

## LTS lines

Expand Down
35 changes: 35 additions & 0 deletions bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,16 @@
<artifactId>apache-httpcomponents-client-4-api</artifactId>
<version>4.5.5-3.0</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>command-launcher</artifactId>
<version>1.3</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>credentials</artifactId>
<version>2.2.0</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>display-url-api</artifactId>
Expand All @@ -76,11 +86,26 @@
<artifactId>durable-task</artifactId>
<version>1.30</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>jdk-tool</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>junit</artifactId>
<version>1.28</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>mailer</artifactId>
<version>1.23</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>matrix-project</artifactId>
<version>1.14</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>scm-api</artifactId>
Expand All @@ -91,6 +116,16 @@
<artifactId>script-security</artifactId>
<version>1.61</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>ssh-credentials</artifactId>
<version>1.17.1</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>ssh-slaves</artifactId>
<version>1.29.4</version> <!-- TODO cannot use 1.30.0 pending https://github.com/jenkinsci/durable-task-plugin/pull/100 -->
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>structs</artifactId>
Expand Down
31 changes: 0 additions & 31 deletions ci-2.sh

This file was deleted.

19 changes: 19 additions & 0 deletions local-test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash
set -euxo pipefail
cd $(dirname $0)

# expects: $PLUGINS, optionally $TEST

export SAMPLE_PLUGIN_OPTS=-Dtest=InjectedTest
bash prep.sh

rm -rf target/local-test
mkdir target/local-test
cp -v sample-plugin/target/{megawar.war,pct.jar} pct.sh target/local-test

cd target/local-test
if [ -v TEST ]
then
export EXTRA_MAVEN_PROPERTIES="test=$TEST"
fi
bash pct.sh
48 changes: 48 additions & 0 deletions pct.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/bin/bash
set -euxo pipefail
cd $(dirname $0)

# expects: megawar.war, pct.war, $PLUGINS

rm -rf pct-work pct-report.xml

if [ -v MAVEN_SETTINGS ]
then
PCT_S_ARG="-m2SettingsFile $MAVEN_SETTINGS"
else
PCT_S_ARG=
fi

MAVEN_PROPERTIES=org.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn:jth.jenkins-war.path=$(pwd)/megawar.war
Copy link
Member Author

Choose a reason for hiding this comment

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

if [ -v EXTRA_MAVEN_PROPERTIES ]
then
MAVEN_PROPERTIES="$MAVEN_PROPERTIES:$EXTRA_MAVEN_PROPERTIES"
fi

java -jar pct.jar \
-war $(pwd)/megawar.war \
-includePlugins $PLUGINS \
-workDirectory $(pwd)/pct-work \
-reportFile $(pwd)/pct-report.xml \
-mvn $(which mvn) \
$PCT_S_ARG \
-mavenProperties "$MAVEN_PROPERTIES" \
Copy link
Member Author

Choose a reason for hiding this comment

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

-skipTestCache true

# TODO https://github.com/jenkinsci/workflow-cps-plugin/pull/302
rm -fv pct-work/workflow-cps/target/surefire-reports/TEST-org.jenkinsci.plugins.workflow.cps.SnippetizerTest.xml
# TODO https://github.com/jenkinsci/structs-plugin/pull/50
rm -fv pct-work/structs-plugin/plugin/target/surefire-reports/TEST-org.jenkinsci.plugins.structs.describable.DescribableModelTest.xml
# TODO https://github.com/jenkinsci/jenkins/pull/4120 problems with workflow-cps → jquery-detached:
Copy link
Member Author

Choose a reason for hiding this comment

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

rm -fv pct-work/structs-plugin/plugin/target/surefire-reports/TEST-InjectedTest.xml
Copy link
Member Author

Choose a reason for hiding this comment

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

Does not suffice, it seems: probably is also seen in apache-httpcomponents-client-4-api. Still unclear on why it appears only on certain plugins. At first I thought it was just those which do not have a test dep on workflow-cps, but display-url-api passes. Have yet to find a workaround, since the bad jquery-detached dependency appears in the test classpath and so gets copied to the test $JENKINS_HOME/plugins/ regardless of the megawar.

rm -fv pct-work/apache-httpcomponents-client-4-api/target/surefire-reports/TEST-InjectedTest.xml
rm -fv pct-work/ssh-slaves/target/surefire-reports/TEST-InjectedTest.xml
# TODO https://github.com/jenkinsci/matrix-project-plugin/pull/59
Copy link
Member Author

Choose a reason for hiding this comment

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

rm -fv pct-work/matrix-project/target/surefire-reports/TEST-InjectedTest.xml
# TODO https://github.com/jenkinsci/jenkins/pull/4099 pending backport to 2.176.3
Copy link
Member Author

Choose a reason for hiding this comment

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

rm -fv pct-work/command-launcher/target/surefire-reports/TEST-hudson.slaves.CommandLauncher2Test.xml
# TODO pending ssh-slaves 1.30.0 with https://github.com/jenkinsci/ssh-slaves-plugin/pull/114 (plus https://github.com/jenkinsci/durable-task-plugin/pull/100):
Copy link
Member Author

Choose a reason for hiding this comment

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

rm -fv pct-work/ssh-slaves/target/surefire-reports/TEST-hudson.plugins.sshslaves.verifiers.VerificationStrategyConfigurationTest.xml
rm -fv pct-work/ssh-slaves/target/surefire-reports/TEST-hudson.plugins.sshslaves.SSHLauncherTest.xml

# produces: pct-report.xml, **/target/surefire-reports/TEST-*.xml
2 changes: 0 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,12 @@
<url>https://opensource.org/licenses/MIT</url>
</license>
</licenses>
<!-- TODO
<scm>
<connection>scm:git:git@github.com/jenkinsci/${project.artifactId}.git</connection>
<developerConnection>scm:git:ssh://git@github.com/jenkinsci/${project.artifactId}.git</developerConnection>
<url>https://github.com/jenkinsci/${project.artifactId}</url>
<tag>HEAD</tag>
</scm>
-->
<modules>
<module>bom</module>
<module>sample-plugin</module>
Expand Down
6 changes: 4 additions & 2 deletions ci-1.sh → prep.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@ then
MVN="$MVN -s $MAVEN_SETTINGS"
fi

$MVN -Dmaven.test.failure.ignore install
$MVN -Dmaven.test.failure.ignore install ${SAMPLE_PLUGIN_OPTS:-}

cd sample-plugin/target
cp -r jenkins-for-test megawar
# TODO check if removing detached-plugins is still necessary, given use of explicit -includePlugins
mkdir jenkins
echo '# nothing' > jenkins/split-plugins.txt
jar uvf megawar/WEB-INF/lib/jenkins-core-*.jar jenkins/split-plugins.txt
rm -rfv megawar/WEB-INF/detached-plugins megawar/META-INF/*.{RSA,SF}
mkdir megawar/WEB-INF/plugins
cp -rv test-classes/test-dependencies/*.hpi megawar/WEB-INF/plugins
Expand Down
9 changes: 7 additions & 2 deletions sample-plugin/check.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,18 @@ assert artifactMap['junit:junit'] == project.artifactMap['junit:junit']
def managedPluginDeps = managedDeps.collect {stripAllButGA(it)}.grep { ga ->
def art = artifactMap[ga]
if (art == null) {
println "Do not see managed dependency $ga"
return false
if (ga.contains('.plugins:')) { // TODO without an Artifact, we have no reliable way of checking whether it is actually a plugin
throw new org.apache.maven.plugin.MojoFailureException("Managed plugin dependency $ga not listed in test classpath of sample plugin")
} else {
println "Do not see managed dependency $ga"
return false
}
}
pluginName(art) != null
}
if (managedPluginDeps != managedPluginDeps.toSorted()) {
throw new org.apache.maven.plugin.MojoFailureException("Managed plugin dependencies should be sorted: $managedPluginDeps")
// TODO also check sorting of sample plugin dependencies
}

project.artifacts.each { art ->
Expand Down
22 changes: 21 additions & 1 deletion sample-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<version>2.176.1-SNAPSHOT</version>
<packaging>hpi</packaging>
<properties>
<jenkins.version>2.176.1</jenkins.version>
<jenkins.version>2.176.2</jenkins.version>
<java.level>8</java.level>
</properties>
<dependencyManagement>
Expand Down Expand Up @@ -57,6 +57,26 @@
<classifier>tests</classifier>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>matrix-project</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>command-launcher</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>ssh-slaves</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>jdk-tool</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
Expand Down