As a developer you may (and shouldn’t) have access to make configuration changes to your team’s CloudBees CI managed controller (Jenkins instance). However, developers can take advantage of the GitOps approach to managing the configuration of a CloudBees CI managed controller by requesting configuration changes via GitHub pull requests.
In this lab you will act as developer and CloudBees CI admin, where you will review and merge a pull request to your cloudbees-ci-config-bundle
repository in your workshop GitHub Organization and then the CasC bundle will be updated and automatically reloaded by the config-bundle-ops job on your managed controller. But before the bundle is automatically updated, we must put on our Jenkins admin hat and update the CloudBees CI Configuration Bundle Pipeline template.
pipeline-template-catalog
repository in your workshop GitHub Organization, open the Jenkinsfile
for the CloudBees CI Configuration Bundle Pipeline Catalog template in the templates/casc-bundle/
directory and click on the pencil button to edit. 'casc':{'auto_reload':'true'}
in the jsonEvent
of the publishEvent
. So to automatically reload the bundle for your controller, update the Jenkinsfile
to match the following:library 'pipeline-library'
pipeline {
agent none
options {
buildDiscarder(logRotator(numToKeepStr: '2'))
timeout(time: 10, unit: 'MINUTES')
}
stages {
stage('Publish CasC Bundle Update Event') {
agent { label 'default' }
when {
beforeAgent true
branch 'main'
}
environment { CASC_UPDATE_SECRET = credentials('casc-update-secret') }
steps {
gitHubParseOriginUrl()
publishEvent event:jsonEvent("""
{
'controller':{'name':'${BUNDLE_ID}','action':'casc_bundle_update','bundle_id':'${BUNDLE_ID}'},
'github':{'organization':'${GITHUB_ORG}','repository':'${GITHUB_REPO}'},
'secret':'${CASC_UPDATE_SECRET}',
'casc':{'auto_reload':'true'}
}
"""), verbose: true
}
}
}
}
main
branch. Please ensure that you have signed up for the CloudBees Workshops Slack workspace as instructed in the Pre-Workshop Setup before continuing with this lab.
cloudbees-ci-config-bundle
repository in GitHub and click on the Pull requests link. cloudbees-slack
plugin and cloudbees-slack-integration
configuration for your CloudBees CI user. jenkins.yaml
file name to edit the file. slack
parameter to match the email you used to sign up to the CloudBees Workshops Slack workspace in the Pre-Workshop Setup, then scroll down to Commit changes, ensure that “Commit directly to the dev-casc-lab
branch” is selected and click the Commit changes button. cloudbees-slack
plugin and updated the configuration to match what is in the main
branch of you cloudbees-ci-config-bundle
repository; and you will see the CloudBees Slack Integration added to the Managed Jenkins screen.For instructor led workshops please return to the workshop slides