The jenkins enabled docker image used in examples here can be found on dockerhub.
The jenkins-agent enabled docker images used in examples here can be found on dockerhub.
Notes for how to develop and test pipelines using config-as-code is here.
The pipeline library was developed with a focus to ease build processes which have a more or less similar project structure e.g.
- VMware Vsphere
- Ansible Automation
- Openshift
- Kubernetes
- Pivotal PCF
- Maven/Java
- local Artifact Server (e.g., Sonatype Nexus or Artifactory)
- GIT (e.g., gitlab, gitea)
The assumption is that in these environments
- Jenkins has a dedicated user account to checkout code (or one per project)
- the artifact server caches public artifacts and acts as a internal artifact server
So why configure maven repositories and scm credentials in every pipeline?
So the key concepts of the pipeline enable you to
- Auto provide credentials (no worries, only Jenkins credential ids, not the credential itself) (see Credentials)
- Auto provide maven settings (see ManagedFiles)
- configure each job the same way (see ConfigStructure)
- log and see the things you are interested in (see Logging) to builds.
Running this pipeline library will result in more structured and easier to maintain pipeline scripts.
Looking for an example on how a pipeline script looks like when using Pipeline? Have a look at Usage examples
An ansible role is used to setup all docker stack instances.
The bootstrap_docker_stack
ansible role used to stand up the docker stack can be found here.
The bootstrap_docker_stack
ansible role contains the jenkins config-as-code (jcac) yaml definition in template form used to setup the jenkins jcac instance.
The jcac definition can be found here.
Have a look at the pipeline setup tutorial to configure and start using the shared pipeline library.
This a Jenkins library built to make it easier to configure build-deploy pipelines without necessarily knowing about Jenkinsfile syntax.
When using this library, your Jenkinsfile should look something like this:
#!/usr/bin/env groovy
@Library('pipeline-automation-library')
Map config = [:]
buildVmTemplate(config)
The example above loads the library, and calls the shared buildVmTemplate
pipeline used to build vm templates for vmware vsphere, kvm, virtualbox, hyperv, and other possible hypervisor environments.
Configure the library in jenkins as seen below.
Some of the most often used pipelines in this library include:
- Run Ansible Playbook
- runAnsibleParamWrapper - used by pipelines within a defined node hierarchy (e.g., environment and tag) to collect node parameters to start the common ansible playbook job.
See here for document explaining example setup and usage of this pipeline. - runAnsibleDevJob - used to develop ansible playbooks against a branch of the ansible source repo.
- runAnsibleParamWrapper - used by pipelines within a defined node hierarchy (e.g., environment and tag) to collect node parameters to start the common ansible playbook job.
- Build Vm Template
- buildVmTemplate - pipeline used to build vm templates for vmware vsphere, kvm, virtualbox, hyperv, and other possible hypervisor environments.
See here for document explaining example setup and usage of this pipeline.
- buildVmTemplate - pipeline used to build vm templates for vmware vsphere, kvm, virtualbox, hyperv, and other possible hypervisor environments.
- Build Docker Image
- [buildDockerManifest(](./vars/buildDockerManifest(.groovy) - pipeline used to build docker images
- This build job supports using a build manifest to specify a hierarchical set of image build dependencies.
- The job then leverages a build job to build each single image individually
- The single 'build-docker-image' pipeline job definition referenced in the code is located at buildDockerImage.groovy See Jenkinsfile here for advanced example with multiple-image dependencies.
- [buildDockerManifest(](./vars/buildDockerManifest(.groovy) - pipeline used to build docker images
- Run Connectivity Test
- runConnectivityTest - pipeline used run connectivity tests from the specified jenkins nodes.
This is mainly used by jenkins admin to verify connectivity from any/all specified jenkins nodes to the specified endpoints.
See more detailed information here for how to use.
- runConnectivityTest - pipeline used run connectivity tests from the specified jenkins nodes.
- Run Application Test Harness
- Run App Deployment Pipeline
- runAppDeployEnvJob - used to deploy maven java application.
- pcfBuildDeployMvn - used to build and deploy maven java application.
See more detailed information here for how to use. - pcfBuildDeployGradle - used to build and deploy maven java application.
See more detailed information here for how to use. - runPcfDeploy - used to deploy maven application to PCF
See the pivotal pcf section for details.