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

Support WorkflowJob (Pipeline) jobs #149

Merged
merged 3 commits into from
Feb 17, 2017
Merged

Conversation

yacaovsnc
Copy link
Contributor

Today when triggering a Pipeline job, we will get a "Project not found" exception as WorkflowJob is not of AbstractProject type.

All information the plugin requires can be retrieved by BuildableItem and ParameterizedJobMixin.ParameterizedJob interface, and WorkflowJob implements both interfaces. The change is to explicitly cast both AbstractProject and WorkflowJob down to BuildableItem and ParameterizedJobMixin.ParameterizedJob and pass it around as such.

This change is to support WorkflowJob (Pipeline) job types. The WorkflowJob implements BuildableItem and
ParameterizedJobMixin.ParameterizedJob interface, but is not an AbstractProject type.
@@ -54,6 +56,7 @@
private static final Map<String, AbstractCommand.Factory> COMMAND_FACTORIES_BY_NAME;
public static final String URL_NAME = "team-build";
public static final String PARAMETER = "parameter";
public static final String BUILD_SOURCE_BRANCH = "Build.SourceBranch";
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you know if Build.SourceBranch is available in VSTS Release Management scenarios? If not, can we handle its absence gracefully?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Great call. Made changes to get the branch from:

  1. jobName input.
  2. Build.SourceBranch variable

Throw if none of them are available.

We will try parse the branch name in this order:
1. Parse the branch name if job name is in format of ${multibranch pipeline}/${branch}
2. Read Build.SourceBranch variable
@yacaovsnc yacaovsnc merged commit 1598bf5 into jenkinsci:master Feb 17, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants