Browse Source

Change Jenkinsfile

Admin User 7 years ago
parent
commit
f7c7e7fd26
2 changed files with 21 additions and 8 deletions
  1. 9 0
      Jenkinsfile
  2. 12 8
      keygen.sh

+ 9 - 0
Jenkinsfile

@@ -52,6 +52,15 @@ 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}/iru/${DOCKER_IMAGE}:${BUILD_NUMBER} /bin/bash
+             '''
+        } 
       }
     }
   }

+ 12 - 8
keygen.sh

@@ -2,12 +2,16 @@
 #git_url="ssh://git@git.sdsys.ru:8022/iru/openvpn-pki.git"
 #git_dir="openvpn-pki"
 JENKINS_MAIL="jenkins@sdsys.ru"
-GIT_SSH_COMMAND='ssh -i /tmp/keyfile -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no' git clone ${git_url}
-cd ${git_dir}/gost
-./build-key $1
+cd /
+GIT_SSH_COMMAND='ssh -i /tmp/keyfile -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no' git clone ${git_url_pki}
+GIT_SSH_COMMAND='ssh -i /tmp/keyfile -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no' git clone ${git_url_ovpn}
+
+stonevpn -f $1 -n "Development Tests" -z
+
 echo "Generate new key and cert for $1" > /tmp/commit.txt
-git add -A
-git config --global user.email "${JENKINS_MAIL}"
-git config --global user.name "Jenkins"
-git commit -F /tmp/commit.txt
-GIT_SSH_COMMAND='ssh -i /tmp/keyfile -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no' git push origin master
+
+#git add -A
+#git config --global user.email "${JENKINS_MAIL}"
+#git config --global user.name "Jenkins"
+#git commit -F /tmp/commit.txt
+#GIT_SSH_COMMAND='ssh -i /tmp/keyfile -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no' git push origin master