Commit c4edb8b5 authored by Denis Konovalyenko's avatar Denis Konovalyenko

Jobs script improved.

parent 5aa0d828
stages:
- build
- snapshot
- release
- verification
- deployment
- status
variables:
CI_GITLAB_PATH: "ci/gitlab"
MAVEN_IMAGE: "maven:3.5.4-jdk-8"
BASH_CURL_IMAGE: "cosmintitei/bash-curl:latest"
MAVEN_CLI_OPTS: "--settings ${CI_GITLAB_PATH}/.m2/settings.xml --batch-mode --update-snapshots"
MAVEN_CLI_OPTS: "--settings ${CI_GITLAB_PATH}/.m2/settings.xml --batch-mode --errors --show-version"
# OPENSSL_CLI_OPTS: "enc aes-256-cbc -K ${OPENSSL_ENC_KEY} -iv ${OPENSSL_ENC_IV}"
GPG_CONF: ".gnupg/gpg.conf"
GPG_AGENT_CONF: ".gnupg/gpg-agent.conf"
# CI_DEBUG_TRACE: "true" # WARNING: all secret variables will be exposed to a job output!
build:
stage: build
verification:
stage: verification
image: ${MAVEN_IMAGE}
cache:
paths:
- ${HOME}/.m2/repository/
- ${HOME}/target/
script:
- mvn test ${MAVEN_CLI_OPTS}
- mvn verify ${MAVEN_CLI_OPTS}
snaphot:
stage: snapshot
.deployment: &deployment
stage: deployment
image: ${MAVEN_IMAGE}
cache:
paths:
- ${HOME}/.m2/repository/
- ${HOME}/target/
policy: pull
script:
# - openssl ${OPENSSL_CLI_OPTS} -d -in ${CI_GITLAB_PATH}/code-signing-key.asc.enc -out ${CI_GITLAB_PATH}/code-signing-key.asc
# - gpg --fast-import ${CI_GITLAB_PATH}/code-signing-key.asc
......@@ -39,6 +39,9 @@ snaphot:
- echo "pinentry-mode loopback" >> ${HOME}/${GPG_CONF}
- echo "allow-loopback-pinentry" > ${HOME}/${GPG_AGENT_CONF}
- mvn deploy ${MAVEN_CLI_OPTS} -DskipITs -Dmaven.test.skip=true --activate-profiles release #--quiet
snapshot:
<<: *deployment
# only:
# - dev
except:
......@@ -46,41 +49,28 @@ snaphot:
- master
release:
stage: release
image: ${MAVEN_IMAGE}
cache:
paths:
- ${HOME}/.m2/repository/
- ${HOME}/target/
script:
- echo "${GPG_KEY}" | gpg --batch --armor --import
- echo "use-agent" > ${HOME}/${GPG_CONF}
- echo "pinentry-mode loopback" >> ${HOME}/${GPG_CONF}
- echo "allow-loopback-pinentry" > ${HOME}/${GPG_AGENT_CONF}
- mvn deploy ${MAVEN_CLI_OPTS} -DskipITs -Dmaven.test.skip=true --activate-profiles release --quiet
<<: *deployment
only:
- tags
except:
- branches
success:
.status: &status
stage: status
image: ${BASH_CURL_IMAGE}
before_script:
- ""
after_script:
- ""
success:
<<: *status
script:
- BUILD_STATUS=passed BUILD_KEY=push ${CI_GITLAB_PATH}/build-status
when: on_success
failure:
stage: status
image: ${BASH_CURL_IMAGE}
before_script:
- ""
after_script:
- ""
<<: *status
script:
- BUILD_STATUS=failed BUILD_KEY=push ${CI_GITLAB_PATH}/build-status
when: on_failure
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment