|
@@ -1,8 +1,23 @@
|
|
|
#!/bin/bash
|
|
|
JENKINS_MAIL="jenkins@sdsys.ru"
|
|
|
-git-dir="pki"
|
|
|
+git_dir="pki"
|
|
|
branch="100883"
|
|
|
|
|
|
-cd /
|
|
|
-GIT_SSH_COMMAND='ssh -i /run/secrets/provision-ssh-key -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no' git clone ${git_url}
|
|
|
-cd ${git-dir} && git checkout ${branch}
|
|
|
+
|
|
|
+if [ -d /${git_dir} ]
|
|
|
+then
|
|
|
+ cd /${git_dir} && git checkout ${branch} && git pull
|
|
|
+else
|
|
|
+ cd / && GIT_SSH_COMMAND='ssh -i /run/secrets/provision-ssh-key -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no' git clone ${git_url}
|
|
|
+ cd /${git_dir} && git checkout ${branch}
|
|
|
+fi
|
|
|
+
|
|
|
+if [ -z $domain ]
|
|
|
+then
|
|
|
+ domain=$(echo ${domain} | sed 's/ / -d /g')
|
|
|
+ certbot certonly --dry-run --webroot -w /var/www/html --config-dir /${git_dir}/letsencrypt -d ${domain}
|
|
|
+ if [ $? -eq 0 ]
|
|
|
+ then
|
|
|
+ cd /${git_dir} && GIT_SSH_COMMAND='ssh -i /run/secrets/provision-ssh-key -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no' git push origin ${branch}
|
|
|
+ fi
|
|
|
+fi
|