How to show github username on build job in Jenkins? - jenkins

I am using Jenkins as CI for github project build. When a developer commit a changes that job will be triggered. I am using Pipeline view for viewing the build status. How can I put the developer github account name on the job view?

Use Delivery Pipeline View Plugin to get the nice view and also various details like triggered cause, commit messages and etc.

Related

Multi branch pipeline does not trigger when a change is pushed to a particular branch

We have a GitHub repository which has 4 branches. A multibranch pipeline is setup for it in Jenkins.
Tried setting up webhook, but could not find an option to do so. It has option at branch level to setup a webhook.
Requirement is to setup a webhook at repository level, so that we do not have to set up webhook for every new branch added.
After setting up webhook at repository level, if a change is pushed to any of the branches under it, build should be triggered for that branch.
Is this possible?
Have you tested the GitHub-Webhook-Pipeline-Multibranch plugin? It seems to achieve your goal.
Also, there is another similar question on SO with an answer that, while not accepted it has been up-voted by several people, and it might be of help in this case.

Disable automatic trigger build jenkins multibranch

I have a multibranch project in jenkins, and every time I press Scan Repository Now it queue a new build just because
‘Jenkinsfile’ found
Met criteria
What I'd like to do is whenever I scan the repository, it only add Pull Request to the project without triggering a build. And also, if I turn on scan repository trigger, periodically if not otherwise run, every time it branch indexing, it also build the pull request even after I turn on Skip initial build on first branch indexing.
What I'd like to do is whenever there's a comment 'build' in the pull request, then it builds the branch, so if the pr doesn't contain the comment, it should not build anything.
How can I achieve this?
This is my setup
I use Jenkins 2.180
According to the pipeline documentation there should be a option do dissable Index Triggers on Multibranch types, see https://jenkins.io/doc/book/pipeline/syntax/#options
But i didn't find the option itself either, so i deactivated it per Pipeline definition in the Jenkinsfile of every branch :/
overrideIndexTriggers
Allows overriding default treatment of branch indexing triggers. If branch indexing triggers are disabled at the multibranch or
organization label, options { overrideIndexTriggers(true) } will
enable them for this job only. Otherwise, options {
overrideIndexTriggers(false) } will disable branch indexing triggers
for this job only.
I also use SCM webhooks to autmatically trigger the branch indexing etc
The default for Build Strategies is to OR the list together. You'll need to remove the existing build strategies and add an "All Strategies Match" build strategy and add "Change Requests" and "Skip Initial Build on First Branch Indexing" to that.
Source: https://issues.jenkins-ci.org/browse/JENKINS-58442

Is the Build Pipeline Trigger available in TFS on premise

I've got the latest update of TFS (Version 16.131.27701.1), this link seems to imply that the build pipeline trigger is available: build pipeline triggers
It does not show up on the triggers page for a given build just the Scheduled option.
triggers page
Is there something I need to enable or maybe I am misunderstanding the link.
That feature hasn't made its way on-prem yet. It's slated for "2019" (the next major release of TFS), per the Features Timeline page.

Trigger a downstream project on demand

Given the following situation
main-job builds and tests a project
installer-job copies artifacts from main-job, and packages them into an installer
installer-job is set as downstream project of main-job via Parameterized Trigger Plugin.
But the installer-job should only be triggered on-demand from main-job's build page.
It's possible to trigger the downstream job on the project page:
But it doesn't seem possible to trigger the build from a specific build page.
Is there any option to get such a trigger button on the build page?
Note: It's a freestyle project, not a pipeline one. So things like the Build Pipeline plugin don't help, unfortunately.
An elegant solution is possible via the Promoted Builds Plugin. "Promotion" is some activity that's performed when a build fulfills certain criteria, like
build was successful
all downstream builds passed
explicit, interactive confirmation
In your case, this condition will be simple: just "main-job" needs be successful, and you will want to confirm explicitly.
There's lots of possible steps that can be triggered as promotion activity -- what you want is to trigger a build of the "installer-job", which can be configured easily.
To summarize, for "main-job", you will configure something like this:
When you do that, the 'main-job" builds will feature a "Promotion Status" button. After pressing the "Approve" button there, the promotion will be enabled and the "install-job" will start building:

Is there a way to automate Jenkins for Hg Flow/Git Flow

We just switched to using Hg Flow, but one of things that we still haven't quite yet figured out is how to best use Jenkins with it. Ideally we would have a job which builds and tests develop, one that builds and tests default and other jobs which are automatically created when a feature or release branch is created, and ideally also delete the job when the feature or release is finished.
Does anyone know if this can be done, and if so, how exactly to do it?
It would be extra nice if Jenkins was able to read from Hg who it was the created the branch and mark them as the contact person if/when the job builds, but this is really just a nice to have.
Thanks in advance
There is a Job Generator Plugin that could be used here. You'd create a job that watches the entire Hg repo for changes, and when it sees one, you run a task that parses the commit, and creates a new job with the new branch in place of templated fields.
If you can see a history of branch creation, you could use that information only in your job-creating task to fill out contact details too.
I haven't tried it myself, but I found this plugin (for GitFlow):
Jenkins Build Per Git Flow Branch
This script will allow you to keep your Jenkins jobs in sync with your
Git repository (following Git Flow branching model).
Also see the author's blog post on this plugin.

Resources