Continuous Integration (CI): Is the practice of merging all developer working copies to a shared mainline several times a day.
Continuous Delivery:
Is a software engineering approach in which teams produce software in short cycles, ensuring that the software can be reliably released at any time and, when releasing the software, doing so manually.
Continuous Delivery:
Is a software engineering approach in which teams produce software in short cycles, ensuring that the software can be reliably released at any time and, when releasing the software, doing so manually.
Continuous Deployments:
Continuous delivery is the ability to deliver software that can be deployed at any time through manual releases while continuous deployment does the same but through automated deployments.
Jenkins is an open source automation server written in Java. Jenkins helps to automate the non-human part of the software development process, with continuous integration and facilitating technical aspects of continuous delivery.
Jenkins Pipeline is a suite of plugins which supports implementing and integrating continuous delivery pipelines into Jenkins.
A continuous delivery (CD) pipeline is an automated expression of your process for getting software from version control right through to your users and customers. Every change to your software (committed in source control) goes through a complex process on its way to being released. This process involves building the software in a reliable and repeatable manner, as well as progressing the built software (called a "build") through multiple stages of testing and deployment.
#!groovy
@Library('pipeline') _
jobTemplate {
APP_NAME = 'java-app'
DEPLOY_ON_K8S = 'false'
BASIC_INVENTORY_PATH = 'ansible/role-based_playbooks/inventory/java-app'
PLAYBOOK_PATH = 'ansible/role-based_playbooks/java-app.yml'
CHANNEL_TO_NOTIFY = 'java-app'
ansibleEnvMap = [dev : "dev",
qa : "rc",
production: "production"]
projectFlow = ['language': 'java']
healthCheckMap = [dev : ["http://0.0.0.0:8080/health"],
qa : ["http://0.0.0.0:8080/health"],
production: ["http://0.0.0.0:8080/health"]]
branchPermissionsMap = [dev : ["authenticated"],
qa : ["first_user", "second_user"],
production: ["first_user", "second_user"]]
}
#!groovy
@Library('pipeline') _
Configures Jenkins to use a library called 'pipeline' which is also known as Nextiva Pipelines.
jobTemplate {
APP_NAME = 'java-app'
DEPLOY_ON_K8S = 'false'
BASIC_INVENTORY_PATH = 'ansible/role-based_playbooks/inventory/java-app'
PLAYBOOK_PATH = 'ansible/role-based_playbooks/java-app.yml'
CHANNEL_TO_NOTIFY = 'java-app'
ansibleEnvMap = [dev : "dev",
qa : "rc",
production: "production"]
projectFlow = ['language': 'java']
healthCheckMap = [dev : ["http://0.0.0.0:8080/health"],
qa : ["http://0.0.0.0:8080/health"],
production: ["http://0.0.0.0:8080/health"]]
branchPermissionsMap = [dev : ["authenticated"],
qa : ["first_user", "second_user"],
production: ["first_user", "second_user"]]
}
#!groovy
@Library('pipeline') _
jobTemplate {
APP_NAME = 'java-app'
DEPLOY_ON_K8S = 'false'
BASIC_INVENTORY_PATH = 'ansible/role-based_playbooks/inventory/java-app'
PLAYBOOK_PATH = 'ansible/role-based_playbooks/java-app.yml'
CHANNEL_TO_NOTIFY = 'java-app'
ansibleEnvMap = [dev : "dev",
qa : "rc",
production: "production"]
projectFlow = ['language': 'java']
healthCheckMap = [dev : ["http://0.0.0.0:8080/health"],
qa : ["http://0.0.0.0:8080/health"],
production: ["http://0.0.0.0:8080/health"]]
branchPermissionsMap = [dev : ["authenticated"],
qa : ["first_user", "second_user"],
production: ["first_user", "second_user"]]
}
$ cd {{project_directory}}
$ git checkout develop
$ git pull
$ git checkout -b feature/jenkinsfile
$ touch Jenkinsfile
#!groovy
@Library('pipeline') _
jobTemplate {
APP_NAME = 'chaley-demo-project-app'
DEPLOY_ON_K8S = 'false'
BASIC_INVENTORY_PATH = 'ansible/role-based_playbooks/inventory/no-op'
PLAYBOOK_PATH = 'ansible/role-based_playbooks/no-op.yml'
CHANNEL_TO_NOTIFY = 'java-app'
ansibleEnvMap = [dev : "dev",
qa : "rc",
production: "production"]
projectFlow = ['language': 'java']
healthCheckMap = [dev : ["http://10.10.10.10:8080/health"],
qa : ["http://10.10.10.20:8080/health","http://10.10.10.21:8080/health"],
production: ["http://10.10.10.30:8080/health","http://10.10.10.31:8080/health","http://10.10.10.32:8080/health"]]
branchPermissionsMap = [dev : ["authenticated"],
qa : ["chaley", "fLastname"],
production: ["chaley", "fLastname"]]
}
#!groovy
@Library('pipeline') _
jobTemplate {
APP_NAME = 'chaley-demo-project-app'
DEPLOY_ON_K8S = 'false'
BASIC_INVENTORY_PATH = 'ansible/role-based_playbooks/inventory/no-op'
PLAYBOOK_PATH = 'ansible/role-based_playbooks/no-op.yml'
CHANNEL_TO_NOTIFY = 'java-app'
ansibleEnvMap = [dev : "dev",
qa : "rc",
production: "production"]
projectFlow = ['language': 'java'
'testCommands': 'mvn clean install -P jenkins && mvn checkstyle:checkstyle',
'postDeployCommands' : 'mvn clean install -P it' ]
healthCheckMap = [dev : ["http://10.10.10.10:8080/health"],
qa : ["http://10.10.10.20:8080/health","http://10.10.10.21:8080/health"],
production: ["http://10.10.10.30:8080/health","http://10.10.10.31:8080/health","http://10.10.10.32:8080/health"]]
branchPermissionsMap = [dev : ["authenticated"],
qa : ["chaley", "fLastname"],
production: ["chaley", "fLastname"]]
MAVEN_VERSION = 'Maven 3.3.3'
JDK_VERSION = "Java 7"
}
Common Overrides
#!groovy
@Library('pipeline') _
def BRANCH_NAME = "${env.BRANCH_NAME}"
jobTemplate {
APP_NAME = 'chaley-demo-project-app'
DEPLOY_ON_K8S = 'false'
BASIC_INVENTORY_PATH = 'ansible/role-based_playbooks/inventory/no-op'
PLAYBOOK_PATH = 'ansible/role-based_playbooks/no-op.yml'
CHANNEL_TO_NOTIFY = 'java-app'
switch (BRANCH_NAME) {
case 'dev':
host = "10.10.10.10"
break
case ~/^release\/.+$/:
host = "10.10.10.20"
break
case 'master':
host = "10.10.10.30"
break
default:
break
}
ansibleEnvMap = [dev : "dev",
qa : "rc",
production: "production"]
projectFlow = ['language': 'java'
'testCommands': 'mvn clean install -P jenkins && mvn checkstyle:checkstyle',
'postDeployCommands' : 'mvn verify -Dchaley.host=${host}' ]
healthCheckMap = [dev : ["http://10.10.10.10:8080/health"],
qa : ["http://10.10.10.20:8080/health","http://10.10.10.21:8080/health"],
production: ["http://10.10.10.30:8080/health","http://10.10.10.31:8080/health","http://10.10.10.32:8080/health"]]
branchPermissionsMap = [dev : ["authenticated"],
qa : ["chaley", "fLastname"],
production: ["chaley", "fLastname"]]
}
Advanced Overrides
#!groovy
@Library('pipeline') _
jobTemplate {
APP_NAME = 'chaley-demo-project-app'
DEPLOY_ON_K8S = true
publishDockerImage = true
ANSIBLE_DEPLOYMENT = false
publishBuildArtifact = false
CHANNEL_TO_NOTIFY = 'java-app'
kubernetesClusterMap = [dev : "dev.nextiva.io",
qa : "qa.nextiva.io",
production: "prod.nextiva.io"]
projectFlow = ['language': 'java'
'testCommands': 'mvn clean install -P jenkins && mvn checkstyle:checkstyle']
healthCheckMap = [dev : ["https://chaley.dev.nextiva.io/health"],
qa : ["https://chaley.qa.nextiva.io/health"],
production: ["https://chaley.prod.nextiva.io/health"]]
branchPermissionsMap = [dev : ["authenticated"],
qa : ["chaley", "fLastname"],
production: ["chaley", "fLastname"]]
}
K8S Overrides
Create Job in Jenkins
Create Job in Jenkins
Create release-start job
Create release-finish job
Create hotfix-start job
Create hotfix-finish job
Automatically build on commit
Manually Building a Branch
Manually Building a Branch
Manually Building a Branch
Build Status
Create Pull Request
Watch it autorun
Merge PR to Develop
Watch it autorun
Release Start Job
Release Finish Job
Simply run the master branch in pipelines
Production Deploy
Hotfix Start Job
Hotfix Finish Job
Simply run the master branch in pipelines
Production Deploy
Contact Brent Marks to participate