|
@@ -52,16 +52,28 @@ pipeline {
|
|
|
steps {
|
|
|
echo "Building ${DOCKER_REGISTRY}/${DOCKER_IMAGE}:${BUILD_NUMBER}."
|
|
|
sh "docker build --no-cache -t ${DOCKER_REGISTRY}/${DOCKER_IMAGE}:${BUILD_NUMBER} ."
|
|
|
-/* echo "Running ${DOCKER_REGISTRY}/${DOCKER_IMAGE}:latest."
|
|
|
- withCredentials([sshUserPrivateKey(credentialsId: 'provision', keyFileVariable: 'GIT_SSH_KEY', passphraseVariable: '', usernameVariable: 'GIT_SSH_USERNAME')]) {
|
|
|
- sh '''set +x
|
|
|
- docker run -i --rm -e TZ=Europe/Moscow -e "mode=keygen" -e "SSHKEY=$(cat ${GIT_SSH_KEY})" \
|
|
|
- -e git_url_pki=ssh://git@git.sdsys.ru:8022/iru/openvpn-pki.git \
|
|
|
- -e git_url_ovpn=ssh://git@git.sdsys.ru:8022/iru/openvpn.git \
|
|
|
- ${DOCKER_REGISTRY}/${DOCKER_IMAGE}:${BUILD_NUMBER} sleep 1d
|
|
|
- '''
|
|
|
- }
|
|
|
-*/ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ stage("Staging") {
|
|
|
+ steps {
|
|
|
+ echo "Run ${DOCKER_IMAGE} in server mode."
|
|
|
+ sh '''container_id_server=`docker run -d --rm -e "mode=server" \
|
|
|
+ --privileged -p 1194:1194/tcp ${DOCKER_REGISTRY}/${DOCKER_IMAGE}:${BUILD_NUMBER}`
|
|
|
+ container_ip_server=`docker inspect ${container_id_server} --format='{{.NetworkSettings.IPAddress}}'`
|
|
|
+ container_id_client=`docker run -d --rm -e "mode=client" -e "server=${container_ip_server}" --privileged ${DOCKER_REGISTRY}/${DOCKER_IMAGE}:${BUILD_NUMBER}`
|
|
|
+ sleep 15
|
|
|
+ docker exec ${container_id_client} ping -c 3 -q 10.10.20.1
|
|
|
+ if [ $? != 0 ]
|
|
|
+ then
|
|
|
+ echo "Can not connect to VPN server !!!"
|
|
|
+ docker stop ${container_id_server} ${container_id_client}
|
|
|
+ exit 1
|
|
|
+ else
|
|
|
+ echo "VPN server is started"
|
|
|
+ docker stop ${container_id_server} ${container_id_client}
|
|
|
+ fi
|
|
|
+ '''
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
post {
|