Skip to content
Snippets Groups Projects
Commit e188be70 authored by tgsiegel's avatar tgsiegel
Browse files

fill out slack integration

parent 62dde69e
No related branches found
No related tags found
No related merge requests found
{
"extends": "recommended",
"rules": {
"CompileStatic": {
"enabled": false
},
"DuplicateStringLiteral": {
"enabled": false
},
"LineLength": {
"enabled": false
},
"MethodReturnTypeRequired": {
"enabled": false
},
"NoDef": {
"enabled": false
}
}
}
\ No newline at end of file
pipeline {
agent {label "node3"}
tools {
agent { label 'node3' }
tools {
go 'go-1.16'
}
stages {
stage('notify') {
steps {
script {
slack_send_start()
}
}
}
stage('build new dawn-cli') {
steps {
git branch: 'main',
stages {
stage('notify') {
steps {
script {
slack_send_start()
}
}
}
stage('build new dawn-cli') {
steps {
git branch: 'main',
credentialsId: 'tucker-gitlab-login',
url: 'https://gitlab.cs.umd.edu/dawn/go-backend/dawn-cli'
sh """
go build
sh '''
go build
sudo cp dawn-cli /usr/local/bin/dawn-cli
"""
'''
}
}
}
stage('cleanup old images') {
steps {
sh '''
stage('cleanup old images') {
steps {
sh '''
docker rmi $(docker images | grep "dawn/.*-test" | awk '{print $3}') --force || true
docker rmi $(docker images | grep "<none>" | awk '{print $3}') --force || true
'''
}
}
}
stage('build new dawn-cli image') {
steps {
sh '''
stage('build new dawn-cli image') {
steps {
sh '''
docker build -t dawn/dawn-cli .
'''
}
}
}
}
post {
success {
script {
slack_send_success()
}
}
failure {
script {
slack_send_failure()
}
}
}
}
\ No newline at end of file
post {
success {
script {
slack_send_success()
}
}
failure {
script {
slack_send_failure()
}
}
}
}
pipeline {
agent {label "node2"}
tools {
agent { label 'node2' }
tools {
go 'go-1.16'
}
stages {
stage('build new dawn-cli') {
steps {
git branch: 'main',
}
stages {
stage('notify') {
steps {
script {
slack_send_start()
}
}
}
stage('build new dawn-cli') {
steps {
git branch: 'main',
credentialsId: 'tucker-gitlab-login',
url: 'https://gitlab.cs.umd.edu/dawn/go-backend/dawn-cli'
sh """
go build
sh '''
go build
sudo cp dawn-cli /usr/local/bin/dawn-cli
"""
'''
}
}
}
stage('cleanup old images') {
steps {
sh '''
stage('cleanup old images') {
steps {
sh '''
docker rmi $(docker images | grep "dawn/.*-test" | awk '{print $3}') --force || true
docker rmi $(docker images | grep "<none>" | awk '{print $3}') --force || true
'''
}
}
}
// stage('cleanup old images') {
// steps {
// sh '''
// docker image prune --filter "until=168h" --filter "label!=latest" || true
// '''
// sh '''
// docker rmi $(docker images | grep 'dev-test') || true
// '''
// }
// }
stage('build new dawn-cli image') {
steps {
sh '''
stage('build new dawn-cli image') {
steps {
sh '''
docker build -t dawn/dawn-cli .
'''
}
}
}
// stage('redeploy') {
// steps {
// sh """
// dawn-cli deploy
// """
// }
// }
}
}
\ No newline at end of file
post {
success {
script {
slack_send_success()
}
}
failure {
script {
slack_send_failure()
}
}
}
}
pipeline {
agent {label "node3"}
tools {nodejs "node"}
stages {
stage('build') {
steps {
sh """
agent { label 'node3' }
tools { nodejs 'node' }
stages {
stage('notify') {
steps {
script {
slack_send_start()
}
}
}
stage('build') {
steps {
sh '''
npm i
npm run build:dev
"""
'''
}
}
}
stage('copy build') {
steps {
sh '''
stage('copy build') {
steps {
sh '''
sudo rm -rf /var/www/dawn_dev/build
sudo cp -r build /var/www/dawn_dev
'''
}
}
}
stage('restart nginx') {
steps {
sh '''
stage('restart nginx') {
steps {
sh '''
sudo service nginx restart
'''
}
}
}
post {
success {
script {
slack_send_success()
}
}
failure {
script {
slack_send_failure()
}
}
}
}
}
\ No newline at end of file
}
pipeline {
agent {label "node2"}
tools {nodejs "node"}
stages {
stage('build') {
steps {
git branch: 'staging',
agent { label 'node2' }
tools { nodejs 'node' }
stages {
stage('notify') {
steps {
script {
slack_send_start()
}
}
}
stage('build') {
steps {
git branch: 'staging',
credentialsId: 'tucker-gitlab-login',
url: 'https://gitlab.cs.umd.edu/dawn/dawn-client'
sh """
sh '''
npm i
npm run build:staging
"""
'''
}
}
}
stage('copy build') {
steps {
sh '''
stage('copy build') {
steps {
sh '''
sudo rm -rf /var/www/dawn_staging/build
sudo cp -r build /var/www/dawn_staging/build
'''
}
}
}
stage('restart nginx') {
steps {
sh '''
stage('restart nginx') {
steps {
sh '''
sudo service nginx restart
'''
}
}
}
post {
success {
script {
slack_send_success()
}
}
failure {
script {
slack_send_failure()
}
}
}
}
}
\ No newline at end of file
}
pipeline {
agent {label "master"}
tools {nodejs "node"}
stages {
stage('build') {
steps {
git branch: 'main',
agent { label 'master' }
tools { nodejs 'node' }
stages {
stage('notify') {
steps {
script {
slack_send_start()
}
}
}
stage('build') {
steps {
git branch: 'main',
credentialsId: 'tucker-gitlab-login',
url: "https://gitlab.cs.umd.edu/dawn/go-backend/dawn-manager.git"
url: 'https://gitlab.cs.umd.edu/dawn/go-backend/dawn-manager.git'
sh """
sh '''
npm i
npm run build
"""
'''
}
}
}
stage('copy build') {
steps {
sh '''
stage('copy build') {
steps {
sh '''
sudo rm -rf /var/www/dawn_dev/_admin
sudo mkdir /var/www/dawn_dev/_admin
sudo cp -r build/* /var/www/dawn_dev/_admin
'''
}
}
}
stage('restart nginx') {
steps {
sh '''
stage('restart nginx') {
steps {
sh '''
sudo service nginx restart
'''
}
}
}
post {
success {
script {
slack_send_success()
}
}
failure {
script {
slack_send_failure()
}
}
}
}
}
pipeline {
agent {label "node2"}
tools {nodejs "node"}
stages {
stage('build') {
steps {
git branch: 'main',
agent { label 'node2' }
tools { nodejs 'node' }
stages {
stage('notify') {
steps {
script {
slack_send_start()
}
}
}
stage('build') {
steps {
git branch: 'main',
credentialsId: 'tucker-gitlab-login',
url: "https://gitlab.cs.umd.edu/dawn/go-backend/dawn-manager.git"
url: 'https://gitlab.cs.umd.edu/dawn/go-backend/dawn-manager.git'
sh """
sh '''
npm i
npm run build-staging
"""
'''
}
}
}
stage('copy build') {
steps {
sh '''
stage('copy build') {
steps {
sh '''
sudo rm -rf /var/www/dawn_staging/_admin
sudo mkdir /var/www/dawn_staging/_admin
sudo cp -r build/* /var/www/dawn_staging/_admin
'''
}
}
}
stage('restart nginx') {
steps {
sh '''
stage('restart nginx') {
steps {
sh '''
sudo service nginx restart
'''
}
}
}
post {
success {
script {
slack_send_success()
}
}
failure {
script {
slack_send_failure()
}
}
}
}
}
def call(String serviceName) {
pipeline {
agent {
node {
label "node3"
customWorkspace "${serviceName}"
}
}
tools {
go 'go-1.16'
}
stages {
stage('test') {
steps {
sh """
pipeline {
agent {
node {
label 'node3'
customWorkspace "${serviceName}"
}
}
tools {
go 'go-1.16'
}
stages {
stage('notify') {
steps {
script {
slack_send_start()
}
}
}
stage('test') {
steps {
sh '''
dawn-cli test
"""
}
}
'''
}
}
stage('build') {
steps {
sh """
stage('build') {
steps {
sh '''
dawn-cli build-image -p . -e dev
"""
}
}
'''
}
}
stage('update backend services') {
steps {
sh '''
stage('update backend services') {
steps {
sh '''
curl -o docker-compose-dev.yml --header "PRIVATE-TOKEN: y2FHtFXMC8X13onnEfiE" "https://gitlab.cs.umd.edu/api/v4/projects/16574/repository/files/docker-compose-staging.yml/raw?ref=main"
curl -o shared-compose.yml --header "PRIVATE-TOKEN: y2FHtFXMC8X13onnEfiE" "https://gitlab.cs.umd.edu/api/v4/projects/16574/repository/files/shread-compose.yml/raw?ref=main"
curl -o prometheus.yml --header "PRIVATE-TOKEN: y2FHtFXMC8X13onnEfiE" "https://gitlab.cs.umd.edu/api/v4/projects/16574/repository/files/prometheus.yml/raw?ref=main"
curl -o prometheus.rules.yml --header "PRIVATE-TOKEN: y2FHtFXMC8X13onnEfiE" "https://gitlab.cs.umd.edu/api/v4/projects/16574/repository/files/prometheus.rules.yml/raw?ref=main"
curl -o rabbitmq.conf --header "PRIVATE-TOKEN: y2FHtFXMC8X13onnEfiE" "https://gitlab.cs.umd.edu/api/v4/projects/16574/repository/files/rabbitmq.conf/raw?ref=main"
mkdir elk_config || true
curl -o logstash-compose.yml --header "PRIVATE-TOKEN: y2FHtFXMC8X13onnEfiE" "https://gitlab.cs.umd.edu/api/v4/projects/16574/repository/files/logstash-compose.conf/raw?ref=main"
curl -o elk_config/elasticsearch.yml --header "PRIVATE-TOKEN: y2FHtFXMC8X13onnEfiE" "https://gitlab.cs.umd.edu/api/v4/projects/16574/repository/files/elk_config%2Felasticsearch.yml/raw?ref=main"
curl -o elk_config/filebeat.yml --header "PRIVATE-TOKEN: y2FHtFXMC8X13onnEfiE" "https://gitlab.cs.umd.edu/api/v4/projects/16574/repository/files/elk_config%2Ffilebeat.yml/raw?ref=main"
'''
sh "dawn-cli update -s ${serviceName} -e dev"
}
}
sh "dawn-cli update -s ${serviceName} -e dev"
}
}
stage('cleanup') {
steps {
sh '''
stage('cleanup') {
steps {
sh '''
docker rmi $(docker images | grep "dawn/.*-test" | awk '{print $3}') --force || true
'''
}
}
}
// post {
// always {
// cobertura autoUpdateHealth: false, autoUpdateStability: false, coberturaReportFile: '**/coverage.xml', enableNewApi: true, failUnhealthy: false, failUnstable: false, lineCoverageTargets: '80, 40, 60', maxNumberOfBuilds: 0, onlyStable: false, sourceEncoding: 'ASCII', zoomCoverageChart: false
// }
// }
}
post {
success {
script {
slack_send_success()
}
}
failure {
script {
slack_send_failure()
}
}
}
}
// post {
// always {
// cobertura autoUpdateHealth: false, autoUpdateStability: false, coberturaReportFile: '**/coverage.xml', enableNewApi: true, failUnhealthy: false, failUnstable: false, lineCoverageTargets: '80, 40, 60', maxNumberOfBuilds: 0, onlyStable: false, sourceEncoding: 'ASCII', zoomCoverageChart: false
// }
// }
}
}
\ No newline at end of file
def call(String repo, String branch, String serviceName) {
pipeline {
agent { label 'node2' }
tools {
go 'go-1.16'
}
options {
buildDiscarder logRotator(artifactDaysToKeepStr: '', artifactNumToKeepStr: '5', daysToKeepStr: '', numToKeepStr: '5')
}
stages {
stage('checkout') {
steps {
git branch: branch,
agent { label 'node2' }
tools {
go 'go-1.16'
}
options {
buildDiscarder logRotator(artifactDaysToKeepStr: '', artifactNumToKeepStr: '5', daysToKeepStr: '', numToKeepStr: '5')
}
stages {
stage('checkout') {
steps {
git branch: branch,
credentialsId: 'tucker-gitlab-login',
url: repo
}
}
stage('test') {
steps {
sh """
}
}
stage('notify') {
steps {
script {
slack_send_start()
}
}
}
stage('test') {
steps {
sh '''
dawn-cli test
"""
}
}
'''
}
}
stage('build') {
steps {
sh """
stage('build') {
steps {
sh '''
dawn-cli build-image -p . -e staging
"""
}
}
'''
}
}
stage('update backend services') {
steps {
sh '''
stage('update backend services') {
steps {
sh '''
curl -o docker-compose-dev.yml --header "PRIVATE-TOKEN: y2FHtFXMC8X13onnEfiE" "https://gitlab.cs.umd.edu/api/v4/projects/16574/repository/files/docker-compose-staging.yml/raw?ref=main"
curl -o shared-compose.yml --header "PRIVATE-TOKEN: y2FHtFXMC8X13onnEfiE" "https://gitlab.cs.umd.edu/api/v4/projects/16574/repository/files/shread-compose.yml/raw?ref=main"
curl -o prometheus.yml --header "PRIVATE-TOKEN: y2FHtFXMC8X13onnEfiE" "https://gitlab.cs.umd.edu/api/v4/projects/16574/repository/files/prometheus.yml/raw?ref=main"
curl -o prometheus.rules.yml --header "PRIVATE-TOKEN: y2FHtFXMC8X13onnEfiE" "https://gitlab.cs.umd.edu/api/v4/projects/16574/repository/files/prometheus.rules.yml/raw?ref=main"
curl -o rabbitmq.conf --header "PRIVATE-TOKEN: y2FHtFXMC8X13onnEfiE" "https://gitlab.cs.umd.edu/api/v4/projects/16574/repository/files/rabbitmq.conf/raw?ref=main"
mkdir elk_config || true
curl -o logstash-compose.yml --header "PRIVATE-TOKEN: y2FHtFXMC8X13onnEfiE" "https://gitlab.cs.umd.edu/api/v4/projects/16574/repository/files/logstash-compose.conf/raw?ref=main"
curl -o elk_config/elasticsearch.yml --header "PRIVATE-TOKEN: y2FHtFXMC8X13onnEfiE" "https://gitlab.cs.umd.edu/api/v4/projects/16574/repository/files/elk_config%2Felasticsearch.yml/raw?ref=main"
curl -o elk_config/filebeat.yml --header "PRIVATE-TOKEN: y2FHtFXMC8X13onnEfiE" "https://gitlab.cs.umd.edu/api/v4/projects/16574/repository/files/elk_config%2Ffilebeat.yml/raw?ref=main"
'''
sh "dawn-cli update -s ${serviceName} -e staging -d dawn-server"
}
}
sh "dawn-cli update -s ${serviceName} -e staging -d dawn-server"
}
}
stage('cleanup') {
steps {
sh '''
stage('cleanup') {
steps {
sh '''
docker rmi $(docker images | grep "dawn/.*-test" | awk '{print $3}') --force || true
'''
}
}
}
// post {
// always {
// cobertura autoUpdateHealth: false, autoUpdateStability: false, coberturaReportFile: '**/coverage.xml', enableNewApi: true, failUnhealthy: false, failUnstable: false, lineCoverageTargets: '80, 40, 60', maxNumberOfBuilds: 0, onlyStable: false, sourceEncoding: 'ASCII', zoomCoverageChart: false
// }
// }
}
}
// post {
// always {
// cobertura autoUpdateHealth: false, autoUpdateStability: false, coberturaReportFile: '**/coverage.xml', enableNewApi: true, failUnhealthy: false, failUnstable: false, lineCoverageTargets: '80, 40, 60', maxNumberOfBuilds: 0, onlyStable: false, sourceEncoding: 'ASCII', zoomCoverageChart: false
// }
// }
post {
success {
script {
slack_send_success()
}
}
failure {
script {
slack_send_failure()
}
}
}
}
}
\ No newline at end of file
def call() {
BUILD_TRIGGERED_BY = "${currentBuild.getBuildCauses()[0].shortDescription} / ${currentBuild.getBuildCauses()[0].userId}"
slackSend(channel: "ci", color: "danger", message: "${JOB_NAME}-#${BUILD_NUMBER}-${GIT_BRANCH} failed after ${currentBuild.durationString} (<${BUILD_URL}|Open>)")
}
def call() {
BUILD_TRIGGERED_BY = "${currentBuild.getBuildCauses()[0].shortDescription} / ${currentBuild.getBuildCauses()[0].userId}"
BUILD_TRIGGERED_BY = "${currentBuild.getBuildCauses()[0].userId}"
slackSend(channel: "ci", message: "${JOB_NAME}-#${BUILD_NUMBER}-${GIT_BRANCH} triggered by ${BUILD_TRIGGERED_BY} (<${BUILD_URL}|Open>)")
}
def call() {
BUILD_TRIGGERED_BY = "${currentBuild.getBuildCauses()[0].shortDescription} / ${currentBuild.getBuildCauses()[0].userId}"
slackSend(channel: "ci", color: "good", message: "${JOB_NAME}-#${BUILD_NUMBER}-${GIT_BRANCH} success after ${currentBuild.durationString} (<${BUILD_URL}|Open>)")
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment