[workflow-plugin] Using workflow in same SCM as code

64 views
Skip to first unread message

Michael Lasevich

unread,
Jul 14, 2015, 1:16:35 AM7/14/15
to jenkins...@googlegroups.com
I want to keep my workflow script in same git repo as rest of my code and want to avoid hard-coding URLs or branch names into the workflow.

When I use "Groovy CPS DSL from SCM" it seems to check out into a separate workspace, so I do not have access to anything in the git repo. I could check out the code in the workflow for the second time, but for whatever reason the SCM variables are not available within the workflow (why???)

Is there a good way to do this?

Thanks,

-M

Christoph Obexer

unread,
Jul 16, 2015, 1:59:44 AM7/16/15
to jenkins...@googlegroups.com
Am 2015-07-14 um 07:16 schrieb Michael Lasevich:
> I want to keep my workflow script in same git repo as rest of my code
> and want to avoid hard-coding URLs or branch names into the workflow.
I also want that, I consider that a hard requirement actually.

> When I use "Groovy CPS DSL from SCM" it seems to check out into a
> separate workspace, so I do not have access to anything in the git
> repo. I could check out the code in the workflow for the second time,
> but for whatever reason the SCM variables are not available within the
> workflow (why???)
>
> Is there a good way to do this?
That was implemented in
https://issues.jenkins-ci.org/browse/JENKINS-26101 I believe, I feel
tempted to reopen that issue.
I would ask for the ability to have the workflow run inside a directory
that has a checkout of whatever was configured
to retrieve the script and parameters about what revision / branch was
checked out.

Would that also work for you? Or dou you need more?

Maybe just go ahead and reopen the issue yourself :)

Br,
Christoph

Jesse Glick

unread,
Aug 12, 2015, 5:00:40 PM8/12/15
to Jenkins Users
On Tuesday, July 14, 2015 at 1:16:35 AM UTC-4, Michael Lasevich wrote:
I want to keep my workflow script in same git repo as rest of my code and want to avoid hard-coding URLs or branch names into the workflow.

 Multibranch workflow, in beta. 

Michael Lasevich

unread,
Aug 12, 2015, 8:23:32 PM8/12/15
to Jenkins Users
Thanks, that looks awesome, but I am having some trouble with it in practice (I think these are all MultiBranch plugin problems, but still)

1 - It seems to be able to create jobs but not delete them - I get an error like this if a previously created job is to be deleted: 

hudson.security.AccessDeniedException2: SYSTEM is missing the Job/Delete permission

2 - What is the format for "Include branches" field in Git config? The only thing I was able to get to work is either "*" or "master" - any attempt at multiple specifiers seems to fail and there is no docs for it that I can find. I would like to match several patterns. 

3 - it does not seem to work with any branches with a slash (/) in them (it creates a branch, but you cannot use it due to broken url)


-M
Reply all
Reply to author
Forward
0 new messages