Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adicionando CI produçao #28

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
217 changes: 217 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,217 @@
pipeline {
agent {
node {
label 'py-uniformes'
}
}

options {
buildDiscarder(logRotator(numToKeepStr: '50', artifactNumToKeepStr: '50'))
disableConcurrentBuilds()
skipDefaultCheckout()
}


stages {
stage('CheckOut') {
steps {
checkout scm
}
}

stage('Docker build DEV') {
when {
branch 'development'
}
steps {
sh 'echo Build Docker image'

// Start JOB Rundeck para build das imagens Docker e push SME Registry

script {
step([$class: "RundeckNotifier",
includeRundeckLogs: true,

//JOB DE BUILD
jobId: "a73bc7a7-d705-4fa8-84c7-c0f165e820cb",
nodeFilters: "",
//options: """
// PARAM_1=value1
// PARAM_2=value2
// PARAM_3=
// """,
rundeckInstance: "Rundeck-SME",
shouldFailTheBuild: true,
shouldWaitForRundeckJob: true,
tags: "",
tailLog: true])
}
}
}

stage('Deploy DEV') {
when {
branch 'development'
}
steps {
sh 'echo Deploying desenvolvimento'
//Start JOB Rundeck para update de deploy Kubernetes DEV

script {
step([$class: "RundeckNotifier",
includeRundeckLogs: true,
jobId: "4bc8cacd-8c89-4782-a816-dd8cd2399472",
nodeFilters: "",
//options: """
// PARAM_1=value1
// PARAM_2=value2
// PARAM_3=
// """,
rundeckInstance: "Rundeck-SME",
shouldFailTheBuild: true,
shouldWaitForRundeckJob: true,
tags: "",
tailLog: true])
}


}
}

stage('Docker build HOM') {
when {
branch 'homolog'
}
steps {
sh 'echo build homologacao'

// Start JOB Rundeck para build das imagens Docker e push registry SME

script {
step([$class: "RundeckNotifier",
includeRundeckLogs: true,


//JOB DE BUILD
jobId: "a5ae1881-6886-493c-b756-f5c17cab9bcd",
nodeFilters: "",
//options: """
// PARAM_1=value1
// PARAM_2=value2
// PARAM_3=
// """,
rundeckInstance: "Rundeck-SME",
shouldFailTheBuild: true,
shouldWaitForRundeckJob: true,
tags: "",
tailLog: true])
}
}
}

stage('Deploy HOM') {
when {
branch 'homolog'
}
steps {
timeout(time: 24, unit: "HOURS") {

telegramSend("${JOB_NAME}...O Build ${BUILD_DISPLAY_NAME} - Requer uma aprovação para deploy !!!\n Consulte o log para detalhes -> [Job logs](${env.BUILD_URL}console)\n")
input message: 'Deseja realizar o deploy?', ok: 'SIM', submitter: 'anderson_morais'
}


//Start JOB Rundeck para update de imagens no host homologação

script {
step([$class: "RundeckNotifier",
includeRundeckLogs: true,
jobId: "f137599a-40f9-4b65-98d7-4d9639240148",
nodeFilters: "",
//options: """
// PARAM_1=value1
// PARAM_2=value2
// PARAM_3=
// """,
rundeckInstance: "Rundeck-SME",
shouldFailTheBuild: true,
shouldWaitForRundeckJob: true,
tags: "",
tailLog: true])
}


}
}

stage('Docker Build PROD') {

when {
branch 'master'
}
steps {
timeout(time: 24, unit: "HOURS") {

telegramSend("${JOB_NAME}...O Build ${BUILD_DISPLAY_NAME} - Requer uma aprovação para deploy !!!\n Consulte o log para detalhes -> [Job logs](${env.BUILD_URL}console)\n")
input message: 'Deseja realizar o deploy?', ok: 'SIM', submitter: 'anderson_morais'
}
sh 'echo Deploy produção'

// Start JOB Rundeck para build das imagens Docker e push registry SME

script {
step([$class: "RundeckNotifier",
includeRundeckLogs: true,


//JOB DE BUILD
jobId: "103be25c-f14c-4b6e-ae0a-72e517cf0270",
nodeFilters: "",
//options: """
// PARAM_1=value1
// PARAM_2=value2
// PARAM_3=
// """,
rundeckInstance: "Rundeck-SME",
shouldFailTheBuild: true,
shouldWaitForRundeckJob: true,
tags: "",
tailLog: true])
}
}
}

stage('Deploy PROD') {
when {
branch 'master'
}
steps {
timeout(time: 24, unit: "HOURS") {
telegramSend("${JOB_NAME}...O Build ${BUILD_DISPLAY_NAME} - Requer uma aprovação para deploy !!!\n Consulte o log para detalhes -> [Job logs](${env.BUILD_URL}console)\n")
input message: 'Deseja realizar o deploy?', ok: 'SIM', submitter: 'anderson_morais, bruno_alevato'
}

//Start JOB Rundeck para deploy em produção

script {
step([$class: "RundeckNotifier",
includeRundeckLogs: true,
jobId: "c015f11c-407f-48a7-a931-1f4728ffdd4c",
nodeFilters: "",
//options: """
// PARAM_1=value1
// PARAM_2=value2
// PARAM_3=
// """,
rundeckInstance: "Rundeck-SME",
shouldFailTheBuild: true,
shouldWaitForRundeckJob: true,
tags: "",
tailLog: true])
}
}
}

}

}