Configure For Jenkins

Configuration

To configure a project for Jenkins you need to configure a post build script for your Jenkins project.

Prerequisite:
  • Configuring any project to report data to BuildBasis requires an API key. You can view your organization’s API key in the BuildBasis Dashboard API Page.

  • For Jenkins you must use the PostBuildScript Jenkins Plugin, this can be found here: https://plugins.jenkins.io/postbuildscript/

  • The project uses Git and exposes the GIT_COMMIT, GIT_BRANCH, GIT_URL environment variables

Steps:

1.) Navigate to your project in Jenkins.

2.) Add a BUILDBASIS_API_KEY environment variable, set the value to the value copied from the BuildBasis dashboard.

3.) Select the “Add post build action” option.

4.) For the type select “Executable script”

5.) Use the “Execute Shell” option

6.) Copy the following script:

curl  https://api.buildbasis.com/api/v1/download-reporter?platform=jenkins --output buildbasis.sh
jenkins_data=$(curl ${BUILD_URL}/api/json --user REPLACE_WITH_A_JENKINS_USER_NAME:REPLACE_WITH_A_JENKINS_API_KEY)

chmod +x buildbasis.sh
./buildbasis.sh $jenkins_data

6a.) Notice that you must first make a curl request to Jenkins to retrieve some of the build data:

jenkins_data=$(curl ${BUILD_URL}/api/json --user USER:API_KEY)

7.) Run a pipeline, you should see the data available within the BuildBasis platform