Jenkins
This guide shows how to use Onboardbase in a Jenkins Environment
Requirements
- A Service Token, which can be generated from your Onboardbase account
- Working Jenkins installation with the credentials plugin already installed
- You have the Onboardbase CLI installed on your Jenkins executor nodes or container images.
Generate service token
To successfully use Onboardbase in a Jenkins environment, create a service token from the organization settings page.
Setup Jenkins Credentials
With the credentials plugin already installed and from the Jenkins dashboard, click on manage Jenkins and manage credentials.
Then using the Jenkins domain, add a new secret text with the description as ONBOARDBASE_TOKEN
and the secret text as the token generated in the step above.
Then add a new secret text with the description as ONBOARDBASE_PROJECT
and the secret field should contain the name of your project.
Finally, add another secret with the name ONBOARDBASE_ENVIRONMENT
with the secret as the environment to pull the secrets from under the ONBOARDBASE_PROJECT
project.
Jenkins sample project
To pull secrets from Onboardbase, create a project and in the configuration, under build environments, click on use secret text(s) or file(s)
, add the credentials created above, ONBOARDBASE_TOKEN
, ONBOARDBASE_PROJECT
and ONBOARDBASE_ENVIRONMENT
as different environment variable names and select the respective credentials for each secret.
Finally, click on the build steps, add the build step and then execute shell. Add the below command in the textarea input field:
# Authorizes the CLI
onboardbase config:set --token "$ONBOARDBASE_TOKEN"
# Run a build comman
onboardbase run printenv -e "$ONBOARDBASE_PROJECT" -p "$ONBOARDBASE_PROJECT"
Then click on the Build Now to run the project.
Updated about 1 year ago