department-of-veterans-affairs/ascent-jenkins-lib

Name: ascent-jenkins-lib

Owner: Department of Veterans Affairs

Description: null

Created: 2017-10-16 15:24:46.0

Updated: 2018-05-16 16:39:12.0

Pushed: 2018-05-16 16:39:10.0

Homepage: null

Size: 1527

Language: Groovy

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

ascent-jenkins-lib

Shared Library for Jenkins Pipelines

Sonar Configuration

On your Sonar server you will need to install the following plugins:

Jenkins Configuration

On your Master Jenkins server you will need to install the following plugins:

Credentials

The following credentials will need to be setup in Jenkins:

| Credential ID | Credential Type | Notes | ————- | ————- | ————– | | nexus | username/password | | | docker-repository | username/password | | | aws | username/password | The username should be your ACCESS_ID and the password is the SECRET_KEY value |

Global properties

Open the /configure url for your Jenkins Master server and add the following Global Properties:

SonarQube Servers

As are prequiste for configuring Sonar integration, you will need to create an access token that Jenkins can use to authenticate with Sonar. To do this following these steps:

  1. Open your browser to /account/security/.
  2. Enter a name for your token in the Generate New Token field and click Generate.
  3. Copy the token value and save that for later.

Setup a Webhook to call back Jenkins when the scan is complete. See SonarQube Plugin for more information.

  1. Add a webhook named Jenkins and a URL of {you jenkins instance url}/sonarqube-webhook/. Make sure to retain the trailing slash.

Open the /configure url for your Jenkins Master server and in the SonarQube section:

  1. Click the Add SonarQube button
  2. Set the name to CI
  3. Set the server URL to Your Sonar server URL
  4. Set the server authentication token to the token value you created earlier.
Global Pipeline Libraries

In order to use this library you will need to configure it as a Global Library within Jenkins.

  1. Click the Add button.
  2. Give the library a unique name. For example: 'ascent'
  3. Set the Default version to 'master'
  4. Check the Allow default version to be overridden option.
  5. Select Modern SCM as the retrieval method.
  6. Github should be selected as the SCM implementation
  7. Select or add the credentials used to authenticate to Github
  8. Enter 'department-of-veterans-affairs' as the Owner
  9. Enter 'ascent-jenkins-lib' as the Repository

Referencing from your Jenkinsfile

To use this shared library you will need to reference it from the Jenkinsfile in your source code repository. This can be done by adding the following line to the beginning of your Jenkinsfile. In this example the name given to the shared library is ascent, change this value to match the name you gave the shared library.

rary('ascent') _
Project Types

This library supports pipelines for the following project types:

Setting Repository Scan interval

This code can be run through the Jenkins Script console to modify the repository scan interval for multi-branch jobs since there is currently no way to do this any other way.

(f in Jenkins.instance.getAllItems(jenkins.branch.MultiBranchProject.class)) {
println("Updating " + f.name)
f.addTrigger(new com.cloudbees.hudson.plugins.folder.computed.PeriodicFolderTrigger("5m"));


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.