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.
On Thursday, August 15, 2019 at 8:56:55 PM UTC-4, Mark Waite wrote:
>
>
>
> On Thu, Aug 15, 2019 at 12:20 PM Louis Elston > wrote:
>
>> 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?
>>
>
> Would it work for you if you took the following steps?
>
>1. Use Blue Ocean to create the first Pipeline on the branch that is
>the current product version. Blue Ocean will create a multibranch
> pipeline
>job that will build all branches that contain a Jenkinsfile. At this
>point, there is only one branch, so only one job will be created
>2. Edit the multibranch Pipeline job that Blue Ocean created, add the
>filter to specifically limit that job to only build the precise branch
> that
>is the currently active development branch
>3. When the time comes in the future that you are ready to add a
>Jenkinsfile on a new, independent branch of the same repository, add it
>from Blue Ocean or copy it from one branch to another with Git operations.
>
>Commit to the new branch, knowing that the new branch won't be built
>because it does not match the pattern for branches being selected for the
>multibranch pipeline definition
>4. When you're ready to enable the new branch, change the definition
>of the multibranch pipeline to build both old and new branches.
>5. When you're ready to stop building the old branch, change the
>definition of the multibranch pipeline to only build the new branch
>
> I think that workflow will allow you to use the multibranch pipeline job
> to precisely define which branches are built and which are not built.
> Whether or not a Jenkinsfile exists on a branch, the multibranch pipeline
> job would define which branches are allowed to build and which are ignored.
>
> Thanks,
> Mark Waite
>
>
>>
>>
>> On Thursday, August 15, 2019 at 9:08:15 AM UTC-4, Mark Waite wrote:
>>>
>>>
>>>
>>> On Wednesday, August 14, 2019 at 1:34:10 PM UTC-7, Louis Elston wrote:
" 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