13

I have a freestyle project on Jenkins. I'm trying to add in that the build runs a Jenkins pipeline (Jenkinsfile) as a step.

We currently use Jenkins steps to run our builds but are looking to move towards fully automating everything with pipelines, so are trying to use a mix of both at the moment.

Is this possible?

If so, how can it be done? I've looked through the available Jenkins plugins to see if any of them allow this to be done but I can't find anything.

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
kicksticks
  • 239
  • 3
  • 14
  • 2
    The answer is probably either "yes" or "no". Will either of those answers help you? If not then please [edit] the question to ask something that will be helpful to you. But first, please read the [help] pages about what is on-topic here and on how to write a good question. – AdrianHHH Aug 10 '17 at 14:42
  • Does this answer your question? [How do you load a groovy file and execute it](https://stackoverflow.com/questions/37800195/how-do-you-load-a-groovy-file-and-execute-it) – tripleee Sep 07 '21 at 06:29
  • You could trigger another pipeline that is based on a Jenkinsfile with 'build'. – Meiswjn May 03 '22 at 08:12
  • This is very important for those of us that need to test Jenkins with code from a Jenkinsfile without having to load up a SCM. – NorseGaud Jun 07 '22 at 18:22
  • @NorseGaud it is possible to test a Jenkinsfile in a pipeline build without loading up an SCM. If you ask a new question, I and others can provide examples. – Highway of Life Dec 22 '22 at 08:16

1 Answers1

0

With freestyle, there isn't an option to run another Jenkins build as a build step. However, freestyle has a Trigger option to 'run this build after another build completes' and a Post Build option to 'run another build after this build completes'. With those options, you could split one freestyle build with desired steps: (Xfree, Ypipe, Zfree) into two freestyle builds: (Xfree, post build Ypipe) and (trigger Ypipe complete, Zfree), to use a mix of both types.