diff --git a/.gitlab-ci-psnc.yml b/.gitlab-ci-psnc.yml index 3882299e2159bee25e931e606c1340c6cc478b23..e2229f72f233b474c49841c5c956c00fecb6696b 100644 --- a/.gitlab-ci-psnc.yml +++ b/.gitlab-ci-psnc.yml @@ -25,7 +25,6 @@ upload_linux_shell: stage: upload_linux_shell only: - tags - - branches image: curlimages/curl:7.76.1 script: - 'curl -sSf -H "X-JFrog-Art-Api:${ARTIFACTORY_TOKEN}" -X PUT -T ./acme-downloader.sh ${ARTIFACTORY_BASE_URL}/${ARTIFACT_NAME}.sh' @@ -36,7 +35,6 @@ upload_linux_amd64_binary: stage: upload_linux_amd64_binary only: - tags - - branches script: - ./build.sh --os=linux --arch=amd64 --version=$CI_COMMIT_TAG --upx - 'curl -sSf -H "X-JFrog-Art-Api:${ARTIFACTORY_TOKEN}" -X PUT -T ./acme-downloader ${ARTIFACTORY_BASE_URL}/${ARTIFACT_NAME}_linux_amd64' @@ -47,7 +45,6 @@ upload_windows_amd64_binary: stage: upload_windows_amd64_binary only: - tags - - branches script: - ./build.sh --os=windows --arch=amd64 --version=$CI_COMMIT_TAG --upx - 'curl -sSf -H "X-JFrog-Art-Api:${ARTIFACTORY_TOKEN}" -X PUT -T ./acme-downloader.exe ${ARTIFACTORY_BASE_URL}/${ARTIFACT_NAME}_windows_amd64.exe' diff --git a/acme-downloader.sh b/acme-downloader.sh index 9f692b7858b7b825e525d9131faa21ee1d02fb5f..a24517b2e1ff52880350de59c0d1cf59e66fcf7f 100755 --- a/acme-downloader.sh +++ b/acme-downloader.sh @@ -66,7 +66,7 @@ usage() { echo " --redis-token (Redis access token)" echo " --vault-token (Vault access token)" echo " --cert-name (Certificate name)" - echo " --team-name (Team name: swd, dream_team, it, ne, ti...)" + echo " --team-name (Team name: swd, dream_team, it, ne, ti, nmaas...)" echo " --days [OPTIONAL check days before expiration. Default: 30)" echo " --type [OPTIONAL. OV or EV. Default: EV]" echo " --cert-destination [OPTIONAL Default: ${CERT_BASE}/<cert-name>.crt]" @@ -74,6 +74,7 @@ usage() { echo " --key-destination [OPTIONAL Default: ${KEY_BASE}/<cert-name>.key]" echo " --ca-destination [OPTIONAL Default: ${CERT_BASE}/COMODO_<type>.crt]" echo " --wildcard [OPTIONAL if the certificate is wildcard]" + echo " --update [OPTIONAL self-updates the script and exit]" echo "" clean_up } @@ -130,6 +131,9 @@ while true; do --wildcard) WILDCARD='WILDCARD' ;; + --update) + UPDATE='UPDATE' + ;; --) shift break @@ -140,6 +144,18 @@ done TYPE=$(echo $TYPE | tr '[:lower:]' '[:upper:]') +if [ -n $UPDATE ]; then + curl $SCRIPT_URL -o $0 + UPDATE_STATUS=$? + if [ $UPDATE_STATUS == 0 ]; then + echo -e "\n$0 updated successfully\n" + else + echo -e "\nfailed to update $0" + echo -e "Please download the script manually from this URL: ${SCRIPT_URL}\n" + fi + exit $UPDATE_STATUS +fi + if [[ -z $REDIS_TOKEN ]] || [[ -z $VAULT_TOKEN ]] || [[ -z $CERT_NAME ]] || [[ -z $TEAM_NAME ]]; then echo -e "\n--redis-token, --vault-token, --cert-name and --team-name are mandatory\n" usage