Jenkins Grouping - jenkins

We're planning a migration from AnthillPro to another build system.
As of right now, we're checking the option of migrating to Jenkins.
We have a lot of different Products, and each Product has it's own repository and it's own builds for every branch.
In AnthillPro, There are several layers:
Folders -> Projects -> Worfklows -> Jobs -> Steps
In Jenkins I so far only came across:
Views -> Jobs -> Steps
Is there a way to group the Views?
Or are there any methods to group the different components?
How would you implement the structure of:
Product -> Branch -> Builds
If each product have several branches, and on in each branch you need to run several type of jobs.

Currently you need to install some plugins to achieve this.
I would recommend the Team Views Plugin - it allows you to group jobs together and we use it heavily. There is also a Categories Jobs View plugin which I have not used but looks like it could provide a second level of grouping if needed.

There is also a "Folders" plugin that allows you to create jobs inside folders or folders inside folders:
https://wiki.jenkins.io/display/JENKINS/CloudBees+Folders+Plugin

Related

Jenkins configuration idea for many app flavours

I am looking for a configuration idea for jenkins.
I have a react native app that builds for iOS and android. Source code is stored in the repository "A".
Configurations (app flavours) are stored in the repository "B". They are added every day or two, sometimes existing ones are updated, each one has a version.
What is the best approach?
The goals are:
Start a build when either repository "A" or repository "B" is updated
If repository "B" got updated but specific flavour config did not change (same version) - skip testing/building.
The questions:
Is it better to create 1 job per flavour or loop through all configs in 1 job? It seems like creating jobs dynamically is a more flexible solution.
What's the best approach to skip rebuilding existing flavours if specific configuration didn't change after a repository update?
Are there any plugins you could recommend to achieve my goals?

Jenkins Multibranch Config: How to Filter branches based on variable string?

We have Jenkins set up with 7 multibranch pipeline projects, each building off the same git repo, but for different target platforms. Each of these multibranch pipelines builds a number of branches. We currently set which branches each multibranch pipeline builds by using the following property in the multibranch project configuration:
Branch Sources -> Git -> Behaviors -> Filter by name (with wildcards)
Currently, each multibranch pipeline has the same string of branches in this Filter by name (with wildcards) field. Each time we want Jenkins to start building a new branch, we go through all 7 multibranch project configurations and update this field to include the new branch.
It's a bit of a pain to go through each configuration and change this field every time, since we always want each configuration to have the same list of branches. Is it possible to simply use some type of a variable in this field? This way we only would need to change one location instead of trying to keep 7 different configurations in sync with each other, which is prone to error and also a bit of a pain.
Thanks for your help!
Allen
Rather than filtering with wildcards, you could try filtering branches with regular expression. In our case, pattern like:
(master|develop|release.*|feature.*|bugfix.*)
has been working well to cover the repository. That is, assuming that you follow Git Flow or similar methodology. Unfortunately, there is no simple way to sync the configuration between MultiBranch Pipelines build from one repository. Neither Multibranch Pipeline, nor Organization plugins are designed to work with Multiple Jenkinsfiles.
Also, you can try to sync only the branch configuration between Projects using Jenkins script console. Most of the Job configuration does not have to be set on Project level. For instance, you can create shared script (or shared library) to would be sourced by other jobs, to set the same job properties on each of them. See How do you load a groovy file and execute it for details.
if you want to use the wildcard you can provide like below:
In this example it will discover only qa and dev branch.
NOTE: You have to use "Discover branches" also with "filter by name (with wildcards)" behaviour.

How do I create a view across folders in Jenkins?

In our previous Jenkins setup we used a combination of the Build Monitor Plugin and the View Job Filters Plugin to create a screen showing our last 18 builds.
With our new setup we decided to break the builds into multiple folders, some of which are just simple folders, one is a dynamic folder pointing to Bitbucket. We would now like to re-create the same kind of view: show the 18 most recent builds across all of our builds.
If I just select the top folders in the configuration of the build monitor view, then no builds appear - no matter if I set the "Recurse in subfolders" option or not. I need to manually select individual jobs, which is not something we want to maintain in the long run.
If I use a regular expression match, then it includes jobs from other folders that are not selected.
There is also nothing I can find in the "Add Job Filter" menu that seems to allow me to filter jobs to come from within a selection of folders.
I can create multiple build monitor views, one for each folder - but that doesn't give me the last 18 builds over all.
Is there a way to create a build monitor with a number of most recent builds across multiple folders?
I figured out that you can use a regular expression to include jobs, assuming that all the jobs are contained in a single subfolder, my-jobs, you can do:
my-jobs/.*
to include only jobs within those folders.
Further, you can restrict this more by adding job filter matches which let you exclude other jobs if it starts including more jobs than you wanted.
For me on the latest version of Jenkins at time of writing (2.240), for the view to pick up jobs in subfolders, I had to tick Recurse in subfolders else the regular expressions would not match any jobs in folders.
Combined with Use a regular expression to include jobs into the view and a regular expression such as the one below, I was able to get the view to show jobs within a folder:
/MyFolder/.*
I suspect that if you wanted to include jobs from multiple folders, you could do so with a regular expression such as:
(/MyFolder/.*)|(OtherFolder/.*)

Jenkins 2.0 Pipeline Stage View display multiple branches

Is there a way to get a BuildWall like thing with the new multibranch pipelines from Jenkins 2.0? Ideally I want to see all branches of all projects like I had before ( there I had one job per branch per project and was seeing the state of all in the overview ) - now I would have to click on all folders to see the state of all branches - but the Jenkinsfile job setup and automatic branch detection are great - Ideally I want to have the best of both worlds which should be possible as far as I see - just don't know how to do it e.g. if there is a plugin for this already.
I'm using the Build Monitor plugin with the following
This gives this result.
Besides the Dashboard view of the Build Monitor Plugin, you can also expand the Job listing of the folder to include all branches and PRs. I think this is more suitable for "normal" usage (vs. dashboard) in order to get an overview over all jobs/branches.
Therefore, use Edit View in the folder and select in the Job Filters section the option Recurse in subfolders.
This will provide you a view as follows (live version):
It is not currently possible to see a build records from multiple branches in a stage view at the multibranch project level. It has been proposed.

TFS Labels or Branching for marking files for specific tasks

I'm newbie to TFS (2013). I used CVS in past, where we used to either create same Named Labels on multiple files or Branched labels to group files under one name, for specific tasks, like Marked with a build number, or Creating Patches/Hotfixes.
Now I'm looking for similar strategy in TFS.
Question: Is it possible to mark multiple folders/files with same Label?
Or
Question: Can we create a separate branch (with a particular name) upon multiple folders/Files?
Using any of above technique, I would be able to get multiple files, may be distributes among different folders, by specifying single Label/Name/Mark etc.
Any help would be really appreciated.
You can mark folders with labels via: Team Explorer (in VS) -> right click on folder -> Advanced -> Apply Label
You can branch in a similar way, TE -> right click -> branching and merging.
A good place to start would be to read the ALM Rangers' pdf on Branching Guide.

Resources