Declarative pipeline: how to execute steps before SCM checkout

271 views
Skip to first unread message

Elifarley Cruz

unread,
Sep 11, 2017, 9:32:30 PM9/11/17
to Jenkins Users
The checkout scm step, as I understand it, is automatically executed in a declarative pipeline. You don't have to declare it.

However, I need to execute a shell script just before checking out the code.

How can I achieve this in a declarative pipeline?

Thanks!

Mark Waite

unread,
Sep 11, 2017, 9:51:47 PM9/11/17
to Jenkins Users
As far as I understand it, you'll need to prevent the implicit checkout that is part of declarative, and then perform the checkout yourself within the declarative pipeline.

Refer to declarative options and the skipDefaultCheckout.

Mark Waite

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/42c32096-03db-474f-996e-9a7008e9c45a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Elifarley Cruz

unread,
Sep 19, 2017, 4:37:16 PM9/19/17
to Jenkins Users
Thanks, that worked as you described, but what if I need to perform a script BEFORE the code of a global shared library is checked out?

Mark Waite

unread,
Sep 19, 2017, 4:50:02 PM9/19/17
to Jenkins Users
I don't know of a way to inject yourself prior to a shared pipeline library.

Reply all
Reply to author
Forward
0 new messages