123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- pipeline {
- agent {
- label "swarm"
- }
- environment {
- DOCKER_REGISTRY='dev-registry.infoclinica.ru:5000'
- DOCKER_IMAGE='ovpn'
- SERVICE_IMAGE='container_run'
- SERVICE_NAME='ovpn'
- SWARM_GIT_URL='ssh://git@git.sdsys.ru:8022/iru/stack-deploy.git'
- SWARM_GIT_NAME='stack-deploy'
- PKI_GIT_URL='ssh://git@git.sdsys.ru:8022/iru/openvpn-pki.git'
- PKI_GIT_NAME='openvpn-pki'
- GOST_GIT_DIR='openvpn'
- JENKINS_MAIL='jenkins@sdsys.ru'
- CLUSTER_NAME='dev-iru-swarm.infoclinica.lan'
- }
- parameters {
- string(
- name: "repo",
- defaultValue: "prod",
- description: "Repository to build and/or deploy from."
- )
- string(
- name: "mailto",
- defaultValue: "tomishinets.v@sdsys.ru",
- description: "Email which has to be notified."
- )
- }
- stages {
- stage("Pull PKI repo") {
- steps {
- withCredentials([sshUserPrivateKey(credentialsId: 'provision', keyFileVariable: 'GIT_SSH_KEY', passphraseVariable: '', usernameVariable: 'GIT_SSH_USERNAME')]) {
- sh '''GIT_SSH_COMMAND='ssh -i ${GIT_SSH_KEY} -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no' \
- git clone ${PKI_GIT_URL}
- '''
- }
- sh '''cp ${WORKSPACE}/openvpn-pki/open/easy-rsa/keys/ca.crt \
- ${WORKSPACE}/openvpn-pki/open/easy-rsa/keys/server.crt \
- ${WORKSPACE}/openvpn-pki/open/easy-rsa/keys/server.key \
- ${WORKSPACE}/openvpn-pki/open/easy-rsa/keys/sds-client.crt \
- ${WORKSPACE}/openvpn-pki/open/easy-rsa/keys/sds-client.key \
- ${WORKSPACE}/openvpn-pki/open/easy-rsa/keys/ta.key \
- ${WORKSPACE}/openvpn-pki/open/easy-rsa/keys/stonevpn.crl \
- ${WORKSPACE}/openvpn-pki/open/easy-rsa/keys/dh2048.pem \
- ${WORKSPACE}/openvpn/keys
- ls -al ${WORKSPACE}/openvpn/keys/
- '''
- }
- }
- stage("Build") {
- steps {
- echo "Building ${DOCKER_REGISTRY}/${DOCKER_IMAGE}:${BUILD_NUMBER}."
- sh "docker build --no-cache -t ${DOCKER_REGISTRY}/${DOCKER_IMAGE}:${BUILD_NUMBER} ."
- }
- }
- }
- post {
- always {
- deleteDir()
- }
- }
- }
|