diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 00000000..4768633d --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1 @@ +* @jenkinsci/parameterized-trigger-plugin-developers diff --git a/.github/dependabot.yml b/.github/dependabot.yml index e1d1cc74..6356eb50 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,10 +1,16 @@ +# https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuring-dependabot-version-updates +--- version: 2 updates: - package-ecosystem: "maven" directory: "/" + labels: + - "dependencies" schedule: - interval: "weekly" + interval: "monthly" - package-ecosystem: "github-actions" directory: "/" + labels: + - "skip-changelog" schedule: - interval: "weekly" + interval: "monthly" diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml index 4ece1c1a..93a5521d 100644 --- a/.github/workflows/release-drafter.yml +++ b/.github/workflows/release-drafter.yml @@ -7,6 +7,6 @@ jobs: update_release_draft: runs-on: ubuntu-latest steps: - - uses: release-drafter/release-drafter@v5.18.1 + - uses: release-drafter/release-drafter@v5.25.0 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml deleted file mode 100644 index 49f73e8e..00000000 --- a/.github/workflows/stale.yml +++ /dev/null @@ -1,15 +0,0 @@ -name: 'Close stale PR' -on: - schedule: - - cron: '30 1 * * *' - -jobs: - stale: - runs-on: ubuntu-latest - steps: - - uses: actions/stale@v4 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - stale-pr-message: 'This PR is stale because it has been open 365 days with no activity. Remove stale label or comment or this will be closed in 30 days.' - days-before-stale: 365 - days-before-pr-close: 30 diff --git a/.gitpod.yml b/.gitpod.yml new file mode 100644 index 00000000..a096e0db --- /dev/null +++ b/.gitpod.yml @@ -0,0 +1,12 @@ +tasks: + - init: mvn clean verify + +vscode: + extensions: + - bierner.markdown-preview-github-styles + - vscjava.vscode-java-pack + - redhat.java + - vscjava.vscode-java-debug + - vscjava.vscode-java-dependency + - vscjava.vscode-java-test + - vscjava.vscode-maven diff --git a/.mvn/extensions.xml b/.mvn/extensions.xml index a65d82e1..1f363640 100644 --- a/.mvn/extensions.xml +++ b/.mvn/extensions.xml @@ -2,6 +2,6 @@ io.jenkins.tools.incrementals git-changelist-maven-extension - 1.3 + 1.7 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 00000000..a280266e --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,48 @@ +# Contributing to the Parameterized Trigger Plugin + +## Beginner Topics + +Look for contribution areas in the +[issues in our issues tracker](https://issues.jenkins.io/issues/?jql=resolution%20is%20EMPTY%20and%20component%3D15592). + +## Background + +Plugin source code is hosted on https://github.com/jenkinsci/parameterized-trigger-plugin[GitHub]. +New feature proposals and bug fix proposals should be submitted as https://help.github.com/articles/creating-a-pull-request[GitHub pull requests]. +Your pull request will be evaluated by the https://ci.jenkins.io/job/Plugins/job/parameterized-trigger-plugin/[Jenkins job]. + +Before submitting your change, please assure that you've added tests to verify your change. +Tests help us assure that we're delivering a reliable plugin, and that we've communicated our intent to other developers as executable descriptions of plugin behavior. + +## Building and Testing + +Compile and test the plugin with the command: + +* `mvn clean verify` + +Compile the plugin without running tests using the command: + +* `mvn clean -DskipTests verify` + +Code coverage reporting is available as a maven target. +Please try to improve code coverage with tests when you submit. + +* `mvn -P enable-jacoco clean install jacoco:report` to report code coverage + +Please don't introduce new spotbugs output. + +* `mvn spotbugs:check` to analyze project using https://spotbugs.github.io/[Spotbugs]. +* `mvn spotbugs:gui` to review Spotbugs report using GUI + +## Automated Tests + +Automated tests are run as part of the `verify` phase. +Run automated tests with multiple Java virtual machines with the command: + +``` +$ mvn clean -DforkCount=1C verify +``` + +## Issue Reports + +Please report issues and enhancements through the [Jenkins issue tracker](https://www.jenkins.io/participate/report-issue/redirect/#15592). diff --git a/Jenkinsfile b/Jenkinsfile index 36248761..71ce5ff1 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,6 +1,11 @@ -// Builds a module using https://github.com/jenkins-infra/pipeline-library -buildPlugin(useAci: true, configurations: [ - [ platform: "linux", jdk: "8" ], - [ platform: "windows", jdk: "8" ], - [ platform: "linux", jdk: "11" ] +/* + See the documentation for more options: + https://github.com/jenkins-infra/pipeline-library/ +*/ +buildPlugin( + forkCount: '1C', // Run parallel tests on ci.jenkins.io for lower costs, faster feedback + useContainerAgent: true, // Set to `false` if you need to use Docker for containerized tests + configurations: [ + [platform: 'linux', jdk: 21], + [platform: 'windows', jdk: 17], ]) diff --git a/README.md b/README.md index 6df95dee..80c773fc 100644 --- a/README.md +++ b/README.md @@ -128,3 +128,7 @@ In Windows system, you can modify jenkins.xml placed in the installed folder. --Xrs -Xmx256m -Dhudson.lifecycle=hudson.lifecycle.WindowsServiceLifecycle -jar "%BASE%\\jenkins.war" --httpPort=8080\ +\-Xrs -Xmx256m -Dhudson.lifecycle=hudson.lifecycle.WindowsServiceLifecycle -Dhudson.plugins.parameterizedtrigger.ProjectSpecificParametersActionFactory.compatibility_mode=true -jar "%BASE%\\jenkins.war" --httpPort=8080\ ``` + +# Report an issue + +Please report issues and enhancements through the [Jenkins issue tracker](https://www.jenkins.io/participate/report-issue/redirect/#15592). \ No newline at end of file diff --git a/pom.xml b/pom.xml index fd49e278..2126c934 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ org.jenkins-ci.plugins plugin - 4.31 + 4.75 @@ -26,18 +26,7 @@ org.jenkins-ci.plugins subversion - 2.15.1 true - - - org.jenkins-ci.plugins - ssh-credentials - - - org.jenkins-ci.plugins - structs - - org.jenkins-ci.plugins @@ -57,27 +46,19 @@ org.sonatype.sisu sisu-guice - - org.apache.httpcomponents - httpclient - - - org.apache.httpcomponents - httpcore - - - org.apache.ant - ant - org.jenkins-ci.plugins conditional-buildstep - 1.4.1 true + + org.jenkins-ci.plugins + apache-httpcomponents-client-4-api + test + org.jenkins-ci.plugins.workflow @@ -88,12 +69,6 @@ org.jenkins-ci.plugins.workflow workflow-cps test - - - org.jenkins-ci - symbol-annotation - - org.jenkins-ci.plugins.workflow @@ -119,23 +94,11 @@ org.jenkins-ci.plugins matrix-auth test - - - org.jenkins-ci.plugins.icon-shim - icon-set - - org.mockito mockito-core test - - - org.hamcrest - hamcrest-core - - org.jenkins-ci.plugins @@ -149,14 +112,8 @@ org.awaitility awaitility - 4.1.1 + 4.2.0 test - - - org.hamcrest - hamcrest - - @@ -164,31 +121,11 @@ io.jenkins.tools.bom - bom-2.263.x - 961.vf0c9f6f59827 + bom-2.387.x + 2543.vfb_1a_5fb_9496d import pom - - com.google.errorprone - error_prone_annotations - 2.11.0 - - - org.apache.commons - commons-lang3 - 3.12.0 - - - com.jcraft - jsch.agentproxy.core - 0.0.9 - - - com.jcraft - jsch.agentproxy.connector-factory - 0.0.9 - @@ -214,11 +151,12 @@ - 2.45 + 2.47 -SNAPSHOT jenkinsci/parameterized-trigger-plugin - 8 - 2.270 - false + 2.387.3 + Max + true + Low diff --git a/src/main/java/hudson/plugins/parameterizedtrigger/BlockableBuildTriggerConfig.java b/src/main/java/hudson/plugins/parameterizedtrigger/BlockableBuildTriggerConfig.java index ee181da6..d49d5284 100644 --- a/src/main/java/hudson/plugins/parameterizedtrigger/BlockableBuildTriggerConfig.java +++ b/src/main/java/hudson/plugins/parameterizedtrigger/BlockableBuildTriggerConfig.java @@ -1,5 +1,7 @@ package hudson.plugins.parameterizedtrigger; +import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; + import hudson.Extension; import hudson.Launcher; import hudson.model.AbstractBuild; @@ -13,6 +15,7 @@ import com.google.common.collect.ArrayListMultimap; import com.google.common.collect.ListMultimap; +import hudson.model.Label; import hudson.model.TaskListener; import hudson.model.queue.QueueTaskFuture; @@ -28,6 +31,8 @@ */ public class BlockableBuildTriggerConfig extends BuildTriggerConfig { private final BlockingBehaviour block; + // Field is unused, but would change public API if it were deleted + @SuppressFBWarnings(value = "UUF_UNUSED_PUBLIC_OR_PROTECTED_FIELD", justification = "Part of the public API") public boolean buildAllNodesWithLabel; public BlockableBuildTriggerConfig(String projects, BlockingBehaviour block, List configs) { @@ -90,7 +95,9 @@ protected QueueTaskFuture schedule(AbstractBuild build, Job project, List< } public Collection getNodes() { - return Jenkins.get().getLabel("asrt").getNodes(); + Label label = Jenkins.get().getLabel("asrt"); + if (label==null) return Collections.emptyList(); + return label.getNodes(); } @Extension diff --git a/src/main/java/hudson/plugins/parameterizedtrigger/BlockingBehaviour.java b/src/main/java/hudson/plugins/parameterizedtrigger/BlockingBehaviour.java index 12f24a67..90f5974b 100644 --- a/src/main/java/hudson/plugins/parameterizedtrigger/BlockingBehaviour.java +++ b/src/main/java/hudson/plugins/parameterizedtrigger/BlockingBehaviour.java @@ -32,7 +32,7 @@ import hudson.model.Result; import org.kohsuke.stapler.DataBoundConstructor; -import javax.annotation.CheckForNull; +import edu.umd.cs.findbugs.annotations.CheckForNull; import java.util.Arrays; import java.util.List; diff --git a/src/main/java/hudson/plugins/parameterizedtrigger/BuildTriggerConfig.java b/src/main/java/hudson/plugins/parameterizedtrigger/BuildTriggerConfig.java index 9a1904ac..a81a192b 100644 --- a/src/main/java/hudson/plugins/parameterizedtrigger/BuildTriggerConfig.java +++ b/src/main/java/hudson/plugins/parameterizedtrigger/BuildTriggerConfig.java @@ -42,7 +42,7 @@ import org.kohsuke.stapler.DataBoundConstructor; import org.kohsuke.stapler.QueryParameter; -import javax.annotation.CheckForNull; +import edu.umd.cs.findbugs.annotations.CheckForNull; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; @@ -56,7 +56,7 @@ import java.util.logging.Level; import java.util.logging.Logger; import org.acegisecurity.AccessDeniedException; -import javax.annotation.Nonnull; +import edu.umd.cs.findbugs.annotations.NonNull; import jenkins.security.QueueItemAuthenticator; public class BuildTriggerConfig implements Describable { @@ -141,6 +141,7 @@ public boolean isTriggerFromChildProjects(){ * @deprecated * Use {@link #getJobs(ItemGroup, EnvVars)} */ + @Deprecated public List getProjectList(EnvVars env) { return getProjectList(null, env); } @@ -267,7 +268,7 @@ private static void iterateBuilds(AbstractProject context, String projects, SubP * @return List of readable items, others will be skipped if {@link AccessDeniedException} happens */ private static List readableItemsFromNameList( - ItemGroup context, @Nonnull String list, @Nonnull Class type) { + ItemGroup context, @NonNull String list, @NonNull Class type) { Jenkins hudson = Jenkins.get(); List r = new ArrayList<>(); @@ -418,7 +419,7 @@ public List> perform(AbstractBuild build, L return Collections.emptyList(); } - private void reportSchedulingError(@Nonnull Run run, @Nonnull Job jobToTrigger, @Nonnull BuildListener listener) { + private void reportSchedulingError(@NonNull Run run, @NonNull Job jobToTrigger, @NonNull BuildListener listener) { // Do not print details to Build Listener, they have been reported previously in #canTriggerProject() listener.error("Skipping " + jobToTrigger.getFullName() + "..."); if (LOGGER.isLoggable(Level.CONFIG)) { @@ -543,15 +544,13 @@ protected QueueTaskFuture schedule(AbstractBuild build, final Job project, } @CheckForNull - protected QueueTaskFuture schedule(@Nonnull AbstractBuild build, @Nonnull final Job project, int quietPeriod, - @Nonnull List list, @Nonnull TaskListener listener) throws InterruptedException, IOException { + protected QueueTaskFuture schedule(@NonNull AbstractBuild build, @NonNull final Job project, int quietPeriod, + @NonNull List list, @NonNull TaskListener listener) throws InterruptedException, IOException { // TODO Once it's in core (since 1.621) and LTS is out, switch to use new ParameterizedJobMixIn convenience method // From https://github.com/jenkinsci/jenkins/pull/1771 Cause cause = createUpstreamCause(build); List queueActions = new ArrayList<>(list); - if (cause != null) { - queueActions.add(new CauseAction(cause)); - } + queueActions.add(new CauseAction(cause)); // Includes both traditional projects via AbstractProject and Workflow Job if (project instanceof ParameterizedJobMixIn.ParameterizedJob) { @@ -584,8 +583,8 @@ protected QueueTaskFuture schedule(@Nonnull AbstractBuild build, @Nonnull * @return {@code true} if the project can be scheduled. * {@code false} if there is a lack of permissions, details will be printed to the logs then. */ - /*package*/ static boolean canTriggerProject(@Nonnull AbstractBuild build, - @Nonnull final Job job, @Nonnull TaskListener taskListener) { + /*package*/ static boolean canTriggerProject(@NonNull AbstractBuild build, + @NonNull final Job job, @NonNull TaskListener taskListener) { if (!job.hasPermission(Item.BUILD)) { String message = String.format("Cannot schedule the build of %s from %s. " + "The authenticated build user %s has no Job.BUILD permission", @@ -603,7 +602,7 @@ protected QueueTaskFuture schedule(@Nonnull AbstractBuild build, @Nonnull * @param job Job to be checked * @return true if the job can be scheduled from the */ - protected boolean canBeScheduled(@Nonnull Job job) { + protected boolean canBeScheduled(@NonNull Job job) { if (!job.isBuildable()) { return false; } @@ -620,7 +619,7 @@ protected QueueTaskFuture schedule(AbstractBuild build, Job project, List< } @CheckForNull - protected QueueTaskFuture schedule(@Nonnull AbstractBuild build, @Nonnull Job project, @Nonnull List list, @Nonnull TaskListener listener) throws InterruptedException, IOException { + protected QueueTaskFuture schedule(@NonNull AbstractBuild build, @NonNull Job project, @NonNull List list, @NonNull TaskListener listener) throws InterruptedException, IOException { if (project instanceof ParameterizedJobMixIn.ParameterizedJob) { return schedule(build, project, ((ParameterizedJobMixIn.ParameterizedJob) project).getQuietPeriod(), list, listener); } else { diff --git a/src/main/java/hudson/plugins/parameterizedtrigger/FileBuildTriggerConfig.java b/src/main/java/hudson/plugins/parameterizedtrigger/FileBuildTriggerConfig.java index 70edcbb1..aca8eb29 100644 --- a/src/main/java/hudson/plugins/parameterizedtrigger/FileBuildTriggerConfig.java +++ b/src/main/java/hudson/plugins/parameterizedtrigger/FileBuildTriggerConfig.java @@ -19,7 +19,6 @@ public FileBuildTriggerConfig(String projects, private ResultCondition condition; private boolean triggerWithNoParameters; private boolean includeCurrentParameters; - private boolean batchCondition; public Object readResolve() { List configs = new ArrayList<>(); diff --git a/src/main/java/hudson/plugins/parameterizedtrigger/NodeParameters.java b/src/main/java/hudson/plugins/parameterizedtrigger/NodeParameters.java index 59dd9ab2..5bbaa98c 100644 --- a/src/main/java/hudson/plugins/parameterizedtrigger/NodeParameters.java +++ b/src/main/java/hudson/plugins/parameterizedtrigger/NodeParameters.java @@ -29,13 +29,16 @@ public NodeParameters() { public Action getAction(AbstractBuild build, TaskListener listener) throws IOException, InterruptedException, DontTriggerException { String nodeName = build.getBuiltOnStr(); Label nodeLabel; - // master does not return a node name so add it explicitly. + String nodeDisplayName; + // Controller does not return a node name so add it explicitly. if( StringUtils.isEmpty( nodeName ) ) { nodeLabel = Jenkins.get().getSelfLabel(); + nodeDisplayName = nodeLabel.getDisplayName(); } else { nodeLabel = Label.get(nodeName); + nodeDisplayName = nodeLabel != null ? nodeLabel.getDisplayName() : "null label of " + nodeName; } - listener.getLogger().println("Returning node parameter for " + nodeLabel.getDisplayName()); + listener.getLogger().println("Returning node parameter for " + nodeDisplayName); return new NodeAction(nodeLabel); } diff --git a/src/main/java/hudson/plugins/parameterizedtrigger/Plugin.java b/src/main/java/hudson/plugins/parameterizedtrigger/Plugin.java index 76b27c37..587f170f 100644 --- a/src/main/java/hudson/plugins/parameterizedtrigger/Plugin.java +++ b/src/main/java/hudson/plugins/parameterizedtrigger/Plugin.java @@ -1,5 +1,7 @@ package hudson.plugins.parameterizedtrigger; +import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; + import hudson.Extension; import hudson.model.Item; import hudson.model.ItemGroup; @@ -20,6 +22,7 @@ import static org.apache.commons.lang.StringUtils.isEmpty; +@SuppressFBWarnings(value="NM_SAME_SIMPLE_NAME_AS_SUPERCLASS", justification="Part of public API, reviewed all uses of Plugin are fully quantified in this class") public class Plugin extends hudson.Plugin { public static final String LOG_TAG = "[parameterized-trigger]"; diff --git a/src/main/java/hudson/plugins/parameterizedtrigger/PredefinedPropertiesBuildTriggerConfig.java b/src/main/java/hudson/plugins/parameterizedtrigger/PredefinedPropertiesBuildTriggerConfig.java index 4dfed852..d35f11fb 100644 --- a/src/main/java/hudson/plugins/parameterizedtrigger/PredefinedPropertiesBuildTriggerConfig.java +++ b/src/main/java/hudson/plugins/parameterizedtrigger/PredefinedPropertiesBuildTriggerConfig.java @@ -1,5 +1,7 @@ package hudson.plugins.parameterizedtrigger; +import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; + import java.util.ArrayList; import java.util.List; @@ -19,6 +21,7 @@ public PredefinedPropertiesBuildTriggerConfig(String projects, private ResultCondition condition; private boolean triggerWithNoParameters; private boolean includeCurrentParameters; + @SuppressFBWarnings(value = "UUF_UNUSED_FIELD", justification = "Do not risk compatibility") private String batchCondition; public Object readResolve() { diff --git a/src/main/java/hudson/plugins/parameterizedtrigger/SubProjectData.java b/src/main/java/hudson/plugins/parameterizedtrigger/SubProjectData.java index 7de8b3a2..1ca148df 100644 --- a/src/main/java/hudson/plugins/parameterizedtrigger/SubProjectData.java +++ b/src/main/java/hudson/plugins/parameterizedtrigger/SubProjectData.java @@ -24,6 +24,8 @@ package hudson.plugins.parameterizedtrigger; +import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; + import hudson.model.Job; import java.util.Comparator; @@ -42,6 +44,7 @@ * * @author JO Sivtoft */ +@SuppressFBWarnings(value="SIC_INNER_SHOULD_BE_STATIC_ANON") public class SubProjectData { private final Comparator customComparator = new Comparator() { diff --git a/src/main/resources/index.jelly b/src/main/resources/index.jelly new file mode 100644 index 00000000..6df0d67a --- /dev/null +++ b/src/main/resources/index.jelly @@ -0,0 +1,4 @@ + +
+ This plugin lets you trigger new builds when your build has completed, with various ways of specifying parameters for the new build. +
diff --git a/src/spotbugs/excludesFilter.xml b/src/spotbugs/excludesFilter.xml new file mode 100644 index 00000000..c5d62ce6 --- /dev/null +++ b/src/spotbugs/excludesFilter.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + diff --git a/src/test/java/hudson/plugins/parameterizedtrigger/CapturedEnvironmentActionTest.java b/src/test/java/hudson/plugins/parameterizedtrigger/CapturedEnvironmentActionTest.java index 4af36c3b..121f9354 100644 --- a/src/test/java/hudson/plugins/parameterizedtrigger/CapturedEnvironmentActionTest.java +++ b/src/test/java/hudson/plugins/parameterizedtrigger/CapturedEnvironmentActionTest.java @@ -2,6 +2,7 @@ import hudson.ExtensionList; import hudson.FilePath; +import hudson.Functions; import hudson.diagnosis.OldDataMonitor; import hudson.model.FreeStyleBuild; import hudson.model.FreeStyleProject; @@ -9,6 +10,7 @@ import org.hamcrest.Description; import org.hamcrest.Matcher; import org.hamcrest.TypeSafeMatcher; +import org.junit.Assume; import org.junit.Rule; import org.junit.Test; import org.jvnet.hudson.test.Issue; @@ -38,6 +40,7 @@ public class CapturedEnvironmentActionTest { @Test @Issue("SECURITY-2185") //@LocalData public void onLoad() throws Throwable { + Assume.assumeFalse("test can not run on windows", Functions.isWindows()); j.then(r -> { final URL url = CapturedEnvironmentActionTest.class.getResource("/hudson/plugins/parameterizedtrigger/CapturedEnvironmentActionTest/onLoad"); if (url == null) { diff --git a/src/test/java/hudson/plugins/parameterizedtrigger/test/BuildTriggerTest.java b/src/test/java/hudson/plugins/parameterizedtrigger/test/BuildTriggerTest.java index 9871c851..8aa49ae0 100644 --- a/src/test/java/hudson/plugins/parameterizedtrigger/test/BuildTriggerTest.java +++ b/src/test/java/hudson/plugins/parameterizedtrigger/test/BuildTriggerTest.java @@ -31,10 +31,8 @@ import java.util.Collections; import java.util.List; -import static java.util.concurrent.TimeUnit.SECONDS; import static org.junit.Assert.*; -import org.awaitility.Awaitility; import org.junit.Rule; import org.junit.Test; import hudson.tasks.Builder; @@ -69,8 +67,15 @@ public void testParentProjectTrigger() throws Exception { BuildTrigger triggerBuilder = new BuildTrigger(new BuildTriggerConfig("downstream", ResultCondition.SUCCESS, false, null, params, false)); upstream.getPublishersList().add(triggerBuilder); + /* + * To avoid a period when upstream already finished, but async rebuilding graph {@link Jenkins#rebuildDependencyGraphAsync()} + * could still be in progress or even not start. + * Let's rebuild graph manually just in case to avoid flakiness. + */ + r.jenkins.rebuildDependencyGraph(); + r.buildAndAssertSuccess(upstream); - Awaitility.await().pollInterval(1, SECONDS).atMost(10, SECONDS).until(() -> downstream.getLastBuild() != null); + r.waitUntilNoActivity(); String project = downstream.getLastBuild().getCause(Cause.UpstreamCause.class).getUpstreamProject(); assertEquals("Build should be triggered by matrix project.", "upstream", project); diff --git a/src/test/java/hudson/plugins/parameterizedtrigger/test/ParameterizedTriggerPermissionTest.java b/src/test/java/hudson/plugins/parameterizedtrigger/test/ParameterizedTriggerPermissionTest.java index f4010ef8..694e7f4e 100644 --- a/src/test/java/hudson/plugins/parameterizedtrigger/test/ParameterizedTriggerPermissionTest.java +++ b/src/test/java/hudson/plugins/parameterizedtrigger/test/ParameterizedTriggerPermissionTest.java @@ -50,8 +50,8 @@ import java.util.List; import java.util.Set; import java.util.TreeSet; -import javax.annotation.CheckForNull; -import javax.annotation.Nonnull; +import edu.umd.cs.findbugs.annotations.CheckForNull; +import edu.umd.cs.findbugs.annotations.NonNull; import jenkins.model.Jenkins; import jenkins.security.QueueItemAuthenticator; import jenkins.security.QueueItemAuthenticatorConfiguration; @@ -139,9 +139,9 @@ public void shouldBeUnableToTriggerWithoutPermissions(boolean useBuildStep) thro Cause.UpstreamCause cause = lastBuild.getCause(Cause.UpstreamCause.class); assertNotNull("No upstream cause in subproject2", lastBuild); } - - @Nonnull - private FreeStyleProject createProjectWithPermissions(@Nonnull String projectName, @Nonnull String userName, + + @NonNull + private FreeStyleProject createProjectWithPermissions(@NonNull String projectName, @NonNull String userName, @CheckForNull List permissions) throws Exception { final TreeSet userSet = new TreeSet<>(Arrays.asList(userName)); diff --git a/src/test/java/hudson/plugins/parameterizedtrigger/test/SubversionRevisionBuildTriggerConfigTest.java b/src/test/java/hudson/plugins/parameterizedtrigger/test/SubversionRevisionBuildTriggerConfigTest.java deleted file mode 100644 index 2162aa52..00000000 --- a/src/test/java/hudson/plugins/parameterizedtrigger/test/SubversionRevisionBuildTriggerConfigTest.java +++ /dev/null @@ -1,57 +0,0 @@ -package hudson.plugins.parameterizedtrigger.test; - -import hudson.model.Cause.UserIdCause; -import hudson.model.FreeStyleBuild; -import hudson.model.FreeStyleProject; -import hudson.model.Queue; -import hudson.plugins.parameterizedtrigger.BuildTrigger; -import hudson.plugins.parameterizedtrigger.BuildTriggerConfig; -import hudson.plugins.parameterizedtrigger.ResultCondition; -import hudson.plugins.parameterizedtrigger.SubversionRevisionBuildParameters; -import hudson.scm.SubversionSCM; -import hudson.scm.SubversionTagAction; - -import org.junit.Ignore; -import org.junit.Rule; -import org.junit.Test; -import org.jvnet.hudson.test.JenkinsRule; - -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertEquals; - -public class SubversionRevisionBuildTriggerConfigTest { - - @Rule - public JenkinsRule r = new JenkinsRule(); - - @Test @Ignore("https://groups.google.com/d/msg/jenkinsci-dev/8tLnOhHitKI/dCPJ53_wGAAJ") - public void testRevisionParameter() throws Exception { - FreeStyleProject p1 = r.createFreeStyleProject(); - FreeStyleProject p2 = r.createFreeStyleProject(); - p2.setQuietPeriod(1); - - p1.setScm(new SubversionSCM( - "https://svn.jenkins-ci.org/trunk/hudson/test-projects/trivial-ant@13000")); - - p2.setScm(new SubversionSCM( - "https://svn.jenkins-ci.org/trunk/hudson/test-projects/trivial-ant")); - - p1.getPublishersList().add( - new BuildTrigger(new BuildTriggerConfig(p2.getName(), ResultCondition.SUCCESS, - new SubversionRevisionBuildParameters()))); - r.jenkins.rebuildDependencyGraph(); - - FreeStyleBuild b1 = p1.scheduleBuild2(0, new UserIdCause()).get(); - Queue.Item q = r.jenkins.getQueue().getItem(p2); - assertNotNull("p2 should be in queue (quiet period): " + JenkinsRule.getLog(b1), q); - q.getFuture().get(); - - FreeStyleBuild b2 = p2.getLastBuild(); - - assertEquals(b1.getAction(SubversionTagAction.class).getTags().keySet() - .iterator().next().revision, - b2.getAction(SubversionTagAction.class).getTags().keySet() - .iterator().next().revision); - - } -}