Skip to content

Add support for Jenkins Pipeline. #110

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

Merged
merged 1 commit into from
Jan 24, 2017

Conversation

stebadge
Copy link

@stebadge stebadge commented Jan 9, 2017

Before this commit, if you attempted to use the Stash pull-request
builder plug in with Jenkins Pipeline, you would encounter an error.
Ultimately, this error was due to the fact that this plug in require
jobs to use the AbstractProject base class, but the Jenkins Pipeline
job class (WorkflowJob) doesn't.

The good news is that WorkflowJob and AbstractProject share a base
class of Job, and that most functionality of this plug in can be made
available to WorkflowJob refactoring uses of AbstractProject to uses
of Job instead. For cases where this does not provide enough
functionality, there are interfaces implemented in common by both
(ParameterizedJobMixIn.ParameterizedJob, Queue.Task) that fill the
gaps.

The one remaining piece of functionality this commit does not extend
to be available to Jenkins Pipeline is custom post-build comments, so
a TODO to that effect was added.

Before this commit, if you attempted to use the Stash pull-request
builder plug in with Jenkins Pipeline, you would encounter an error.
Ultimately, this error was due to the fact that this plug in require
jobs to use the AbstractProject base class, but the Jenkins Pipeline
job class (WorkflowJob) doesn't.

The good news is that WorkflowJob and AbstractProject share a base
class of Job, and that most functionality of this plug in can be made
available to WorkflowJob refactoring uses of AbstractProject to uses
of Job instead.  For cases where this does not provide enough
functionality, there are interfaces implemented in common by both
(ParameterizedJobMixIn.ParameterizedJob, Queue.Task) that fill the
gaps.

The one remaining piece of functionality this commit does not extend
to be available to Jenkins Pipeline is custom post-build comments, so
a TODO to that effect was added.
@dalewking
Copy link

Can we get a release for this?

@zeton3
Copy link

zeton3 commented Sep 18, 2017

HI, When it can be released?

Copy link

@zeton3 zeton3 left a comment

Choose a reason for hiding this comment

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

Looks good

@kikuingithub
Copy link

Hi, Can we get a release of this.. with support for pipeline ?

@bcfisher
Copy link

Is there a reason this hasn't been released? @nemccarthy

@praveen12bnitt
Copy link

@stebadge Do you mind sharing a sample jenkinsfile using this plugin? It will be useful for others too . I will add the details to the ReadMe once i have it working.

@bcfisher
Copy link

bcfisher commented Nov 2, 2017

It's not really about the jenkins file @praveen12bnitt . You can use any jenkinsFile you please.

@bcfisher
Copy link

bcfisher commented Nov 2, 2017

I ended up taking the fixes, building them locally and then installing it to my jenkins box manually, as many others mentioned above. It seems to work great for me. I'd prefer to use hooks, but, I haven't the allotted time to upgrade the plugin.

@eabern2
Copy link

eabern2 commented Dec 5, 2017

@stebadge @bcfisher Can you share how you used this in pipeline? I'm trying to use it in the properties step in pipelineTrigger as the pipeline code generator syntax states, but I'm getting an error:

Caused: java.lang.IllegalArgumentException: Could not instantiate {triggers={$class=StashBuildTrigger, projectPath=, cron=* * * * *, stashHost=xxxxxxxxxx, credentialsId=xxxxxxxxxxxx, projectCode=xxxxxxxx, repositoryName=env.GIT_URL, ciSkipPhrases=NO TEST, ciBuildPhrases=test this please, ignoreSsl=false, checkDestinationCommit=false, checkMergeable=false, mergeOnSuccess=false, checkNotConflicted=false, onlyBuildOnComment=false, deletePreviousBuildFinishComments=false, cancelOutdatedJobsEnabled=false}} ...

This is the code I have in properties

pipelineTriggers([stashBuildTrigger(projectPath: '', cron: '* * * * ', stashHost: xxxxx', credentialsId: 'xxxxxxxx', projectCode: 'xxxxx' /"${project_name}"*/, repositoryName: 'env.GIT_URL', ciSkipPhrases: 'NO TEST', ciBuildPhrases: 'test this please', ignoreSsl: false, checkDestinationCommit: false, checkMergeable: false, mergeOnSuccess: false, checkNotConflicted: false, onlyBuildOnComment: false, deletePreviousBuildFinishComments: false,
cancelOutdatedJobsEnabled: false)])])

@bcfisher
Copy link

bcfisher commented Dec 5, 2017

I didn't add it to the jenkinsFile, but instead, from the ui.

@eabern2
Copy link

eabern2 commented Dec 5, 2017

@bcfisher
Oh Ok. Was it in the UI of the multibranch pipeline job? I tried that but got a class cast exception.

@bcfisher
Copy link

bcfisher commented Dec 5, 2017

no, just a pipeline job
image

@bcfisher
Copy link

bcfisher commented Dec 5, 2017

and then in the pipeline job, I configured the stash pull request builder there. E.g.
image

@kikuingithub
Copy link

kikuingithub commented Dec 8, 2017 via email

@eabern2
Copy link

eabern2 commented Dec 8, 2017

@kikuingithub yeah it works. But it doesn't work with the multibranch pipeline job.

I switched over to pipeline job but I still need regular branches to build and so far I have not been able to get the job to work to build both PRs and branches. If anyone has any insight let me know.

@wburgers
Copy link

wburgers commented Dec 13, 2017

Anybody else having problems aborting running pipeline jobs?
We have turned on the option "Rebuild if destination branch changes" together with "Cancel outdated jobs".
When the destination branch changes, it triggers new pipeline builds, which is correct, but the outdated builds don't abort.

To be clear, we run the non-released version of the plug-in, in which pipeline jobs are supported.

@SwagMuffinMcYoloPants
Copy link

Was this released yet as an official version? If not, is there a planned date?

@proski
Copy link

proski commented Mar 30, 2019

I have submitted a PR for the current code, please see jenkinsci#69

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.