How to start deployment with email authentication in jenkins? - jenkins

We have a CI jenkins platform and we want to manage our deployments with an email confirmation. A user send a request to the deployment plan for starting. But in the first step, the plan send an email confirmation to an administrator. If the admin click the request link, deployment will be start, otherwise wont start.
Is there a way to do this with jenkins or any jenkins plugin?

yes there is a way to do that, honestly, more than one way to do that and you can choose by your preferneces. What I will suggest you is to consider the way explained in the issues of Jenkins https://issues.jenkins-ci.org/browse/JENKINS-33793
though it have status Unresolved, but it looks like by my knowledge that it will work even right now , cause it is just an URL.

Related

Updating user emails in Jenkins

We have a Jenkins setup in which jobs are pipelines that call the email-ext plugin to notify users.
After the jobs have been setup, all users have changed emails, going from user#company1.com to user#company2.com.
Jenkins still sends emails to the former adresses.
I can't find a way to update the email adresses. Is there a way to do this ?
Users are authenticated through the Active Directory plugin.
You just have to update to address while sending. Check this on how to do it. Since you might need to update the config on multiple jobs you might need to write a script to achieve that. This thread explains it

Jenkins Remote Trigger User Name

I am developing a Dashboard on top of Jenkins. The Dashboard would list all the jobs available and would also have a trigger button to initiate a build which shoots a post request using the secret token. The problem is every build would have the same cause which says "Started by remote host 19.XX.XX.XX". Since the dashboard needs to display the user name triggering the job as the person who logged, is there a way we can pass the a username as well in the jenkins remote trigger url like below so that jenkins would capture the cause as the user name.
https://jenkinsurl:port/job/testLDAP/build?token=DDJjk$###*bB&userName=abc
There is no parameter that you can use for this. A workaround that I've used is adding &cause=This+was+started+by+abc which results in
Started by remote host 192.168.x.x with note: This was started by abc
Perhaps this might help you.

Deploying to live server via link on email notification

I've been reading a few articles and watching a few videos on Jenkins. I'm wondering how easy it would be once the master branch has been deployed to a staging server to automatically send an email to the client notifying them of the url to the staging server and also giving them a link to "deploy live". This way the client can see the changes, make sure they're happy with it then deploy it themselves without having to email anyone requesting it to go live.
Anyone got any idea how easy this would be to do with Jenkins? There may be a plugin that does this but so far I've not come across anything.
I saw a talk where a guy does this to notify QA of a new build to test, as well as notify when a build is ready to be published to production.
Basically the last automated job (deploy to staging job) has a post build step to send an email to some address. The body of the email contains a link back to the REST API for the "deploy to production" job, triggering a build.
Email recipient tests things, and if satisfied, clicks the link and Jenkins runs the production job. Obviously this requires that the recipient has some kind of access to (at the very least, the REST API of) the Jenkins instance. That being said, there's no reason you couldn't set up your own system to take limited external requests and forward them to your Jenkins API.
The video link (including time reference of the relevant part) is: https://youtu.be/3HI7mv_791k?t=3169
If you've been watching a few videos you might have already come across it, but it's quite long so you might not have watched it all.

Jenkins - control who can trigger a build

Is there a way we can control which user can click "Build Now" in Jenkins? Basically we dont want all the users who are logged in Jenkins to trigger a build.
Also is this possible project-wise?
I am relatively new in configuring Jenkins, though I have used Jenkins more as an end user and not an admin, so would really appreciate any helpful inputs. I tried using this : https://wiki.jenkins-ci.org/display/JENKINS/Matrix-based+security and this https://wiki.jenkins-ci.org/display/JENKINS/Standard+Security+Setup, but for some reason its still allowing users to trigger a build.
You can also use RoleStrategyPlugin
This will be more helpful to manage large numbers of user using multiple projects.
The details to use and your doubt in the comment is addressed here
I am using Matrix Authorization Strategy Plugin, it offers matrix-based security authorization strategies, both global and per-project.
Global scope
http://jenkins_server/configureSecurity/--> Authorization-->Project-based Matrix Authorization Strategy
Project scope

Setup TFS/Test Manager to send email on test failure

Is it possible to setup TFS/Test Manager so that it sends out an email after a test fails?
Yes, it is possible but it requires quite a lot of changes/additions to the process template and possibly a custom-made activity.
After tests have run, we check if BuildDetail.BuildPhaseStatus has status failed
We send mail to everyone who has changesets committed to this build, so the build goes through BuildDetail.AssociatedChangesets (you need to have AssociateChangesetsAndWorkItems on) and get the committer username.
Unfortunately for us, there's no good correlation between TFS username and email address at our place, so we had to create a custom activity that looks that up in the AD.
The actual email is sent with the BuildReport action from Community TFS Build Extensions. We modified the xslt, but that's not really necessary. We also wanted to include a listing of the failed tests, and that required modification of the action itself (test data isn't included by default).
Looking at this description and all the work made to get this working, I'm beginning to wonder if it was worth it ;).

Resources