07/17/19 – wrote this…
We are currently using Windows \ Jenkins 2.107.1 (no pipeline), and I am researching going to pipeline. We have a nightly build job, that fetches from repositories, and submits and waits on other jobs. I see 9 jobs running on the same Master node (we only have a master), at the same time. I am not clear on if we should have one Jenkinsfile or multiple Jenkinsfiles. It will not be a multibranch pipeline, as we do not create test branches and then merge back to a master. In the repository we have product1.0 branch, product2.0 branch etc., and build only one branch (the latest one). While I do like the Blue Ocean editor, it is only for MultiBranch pipelines.
Looking for directions and\or examples on how to convert existing Jenkins non-pipeline systems, to pipeline. I did find this…https://wiki.jenkins.io/display/JENKINS/Convert+To+Pipeline+Plugin. It does help a little in that it gives you some converted steps, but cannot convert all the steps, and will give comments in the pipeline script "//Unable to convert a build step referring to...please verify and convert manually if required." There is an option "Recursively convert downstream jobs if any" and if you select that, it appears to add all the downstream jobs to the same pipeline script, and really confuses the job parameters. There is also an option to "Commit JenkinsFile" (if doing declarative). I will play with this some more, but it is not the be all and end all of converting to pipeline, and I still am not sure of whether I should be have one or more scripts.
Added 07/26/19 - Let’s see if I have my research to date correct…
A Declarative pipeline (Pipeline Script from SCM), is stored in a Jenkinsfile in the repository. Every time that this Jenkins job is executed, a fetch from the repository is done (to get the latest version of the Jenkinsfile).
A Pipeline script is stored as part of the config.xml file in the Jenkins\Jobs folder (it is not stored in the repository, or in a separate Jenkinsfile in the jobs folder). There is a fetch from the repository only if you put it in (you do not need to do a repository fetch to get the Pipeline script).
Besides our nightly product build, we also have other jobs. I could create a separate Declarative Jenkinsfile for each of them (JenkinsfileA, JenkinsfileB, etc.) for each of the other jobs and store then in the repository also (in the same branch as the main Jenkinsfile), but that would mean that every one of those additional jobs, to get the particular Jenkinsfile for that job, would also need to do a repository fetch (basically fetching\cloning the repository branch for each job, and have multiple versions of the repository branch unnecessarily downloaded to the workspace of each job).
That does not make sense to me (unless my understanding of things to date is incorrect). Because the main product build does require a fetch every time it is run (to get any possible developer check-ins), I do not see a problem doing Declarative Jenkinsfile for that job. For the other jobs (if we do not leave then for the time being in the classic (non-pipeline) format)), they will be Pipeline scripts.
Is there any way of (or plans for), being able to do Declarative pipeline without having to store in the repository and doing a fetch every time (lessening the need to become a Groovy developer)? The Blue Ocean script editor appears to be an easier tool to use to create pipeline scripts, but it is only for MultiBranch pipelines (which we don’t do).
Serialization (restarting a job), is that only for when a node goes down, or can you restart a pipeline job (Declarative or Scripted), from any point if it fails?
I see that there are places to look to see what Jenkins plugin’s have been ported to pipeline, but is there anything that can be run to look at the classic jobs that you have, to determine up front which jobs are going to have problems being converted to pipeline (non supported plugins)?
Why is this happening?
I believe that this is a bug. What do I need to do to either get comments, or action on this?
--
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/912b3b5f-a204-4b83-ad35-9fd94dcb2aa4%40googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkins...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/912b3b5f-a204-4b83-ad35-9fd94dcb2aa4%40googlegroups.com.
--Thanks!Mark Waite
To unsubscribe from this group and stop receiving emails from it, send an email to jenkins...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/912b3b5f-a204-4b83-ad35-9fd94dcb2aa4%40googlegroups.com.
--Thanks!Mark Waite
This morning, I basically did what you just recommended. I created a new Pipeline job (not using Blue Ocean), selected "Pipeline Script from SCM', and pointed to the Jenkinsfile that I had created yesterday in the master branch. Because this job is not a MultiBranch job, even thought you can run it in Blue Ocean, because there are no 'Branches', the pipeline editor pencil will not appear....you cannot edit the script in Blue Ocean.Are there any plans to modify Blue ocean so that the editor can be used on any declarative script, MultiBranch or not? If not, what is your recommended alternative (besides the Pipeline Syntax \ Declarative Directive Generator)?
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/2f528dcf-ccc2-4031-8ec2-18496f1a4921%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/2f528dcf-ccc2-4031-8ec2-18496f1a4921%40googlegroups.com.
--Thanks!Mark Waite
" build only the branches that you specify.". I am assuming that this is something in the script that does this, as when creating the MultiBranch job, I see no option to allow for the selection of doing executing the job for only one branch. Not to harp on the documentation, but if this can be done, then document it up front (with an example). This would make more users understand that Blue Ocean may be more applicable than it currently appears.
In Blue Ocean, if you create a new pipeline, and there is a Jenkinsfile in any branch in that repository, when you select “Create Pipeline”, it will execute the Jenkinsfile in each of those branches. At this point, there is no ability to Configure anything. Yes, if you then configure that new job you can restrict it to only execute on a particular branch. This does not solve my problem. Lets say that in ProductVersion1 branch there was a Jenkinsfile. We are now Working on Version 2 of the product, and now have ProductVersion2 branch, which also has a JenkinsFile. If I create a new Blue Ocean pipeline job (which initially cannot be configured to only execute on the new branch), then I am also going to execute a build of the previous branch (which I do not want to do because that version of the product has been released). How to handle this, is it done in the script, in that I would need to edit the Jenkinsfiles in both branches before creating the new job?
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/bd85b6f0-09f1-4c54-a2da-dfbbef9d9690%40googlegroups.com.
Currently (in the classic\non pipeline jobs), when a product version is released, we disable that job (ex productversionv1), and copy the job to productversionv2 and set the job parameters for the correct branch to use. Occasionally we do need to do a fix in v1, so it is just a matter of enabling the job, running it, and disabling it again. Quick, simple, easy to do. Both v1 and v2 jobs are always available.
#4 “change the definition of the multibranch pipeline”. That means that for the scenario
above, that I must modify the job configuration a few times. Once to run v1, then to set back to run v2, and no option to have them both available to run separately.
The reason that I wanted to use Blue Ocean is for the pipeline editor, I did not want to have to get any deeper than I needed to in Groovy (although I believe that it will not be possible to eliminate its use).
I am not seeing Blue Ocean MultiBranch job as the way to go (and you can only do MultiBranch in Blue Ocean). I am even hesitant to store the Jenkinsfile\script in SCM (scripted or declarative). While currently I am the only person touching the build system, who knows what the future holds. The next person to maintain the build system may create a MultiBranch job that will then pick up and execute all the Jenkinsfiles in the separate versioned branches, thus creating builds that are unwanted and updating those older version branches. Thus, I am considering storing the pipeline script in the config.xml file instead of a Jenkinsfile.
If anyone has any other suggestions…I am listening. Thanks.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/bd85b6f0-09f1-4c54-a2da-dfbbef9d9690%40googlegroups.com.
--Thanks!Mark Waite