Thanks both, let us explore the suggested options.
Stay safe. Cheers.

On Tue, 8 Sep 2020 at 11:19 PM, Gian Maxera <gmax...@gmail.com> wrote:

>
> I agree with Saravanan ... and I would also add that there are other two
> Jenkins features we use for your case.
> The approach we follow is:
> - first we try with "when" to run stages conditionally depending on
> branches/parameters/tags/directory and so on
> - when we see many times the same piece of code and we want to DRY, then
> we use the readTrusted to load a snippet of functionality:
>
> def notifier = evaluate readTrusted('./scripts/jenkins/notifier.groovy')
>
> - when we see many times the same piece of code used across different
> repositories, then we use the Library approach:
>
> @Library('osirium-pipelines@2.0.1')_
>
>
>
>
> Il giorno mar 8 set 2020 alle ore 16:09 Saravanan Manickam <
> manicsa...@gmail.com> ha scritto:
>
>> I am not sure whether I understood completely..  you could have used
>> "when" condition to match the branch and do all the additional steps you
>> want.  It'll be clean that way.
>>
>> Regards,
>> Saravanan
>>
>> On Tuesday, September 8, 2020 at 7:27:50 AM UTC+5:30 ashish...@gmail.com
>> wrote:
>>
>>> Dear All,
>>>
>>> Below is our usecase (using declarative script):
>>>
>>>    - We have a small pipeline script (Jenkinsfile) which will do
>>>    sanity, tests & lint check on every feature branch and pull requests
>>>    - Then we have another script (Jenkinsfile) which is superset which
>>>    will additionally build and deploy as well. We will use this for develop 
>>> /
>>>    master branches
>>>    - We are planning to use Org folders (BitBucket teams) to scan repo
>>>    and create pipeline automatically.
>>>
>>>
>>> How can we reuse our first script file to be included in second script,
>>> so that we don't have to duplicate declarative script?
>>>
>>> Any other suggestions on how you generally tackle such cases?
>>>
>>> Thanks,
>>> Ashish
>>>
>>
>>
>>
>>
>>
>>
>>
>>
>> --
>>
>>
>> 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-users+unsubscr...@googlegroups.com.
>>
>>
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/jenkinsci-users/1ff7b13b-75b4-440b-abbb-e106ed56ec16n%40googlegroups.com
>> <https://groups.google.com/d/msgid/jenkinsci-users/1ff7b13b-75b4-440b-abbb-e106ed56ec16n%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>>
>>
>
>
>
>
>
>
>
> --
>
>
> 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-users+unsubscr...@googlegroups.com.
>
>
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jenkinsci-users/CAPddqDUG9%3DEJDj%3DrvT3UGhUo_np85BjNY70kpPdhf%3DaS8KwrBQ%40mail.gmail.com
> <https://groups.google.com/d/msgid/jenkinsci-users/CAPddqDUG9%3DEJDj%3DrvT3UGhUo_np85BjNY70kpPdhf%3DaS8KwrBQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
>
> --
Thanks,
Ashish

-- 
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-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/CAJd3NVs0YQAHNSYiFg1NcVws-eRt%2BYaX%2BZonZvJUw4KVu2-Riw%40mail.gmail.com.

Reply via email to