This commit is contained in:
FyloZ 2021-02-12 22:26:32 -05:00
parent d5c513fe41
commit 61c2f63878
1 changed files with 11 additions and 8 deletions

View File

@ -1,6 +1,6 @@
variables:
CI_REGISTRY_IMAGE_GRADLE: "$CI_REGISTRY_IMAGE:latest-gradle"
CI_REGISTRY_IMAGE_BACKEND: "$CI_REGISTRY_IMAGE:latest"
CI_REGISTRY_IMAGE_GRADLE: "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME-gradle"
CI_REGISTRY_IMAGE_BACKEND: "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME"
before_script:
- docker info
@ -14,9 +14,6 @@ stages:
build:
stage: build
only:
refs:
- master
script:
- docker pull $CI_REGISTRY_IMAGE_GRADLE || true
- docker build --cache-from $CI_REGISTRY_IMAGE_GRADLE -f gradle.Dockerfile -t $CI_REGISTRY_IMAGE_GRADLE --build-arg JDK_VERSION=$JDK_VERSION --build-arg GRADLE_VERSION=$GRADLE_VERSION .
@ -26,15 +23,18 @@ test:
stage: test
needs: [ 'build' ]
variables:
TEST_CONTAINER_NAME: "cre_backend_gradle_tests"
TEST_CONTAINER_NAME: "cre_backend_gradle_tests-$CI_COMMIT_REF_NAME"
script:
- docker run --name $TEST_CONTAINER_NAME --rm $CI_REGISTRY_IMAGE_GRADLE gradle test
package:
stage: package
needs: [ 'test' ]
only:
refs:
- master
variables:
PACKAGE_CONTAINER_NAME: "cre_backend_package"
PACKAGE_CONTAINER_NAME: "cre_backend_package-$CI_COMMIT_REF_NAME"
ARTIFACT_NAME: "ColorRecipesExplorer-backend-$CI_PIPELINE_IID"
script:
- docker run --name $PACKAGE_CONTAINER_NAME $CI_REGISTRY_IMAGE_GRADLE gradle bootJar
@ -54,8 +54,11 @@ deploy:
stage: deploy
image: alpine:latest
needs: [ 'package' ]
only:
refs:
- master
variables:
DEPLOYED_CONTAINER_NAME: "cre_backend"
DEPLOYED_CONTAINER_NAME: "cre_backend-$CI_COMMIT_REF_NAME"
before_script:
- apk update
- apk add --no-cache openssh-client