make gitea/Jenkinsfile declarative
This commit is contained in:
29
dockerfiles/services/gitea/Jenkinsfile
vendored
29
dockerfiles/services/gitea/Jenkinsfile
vendored
@@ -1,30 +1,47 @@
|
||||
node('docker') {
|
||||
def workdir = 'dockerfiles/services/gitea'
|
||||
|
||||
pipeline {
|
||||
agent { label 'docker' }
|
||||
options {
|
||||
buildDiscarder(logRotator(numToKeepStr: '2'))
|
||||
}
|
||||
triggers {
|
||||
cron('@weekly')
|
||||
}
|
||||
stages {
|
||||
stage('prepare') {
|
||||
git credentialsId: 'f1f58215-c789-44a2-9b72-50e4425cb061', url: 'ssh://git@git.xai-corp.net:10022/xai-corp.net/provisioning.git'
|
||||
steps {
|
||||
checkout scm
|
||||
sh 'ls'
|
||||
}
|
||||
}
|
||||
|
||||
stage('build') {
|
||||
steps {
|
||||
dir(workdir) {
|
||||
sh "DOCKER_HOST=dkhost:2376 docker-compose -f docker-compose.yml pull"
|
||||
sh "DOCKER_HOST=${docker_host} docker-compose -f docker-compose.yml pull"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('deploy') {
|
||||
steps {
|
||||
dir(workdir) {
|
||||
sh """
|
||||
export DOCKER_HOST=${docker_host}
|
||||
docker stack deploy --with-registry-auth --prune -c docker-compose.yml gitea
|
||||
docker service update gitea_app
|
||||
../scaleout.sh gitea_app 180
|
||||
"""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('smoke tests') {
|
||||
steps {
|
||||
dir(workdir) {
|
||||
sleep 60
|
||||
sh "curl -If http://dkhost:10080"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
6
dockerfiles/services/scaleout.sh
Normal file
6
dockerfiles/services/scaleout.sh
Normal file
@@ -0,0 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
REPLICA_COUNT=`docker service inspect $1 | jq '.[0].Spec.Mode.Replicated.Replicas'`
|
||||
./timeout.sh -t $2 docker service scale $1=$(($REPLICA_COUNT*2))
|
||||
./timeout.sh -t $2 docker service scale $1=$(($REPLICA_COUNT))
|
||||
docker service update -q $1
|
||||
Reference in New Issue
Block a user