Skip to content
Permalink
Browse files

Merge branch 'master' into JENKINS-14591

Conflicts:
	src/main/resources/au/com/centrumsystems/hudson/plugin/buildpipeline/BuildPipelineView/bpp.jelly
  • Loading branch information...
dalvizu committed Nov 29, 2016
2 parents 93d6aab + aa6458c commit 62192c7edb3ee170ed838f1e2833653edc8549a3
Showing with 747 additions and 692 deletions.
  1. +1 −1 CONTRIBUTING.md
  2. +19 −5 pom.xml
  3. +1 −0 src/main/groovy/au/com/centrumsystems/hudson/plugin/buildpipeline/BuildJSONBuilder.groovy
  4. +1 −1 src/main/java/au/com/centrumsystems/hudson/plugin/buildpipeline/BuildForm.java
  5. +13 −7 src/main/java/au/com/centrumsystems/hudson/plugin/buildpipeline/BuildPipelineView.java
  6. +1 −1 src/main/java/au/com/centrumsystems/hudson/plugin/buildpipeline/extension/BuildVariablesHeader.java
  7. +25 −18 src/main/java/au/com/centrumsystems/hudson/plugin/util/BuildUtil.java
  8. +97 −120 src/main/resources/au/com/centrumsystems/hudson/plugin/buildpipeline/BuildPipelineView/bpp.jelly
  9. +1 −1 src/main/resources/au/com/centrumsystems/hudson/plugin/buildpipeline/BuildPipelineView/main.jelly
  10. +20 −33 ...umsystems/hudson/plugin/buildpipeline/extension/AbstractNameValueHeader/projectCardTemplate.jelly
  11. +27 −39 .../com/centrumsystems/hudson/plugin/buildpipeline/extension/AbstractNameValueHeader/rowHeader.jelly
  12. +1 −1 ...s/au/com/centrumsystems/hudson/plugin/buildpipeline/extension/ParametersActionHeader/config.jelly
  13. +57 −54 ...m/centrumsystems/hudson/plugin/buildpipeline/extension/PipelineHeaderExtension/columnHeader.jelly
  14. +7 −18 ...centrumsystems/hudson/plugin/buildpipeline/extension/SimpleColumnHeader/projectCardTemplate.jelly
  15. +8 −18 ...urces/au/com/centrumsystems/hudson/plugin/buildpipeline/extension/SimpleRowHeader/rowHeader.jelly
  16. +1 −1 src/main/resources/index.jelly
  17. +338 −374 src/main/webapp/css/main.css
  18. BIN src/main/webapp/images/application_view_list.png
  19. BIN src/main/webapp/images/clock-small.png
  20. BIN src/main/webapp/images/clock.png
  21. BIN src/main/webapp/images/user-small.png
  22. BIN src/main/webapp/images/user.png
  23. +78 −0 ...test/java/au/com/centrumsystems/hudson/plugin/buildpipeline/BuildPipelineViewDisplayNameTest.java
  24. +2 −0 .../java/au/com/centrumsystems/hudson/plugin/buildpipeline/functionaltest/BuildPipelineViewTest.java
  25. +5 −0 ...test/java/au/com/centrumsystems/hudson/plugin/buildpipeline/functionaltest/BuildSecurityTest.java
  26. +3 −0 ...t/java/au/com/centrumsystems/hudson/plugin/buildpipeline/functionaltest/ParameterPassingTest.java
  27. +4 −0 src/test/java/au/com/centrumsystems/hudson/plugin/buildpipeline/testsupport/BuildCardComponent.java
  28. +37 −0 src/test/java/au/com/centrumsystems/hudson/plugin/util/BuildUtilTest.java
@@ -3,7 +3,7 @@
Truths which we believe to be self-evident (adapted from [TextSecure's](https://github.com/WhisperSystems/TextSecure/blob/master/contributing.md))

1. **The answer is not more options.** If you feel compelled to add a preference that's exposed to the user, it's very possible you've made a wrong turn somewhere.
2. **There are no power users.** The idea that some users "understand" concepts better than others has proven to be, for the post part, false. If anything, "power users" are more dangerous than the test, and we should avoid exposing dangerous functionality to them.
2. **There are no power users.** The idea that some users "understand" concepts better than others has proven to be, for the most part, false. If anything, "power users" are more dangerous than the test, and we should avoid exposing dangerous functionality to them.
3. **If it's "like PGP," it's wrong.** PGP is our guide for what not to do.
4. **It's an asynchronous world.** We wary of anything that is anti-asynchronous: ACKs, protocol confirmations, or anly protocol-level "advisory" message.
5. **There is no such thing as time**. Protocol ideas that require synchonized clocks are doomed to failure.
24 pom.xml
@@ -3,10 +3,10 @@
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>1.609.3</version>
<version>1.619</version>
</parent>
<artifactId>build-pipeline-plugin</artifactId>
<version>1.4.10-SNAPSHOT</version>
<version>1.5.5-SNAPSHOT</version>
<packaging>hpi</packaging>
<name>Build Pipeline Plugin</name>
<description>This plugin provides build pipeline functionality to Hudson and Jenkins. This allows a chain of jobs to be visualised in a new view. Manual jobs in the pipeline can be triggered by a user with the appropriate permissions manually confirming.</description>
@@ -18,8 +18,8 @@
</license>
</licenses>
<scm>
<connection>scm:git:https://github.com/jenkinsci/${project.artifactId}.git</connection>
<developerConnection>scm:git:https://github.com/jenkinsci/${project.artifactId}.git</developerConnection>
<connection>scm:git:git://github.com/jenkinsci/${project.artifactId}.git</connection>
<developerConnection>scm:git:git@github.com:jenkinsci/${project.artifactId}.git</developerConnection>
<url>https://github.com/jenkinsci/build-pipeline-plugin</url>
<tag>HEAD</tag>
</scm>
@@ -29,7 +29,7 @@
<pmd.config.file>pmd_rules.xml</pmd.config.file>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<groovy.version>1.8.6</groovy.version>
<selenium.version>2.45.0</selenium.version>
<selenium.version>2.48.0</selenium.version>
<exclude.tests>**/functionaltest/*.java</exclude.tests>
</properties>
<developers>
@@ -169,6 +169,20 @@

<build>
<plugins>
<!-- work-around for INFRA-588 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.6</version>
<dependencies>
<dependency>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-http</artifactId>
<version>2.10</version>
<type>jar</type>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
@@ -42,6 +42,7 @@ class BuildJSONBuilder {
project {
disabled(pipelineBuild.projectDisabled)
name(pipelineBuild.project.getRelativeNameFromGroup(context))
displayName(pipelineBuild.project.displayName)
url(pipelineBuild.projectURL)
health(pipelineBuild.projectHealth)
id(projectId)
@@ -97,7 +97,7 @@ private BuildForm(ItemGroup context, final PipelineBuild pipelineBuild, final Co
projectId = project.getFullName().hashCode();
final ParametersDefinitionProperty params = project.getProperty(ParametersDefinitionProperty.class);
final ArrayList<String> paramList = new ArrayList<String>();
if (params != null) {
if (params != null && params.getParameterDefinitionNames() != null) {
for (String p : params.getParameterDefinitionNames()) {
paramList.add(p);
}
@@ -545,10 +545,12 @@ private int triggerBuild(final AbstractProject<?, ?> triggerProject, final Abstr
final Action buildParametersAction) {
LOGGER.fine("Triggering build for project: " + triggerProject.getFullDisplayName()); //$NON-NLS-1$
final List<Action> buildActions = new ArrayList<Action>();
final CauseAction causeAction = new CauseAction(new UserIdCause());
final List<Cause> causes = new ArrayList<Cause>();
causes.add(new UserIdCause());
if (upstreamBuild != null) {
causeAction.getCauses().add(new Cause.UpstreamCause((Run<?, ?>) upstreamBuild));
causes.add(new Cause.UpstreamCause((Run<?, ?>) upstreamBuild));
}
final CauseAction causeAction = new CauseAction(causes);
buildActions.add(causeAction);
ParametersAction parametersAction =
buildParametersAction instanceof ParametersAction
@@ -673,13 +675,14 @@ private static ParametersAction mergeParameters(final ParametersAction base, fin
final List<Action> retval = new ArrayList<Action>();
for (final Action action : actions) {
if (action instanceof CauseAction) {
final CauseAction causeAction = (CauseAction) action;
filterOutUserIdCause(causeAction);
final CauseAction causeAction = filterOutUserIdCause((CauseAction) action);
if (!causeAction.getCauses().isEmpty()) {
retval.add(causeAction);
}
} else if (action instanceof ParametersAction) {
retval.add(action);
} else if ("hudson.plugins.git.RevisionParameterAction".equals(action.getClass().getName())) {
retval.add(action);
}
}
return retval;
@@ -693,15 +696,18 @@ private static ParametersAction mergeParameters(final ParametersAction base, fin
*
* @param causeAction
* the causeAction to remove UserIdCause from
* @return a causeAction with UserIdCause removed
*/
private void filterOutUserIdCause(CauseAction causeAction) {
private CauseAction filterOutUserIdCause(CauseAction causeAction) {
final List<Cause> causes = new ArrayList<Cause>();
final Iterator<Cause> it = causeAction.getCauses().iterator();
while (it.hasNext()) {
final Cause cause = it.next();
if (cause instanceof UserIdCause) {
it.remove();
if (!(cause instanceof UserIdCause)) {
causes.add(cause);
}
}
return new CauseAction(causes);
}

/**
@@ -81,7 +81,7 @@ public long getIndex() {

@Override
public String getDisplayName() {
return "Build variables";
return "All build variables and parameters";
}
}
}
@@ -24,14 +24,12 @@
*/
package au.com.centrumsystems.hudson.plugin.util;

import hudson.model.Action;
import hudson.model.ParameterValue;
import hudson.model.AbstractBuild;
import hudson.model.AbstractProject;
import hudson.model.Cause;
import hudson.model.Action;
import hudson.model.Cause.UpstreamCause;
import hudson.model.CauseAction;
import hudson.model.FileParameterValue;
import hudson.model.ParameterValue;
import hudson.model.ParametersAction;

import java.util.ArrayList;
@@ -59,21 +57,30 @@
* @return - The next downstream build based on the upstream build and downstream project, or null if there is no downstream project.
*/
public static AbstractBuild<?, ?> getDownstreamBuild(final AbstractProject<?, ?> downstreamProject,
final AbstractBuild<?, ?> upstreamBuild) {
final AbstractBuild<?, ?> upstreamBuild) {
if ((downstreamProject != null) && (upstreamBuild != null)) {
// We set the MAX_DOWNSTREAM_DEPTH to search everything. This is to prevent breaking current behavior. This
// flag can be set via groovy console, so users can adjust this parameter without having to restart Jenkins.
final int maxDownstreamDepth = Integer.getInteger(BuildUtil.class.getCanonicalName() + ".MAX_DOWNSTREAM_DEPTH",
Integer.MAX_VALUE);

// This can cause a major performance issue specifically when it tries to search through all of the builds,
// and it never finds the correct upstream cause action. It might never be able to find the correct cause action because
// a pipeline was executed and later terminated early. If that is the case, then we go through the entire list
// of builds even though we terminated early.
//
// To counter any potential performance issue the system property
// au.com.centurmsystems.hudson.plugin.util.BuildUtil.MAX_DOWNSTREAM_DEPTH
// can be set which sets the max limit for how many builds should be loaded for the max depth.

@SuppressWarnings("unchecked")
final List<AbstractBuild<?, ?>> downstreamBuilds = (List<AbstractBuild<?, ?>>) downstreamProject.getBuilds();
final List<AbstractBuild<?, ?>> downstreamBuilds = (List<AbstractBuild<?, ?>>) downstreamProject
.getBuilds()
.limit(maxDownstreamDepth);
for (final AbstractBuild<?, ?> innerBuild : downstreamBuilds) {
for (final CauseAction action : innerBuild.getActions(CauseAction.class)) {
for (final Cause cause : action.getCauses()) {
if (cause instanceof UpstreamCause) {
final UpstreamCause upstreamCause = (UpstreamCause) cause;
if (upstreamCause.getUpstreamProject().equals(upstreamBuild.getProject().getFullName())
&& (upstreamCause.getUpstreamBuild() == upstreamBuild.getNumber())) {
return innerBuild;
}
}
}
final UpstreamCause cause = innerBuild.getCause(UpstreamCause.class);
if (cause != null && cause.pointsTo(upstreamBuild)) {
return innerBuild;
}
}
}
@@ -90,8 +97,8 @@
* - The AbstractProject
* @return - AbstractBuild's ParametersAction
*/
public static Action getAllBuildParametersAction(//
final AbstractBuild<?, ?> upstreamBuild, final AbstractProject<?, ?> downstreamProject) { //
public static Action getAllBuildParametersAction(final AbstractBuild<?, ?> upstreamBuild,
final AbstractProject<?, ?> downstreamProject) {
// Retrieve the List of Actions from the downstream project
final ParametersAction dsProjectParametersAction = ProjectUtil.getProjectParametersAction(downstreamProject);

Oops, something went wrong.

0 comments on commit 62192c7

Please sign in to comment.
You can’t perform that action at this time.