Authenticate Jenkins users against JIRA - jenkins

We are currently setting up Confluence, JIRA and Jenkins and I would rather have only one user database that all tools can use than having to create separate accounts in each tool. Google tells me that Jenkins can authenticate and authorize users against Atlassian Crowd. Confluence can use Crowd and also JIRA for user management.
But can Jenkins use JIRA (not Crowd) as its user database, to authenticate and authorize users against it?

One method is with the Crowd2 (Jenkins plugin).
From Jira
Goto Admin Cog > User Management
"JIRA User Server" (left side)
Click "+Add application" (top right side)
Notes: To specify a port with the IP address(es) in Jira, use XX.XX.XX.XX/PORT format. Jira user must have admin permissions.
From Jenkins
Goto "Manage Jenkins" (left side) > Manage Plugins > Available Tab
Download crowd2 plugin
Goto "Manage Jenkins" (left side) > "Configure Global Security"
Notes: Requires Jenkins admin access.

Related

Jenkins Slack Automation

Is there a better and simple way to automate the Jenkins Slack Integration. I am trying to automate Jenkins pipeline script with Slack and the slack channel as a parameter.
#Unlimited To post notifications to a Slack channel, Jenkins needs the 'Slack Plugin'. You can do this from the Jenkins dashboard and find the 'Manage Jenkins' option in the left pane. Select the 'Manage Plugins' option and choose the 'Available' tab. Search for the 'Slack Notification' plugin and install it.
Hopefully, you’ve already created your Slack account. If not, click here to get started. Once you have a Slack account, configure the Jenkins integration by using Jenkins CI. After configuration, click on 'Manage Jenkins' again in the left navigation and go to 'Configure System'. Find the 'Slack' section and add the following values:
Workspace: {TEAM-SUBDOMAIN}
Credential: {INTEGRATION-TOKEN-CREDENTIAL-ID}
Default channel / member id: {CHANNEL-NAME}
If you’d like, you can create a secret text credential by clicking the 'Add' button. You can also test the Jenkins and Slack integration by clicking the 'Test Connection' button.

Github OAuth with Jenkins for organisation

I was reading this https://medium.com/#vsreelasya/github-oauth-for-jenkins-d21d76a3ff09
It is pretty straight forward.
There are a few points I have to clear:
in my case, in the context of organization, should I create a separate account for Jenkins?
if no separate account is needed there is / settings / OAuth App where I can fill almost the same things as in the tutorial
In Jenkins seems there are a lot of places where I can insert credentials:
in "Configure Global Security" > "Github Authentication Plugin" > "Global GitHub OAuth Settings"
in "Configure system" > "Github"
in the job "Source Code Management" > "Git" > "Repositories"
Do I have to add the credentials to all of those places?
Github OAuth lets Jenkins depend on Github as an identity provider. Users will use Github to log into Jenkins. No extra "Jenkins" account is necessary on Github. You may set up Github OAuth in "Configure Global Security" > "Authentication" > "Security Realm" > "Github Authentication Plugin" as per this how-to. Just make sure you adjust the system authorization so you won't end up losing admin access to Jenkins.
"Configure system" > "Github" lets you manage the Github endpoints your Jenkins jobs may use for SCM checkout. You may add the public Github API or an on-premise Github Enterprise installation. It has nothing to do with Github OAuth.
I presume "Source Code Management" > "Git" > "Repositories" is a job configuration, but it definitely has nothing to do with Github OAuth.

Jenkins job level permission

How can I enable job level permission on Jenkins? Means I have 10 Jenkins job in my Jenkins installation. I may need to enable user1 only access three jobs our of this 10 and user 2 will access only 5 jobs from this 10 etc?
Go to Manage Jenkins - Config global security - find a section "authorization" and choose "Project-based Matrix Authorization Strategy". Then add users and mark "OVerrall - Read" permission.
Then go to specific jobs and select "Use project-based security"

How to handle TFS password on multiple Jenkins jobs?

I have set up a few Jenkins jobs which are using TFS. For each one I had to manually input TFS username and password inside the TFS plugin.
Is there a way to change password in all jobs using some king of global setting? Or do I have to manually change password on all jobs when I change my password.
Any help would be appreciated.
Thanks,
Daniel
Get latest TFS (5.0.0) and Credentials (2.1.4) plugins.
Add domain and credentials usable to connect to your TFS server via Jenkins > Configure Credentials.
Now select just added domain, click "Configure", and add your TFS server hostname (or proper wildcard) under Hostname > Include, so jenkins will know where provided credentials can be used.
Now, you can just leave user/password fields empty in job's TFS SCM configuration.
Instructions are mostly taken from TFS plugin GitHub page
Even though TFS Plugin bug Allow use of credentials from Credentials Plugin isn't resolved, all is working fine.
The TFS Plugin for Jenkins does not read the global credentials. You need to enter the username and password for each job manually.
In the Jenkins admin you can add "global" credentials. For this, as a Jenkins admin, go in :
Manage Jenkins > Manage Credentials > Add Credentials > Username with password and save it.
These credentials will be available in all the jobs configuration of this Jenkins instance.
If you don't the the Manage Credentials item, you'll maybe need to install the Jenkins Credentials Plugin

Jenkins Integration with Jira issue

I have installed Jenkins Plugin for JIRA on my JIRA installation and also JIRA Plugin for Jenkins on to my Jenkins installation. I have added an application link in JIRA settings.
I am facing below issue:
1) On Application Links page there is a warning that my Jenkins Application "seems to be offline". While Adding a jenkins link it gives me error : The host doesn't respond. Change the url or click next to confirm.
Jira Version - 6.0.5
Jenkins Version - 1.562
Jenkins-Jira Plugin Version - 1.4.3
Thanks to anybody who's willing to help me out on this.
You can follow four steps:
Install JIRA Plugin in Jenkins
In Jenkins:
Manage Jenkins > manager plugins > available
search and choose Jenkins JIRA plugin , Jenkins JiraTestResultReporter plugin and Jenkins JIRA Issue Updater
Install Jenkins Plugin in JIRA.
https://marketplace.atlassian.com/plugins/com.marvelution.jira.plugins.jenkins
see: Installation section.
Add Jenkins 's Application Links in JIRA
The integration between JIRA and Jenkins has Application Links as its base. This allows administrators to configure and manage the Jenkins
To get started, go to [JIRA_BASEURL]/plugins/servlet/applinks/listApplicationLinks and click on the Add Application Link button to add a new Application Link for Jenkins.
or administration > plugin > Application Link > add Application Link; do as instruction
note: Optionally, but required if Jenkins is secured,
configure Outgoing Authentication that JIRA should use.
To do this, click on the Edit link next to the Jenkins Application Link, and select OutGoing Authentication tab
Provide the Username of the user to use to authenticate against Jenkins with
Provide the Password of the use
Jenkins Configuration
After the installation of the Jenkins Plugin for JIRA, and the configuration of at-least one Application Link, administrators will be able to control which Jobs are included in the synchronisation process and which aren't.
in Administration > plugins (add-ons) >Jenkins Configuration
Download JIRA plugin for Jenkins and install this plugin in Jenkins
way 1: copy it to Jenkins's plugin folder. and restart Jenkins
way2: Manage Jenkins > manager plugins > advanced > Upload Plugin . Choose file and upload then restart Jenkins
Enable Jenkins job in JIRA
then just use a known JIRA Issue Key in a commit message of your source code repo
Jenkins will make all the change sets (commits) available to the JIRA plugin when syncing a build.
The sync process uses the change sets to look for JIRA Issue Keys. Once this process locates a link, then that build will be available in the CI Build Panels.
download jenkins-jira-plugin at http://mvnrepository.com/artifact/com.marvelution.jira.plugins/jenkins-jira-plugin

Resources