Skip to content
Snippets Groups Projects
Commit aee107df authored by Tucker Siegel's avatar Tucker Siegel
Browse files

update

parent a68f7621
No related branches found
No related tags found
No related merge requests found
pipeline {
agent {label "node2"}
tools {nodejs "node"}
stages {
stage('build') {
steps {
git branch: 'main',
credentialsId: 'tucker-gitlab-login',
url: "https://gitlab.cs.umd.edu/dawn/go-backend/dawn-manager.git"
sh """
npm i
npm run build-staging
"""
}
}
stage('copy build') {
steps {
sh '''
sudo rm -rf /var/www/dawn_staging/build/_admin
sudo mkdir /var/www/dawn_staging/build/_admin
sudo cp -r build/* /var/www/dawn_staging/build/_admin
'''
}
}
stage('restart nginx') {
steps {
sh '''
sudo service nginx restart
'''
}
}
}
}
pipeline { def call(String repo, String branch, String serviceName) {
agent any pipeline {
agent { label 'node2' }
// parameters {
// string{
// name: "BRANCH_NAME",
// defaultValue: "",
// description: "Branch to use"
// }
// }
tools { tools {
go 'go-1.16' go 'go-1.16'
} }
...@@ -10,16 +18,24 @@ pipeline { ...@@ -10,16 +18,24 @@ pipeline {
stage('checkout') { stage('checkout') {
steps { steps {
git branch: "main", git branch: branch,
credentialsId: 'tucker-gitlab-login', credentialsId: 'tucker-gitlab-login',
url: "https://gitlab.cs.umd.edu/dawn/go-backend/dawn-manager.git" url: repo
} }
} }
stage('test') {
steps {
sh """
dawn-cli test
"""
}
}
stage('build') { stage('build') {
steps { steps {
sh """ sh """
dawn-cli build-image -p . dawn-cli build-image -p . -e staging
""" """
} }
} }
...@@ -27,7 +43,7 @@ pipeline { ...@@ -27,7 +43,7 @@ pipeline {
stage('update backend services') { stage('update backend services') {
steps { steps {
sh ''' sh '''
curl -o docker-compose-dev.yml --header "PRIVATE-TOKEN: y2FHtFXMC8X13onnEfiE" "https://gitlab.cs.umd.edu/api/v4/projects/16574/repository/files/docker-compose-dev.yml/raw?ref=main" 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 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.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 prometheus.rules.yml --header "PRIVATE-TOKEN: y2FHtFXMC8X13onnEfiE" "https://gitlab.cs.umd.edu/api/v4/projects/16574/repository/files/prometheus.rules.yml/raw?ref=main"
...@@ -38,9 +54,23 @@ pipeline { ...@@ -38,9 +54,23 @@ pipeline {
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/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" 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 dawn-manager" sh "dawn-cli update -s ${serviceName} -e staging"
} }
} }
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
}
}
} }
}
\ No newline at end of file
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