2020-10-29 15:52:50 +01:00
|
|
|
image: docker:latest
|
|
|
|
services:
|
|
|
|
- docker:dind
|
|
|
|
|
|
|
|
stages:
|
|
|
|
- build
|
|
|
|
- test
|
|
|
|
- release
|
2020-10-25 10:33:56 +01:00
|
|
|
|
|
|
|
# Disable the Gradle daemon for Continuous Integration servers as correctness
|
|
|
|
# is usually a priority over speed in CI environments. Using a fresh
|
|
|
|
# runtime for each build is more reliable since the runtime is completely
|
|
|
|
# isolated from any previous builds.
|
|
|
|
variables:
|
|
|
|
GRADLE_OPTS: "-Dorg.gradle.daemon=false"
|
2020-10-29 15:52:50 +01:00
|
|
|
# Use TLS https://docs.gitlab.com/ee/ci/docker/using_docker_build.html#tls-enabled
|
|
|
|
DOCKER_HOST: tcp://docker:2376
|
|
|
|
DOCKER_TLS_CERTDIR: "/certs"
|
|
|
|
CONTAINER_LATEST_IMAGE: $CI_REGISTRY_IMAGE:latest
|
2020-10-25 10:33:56 +01:00
|
|
|
|
|
|
|
before_script:
|
|
|
|
- export GRADLE_USER_HOME=`pwd`/.gradle
|
|
|
|
|
|
|
|
build:
|
2020-10-29 15:52:50 +01:00
|
|
|
image: gradle:jdk15
|
2020-10-25 10:33:56 +01:00
|
|
|
stage: build
|
|
|
|
script: gradle --build-cache assemble
|
|
|
|
cache:
|
|
|
|
key: "$CI_COMMIT_REF_NAME"
|
|
|
|
policy: push
|
|
|
|
paths:
|
|
|
|
- build
|
|
|
|
- .gradle
|
|
|
|
|
2020-10-29 15:52:50 +01:00
|
|
|
|
2020-10-25 10:33:56 +01:00
|
|
|
test:
|
|
|
|
stage: test
|
|
|
|
script: gradle check
|
|
|
|
cache:
|
|
|
|
key: "$CI_COMMIT_REF_NAME"
|
|
|
|
policy: pull
|
|
|
|
paths:
|
2020-10-29 15:52:50 +01:00
|
|
|
- build/libs/*.jar
|
2020-10-25 10:33:56 +01:00
|
|
|
- .gradle
|
2020-10-29 15:52:50 +01:00
|
|
|
|
|
|
|
|
|
|
|
package:
|
|
|
|
stage: release
|
|
|
|
variables:
|
|
|
|
IMAGE_LATEST_TAG: $CI_REGISTRY_IMAGE:latest
|
|
|
|
IMAGE_COMMIT_REF_TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
|
|
|
|
script:
|
|
|
|
- docker login -u $CI_REGISTRY_IMAGE -p $CI_BUILD_TOKEN $CI_REGISTRY
|
|
|
|
- docker build -t $IMAGE_LATEST_TAG -t $IMAGE_COMMIT_REF_TAG .
|
|
|
|
- docker push $IMAGE_LATEST_TAG $IMAGE_COMMIT_REF_TAG
|
|
|
|
only:
|
|
|
|
- master
|