Modified gitlab-ci again and added a stage

Signed-off-by: Louis Vallat <louis@louis-vallat.xyz>
This commit is contained in:
Louis Vallat 2020-10-29 21:05:16 +01:00
parent 257d409860
commit f833bb7d5b

View File

@ -5,6 +5,7 @@ services:
stages: stages:
- build - build
- test - test
- package
- release - release
# Disable the Gradle daemon for Continuous Integration servers as correctness # Disable the Gradle daemon for Continuous Integration servers as correctness
@ -25,7 +26,7 @@ before_script:
build: build:
image: gradle:jdk15 image: gradle:jdk15
stage: build stage: build
script: gradle --build-cache assemble script: gradle --build-cache buildJava
cache: cache:
key: "$CI_COMMIT_REF_NAME" key: "$CI_COMMIT_REF_NAME"
policy: push policy: push
@ -37,26 +38,40 @@ build:
test: test:
image: gradle:jdk15 image: gradle:jdk15
stage: test stage: test
script: gradle check script: gradle --build-cache check
cache: cache:
key: "$CI_COMMIT_REF_NAME" key: "$CI_COMMIT_REF_NAME"
policy: pull policy: pull
paths: paths:
- build/libs/*.jar - build
- .gradle - .gradle
release-image-test: package:
image: gradle:jdk15
stage: package
script: gradle --build-cache assemble
cache:
key: "$CI_COMMIT_REF_NAME"
policy: push
paths:
- build
- .gradle
artifacts:
paths:
- build/libs/*.jar
release:
stage: release stage: release
script: script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker build . -t $CONTAINER_BRANCH_IMAGE - docker build . -t $CONTAINER_BRANCH_IMAGE
- docker push $CONTAINER_BRANCH_IMAGE - docker push $CONTAINER_BRANCH_IMAGE
release-image: release-master:
stage: release stage: release
script: script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker build . -t $CONTAINER_BRANCH_IMAGE -t $CONTAINER_RELEASE_IMAGE - docker build . -t $CONTAINER_RELEASE_IMAGE
- docker push $CONTAINER_RELEASE_IMAGE $CONTAINER_BRANCH_IMAGE - docker push $CONTAINER_RELEASE_IMAGE
only: only:
- master - master