develop #22

Merged
william merged 44 commits from develop into master 2021-12-14 23:59:36 -05:00
1 changed files with 40 additions and 19 deletions
Showing only changes of commit f022e71fd7 - Show all commits

View File

@ -1,5 +1,6 @@
---
global-variables:
release: &release ${DRONE_BRANCH##/**}
environment: &environment
JAVA_VERSION: 11
GRADLE_VERSION: 7.1
@ -7,6 +8,7 @@ global-variables:
CRE_ARTIFACT_NAME: ColorRecipesExplorer
CRE_REGISTRY_IMAGE: registry.fyloz.dev:5443/colorrecipesexplorer/backend
CRE_PORT: 9101
CRE_RELEASE: *release
gradle-image: &gradle-image gradle:7.1-jdk11
alpine-image: &alpine-image alpine:latest
docker-registry-repo: &docker-registry-repo registry.fyloz.dev:5443/colorrecipesexplorer/backend
@ -16,26 +18,32 @@ name: default
type: docker
steps:
- name: set-docker-tags
image: *alpine-image
environment:
<<: *environment
commands:
- echo -n "latest,dev-$CRE_VERSION" > .tags
- cat .tags
when:
branch: develop
events: push
- name: gradle-test
image: *gradle-image
commands:
- gradle test
when:
branch: develop
events: [push, pull_request]
- name: containerize
- name: set-docker-tags-latest
image: *alpine-image
environment:
<<: *environment
commands:
- echo -n "latest" > .tags
when:
branch: develop
- name: set-docker-tags-release
image: *alpine-image
environment:
<<: *environment
commands:
- echo -n "latest-release,$CRE_RELEASE" > .tags
when:
branch: release/**
- name: containerize-dev
image: plugins/docker
environment:
<<: *environment
@ -47,8 +55,22 @@ steps:
- CRE_PORT
repo: *docker-registry-repo
when:
branch: master
events: push
branch: develop
- name: containerize-release
image: plugins/docker
environment:
<<: *environment
settings:
build_args_from_env:
- GRADLE_VERSION
- JAVA_VERSION
- CRE_PORT
build-args:
CRE_VERSION: *release
repo: *docker-registry-repo
when:
branch: release/**
- name: deploy
image: alpine:latest
@ -78,11 +100,10 @@ steps:
- ssh-keyscan -p $DEPLOY_SERVER_SSH_PORT -H $DEPLOY_SERVER >> ~/.ssh/known_hosts
- '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
- ssh -p $DEPLOY_SERVER_SSH_PORT $DEPLOY_SERVER_USERNAME@$DEPLOY_SERVER "docker stop $DEPLOY_CONTAINER_NAME || true && docker rm $DEPLOY_CONTAINER_NAME || true"
- ssh -p $DEPLOY_SERVER_SSH_PORT $DEPLOY_SERVER_USERNAME@$DEPLOY_SERVER "docker pull $CRE_REGISTRY_IMAGE:latest"
- ssh -p $DEPLOY_SERVER_SSH_PORT $DEPLOY_SERVER_USERNAME@$DEPLOY_SERVER "docker run -d -p $CRE_PORT:9090 --name=$DEPLOY_CONTAINER_NAME -v $DEPLOY_DATA_VOLUME:/usr/bin/data -v $DEPLOY_CONFIG_VOLUME:/usr/bin/config -e spring_profiles_active=$DEPLOY_SPRING_PROFILES $CRE_REGISTRY_IMAGE"
- ssh -p $DEPLOY_SERVER_SSH_PORT $DEPLOY_SERVER_USERNAME@$DEPLOY_SERVER "docker pull $CRE_REGISTRY_IMAGE:$CRE_RELEASE"
- ssh -p $DEPLOY_SERVER_SSH_PORT $DEPLOY_SERVER_USERNAME@$DEPLOY_SERVER "docker run -d -p $CRE_PORT:9090 --name=$DEPLOY_CONTAINER_NAME -v $DEPLOY_DATA_VOLUME:/usr/bin/data -v $DEPLOY_CONFIG_VOLUME:/usr/bin/config -e spring_profiles_active=$DEPLOY_SPRING_PROFILES $CRE_REGISTRY_IMAGE:$CRE_RELEASE"
when:
branch: master
events: push
branch: release/**
trigger:
branch: