Commit 8f437af6 authored by Matija Obreza's avatar Matija Obreza
Browse files

CI job templates

parent ba448173
variables:
GENESYS_VERSION: "2.0"
DOCKER_HOST: "genesys1.swarm.genesys-pgr.org"
GENESYS_VERSION: "2.0"
DOCKER_HOST: "genesys1.swarm.genesys-pgr.org"
stages:
- compile
......@@ -9,52 +9,41 @@ stages:
- deploy
compile and test:
stage: compile
image: dockerhub.genesys-pgr.org/maven-with-compass:3-jdk-8
stage: compile
image: dockerhub.genesys-pgr.org/maven-with-compass:3-jdk-8
script:
- MAVEN_OPTS="${MAVEN_OPTS} -Dorg.slf4j.simpleLogger.defaultLogLevel=warn" mvn compile test -B -DskipTests=true
package genesys:
stage: package
image: dockerhub.genesys-pgr.org/maven-with-compass:3-jdk-8
dependencies:
- compile and test
only:
- master
- staging
- tags
except:
- branches
.package_template: &maven_package
image: dockerhub.genesys-pgr.org/maven-with-compass:3-jdk-8
script:
- MAVEN_OPTS="${MAVEN_OPTS} -Dorg.slf4j.simpleLogger.defaultLogLevel=warn" mvn package -B -DskipTests=true
artifacts:
name: "${CI_PROJECT_NAME}-${CI_COMMIT_REF_NAME}"
expire_in: 1 day
name: "${CI_PROJECT_NAME}-${CI_COMMIT_REF_NAME}"
expire_in: 1 day
paths:
- target/*.war
package genesys:
<<: *maven_package
stage: package
only:
- master
- staging
- tags
package genesys branch:
stage: package
image: dockerhub.genesys-pgr.org/maven-with-compass:3-jdk-8
when: manual
dependencies:
- compile and test
script:
- MAVEN_OPTS="${MAVEN_OPTS} -Dorg.slf4j.simpleLogger.defaultLogLevel=warn" mvn package -B -DskipTests=true
artifacts:
name: "${CI_PROJECT_NAME}-${CI_COMMIT_REF_NAME}"
expire_in: 1 day
paths:
- target/*.war
<<: *maven_package
stage: package
when: manual
except:
- master
- staging
- tags
docker image:
stage: dockerize
image: docker:latest
when: manual
dependencies:
- compile and test
- package genesys branch
.docker_image_template: &docker_image
image: docker:latest
before_script:
- echo Building docker image ${CI_REGISTRY_IMAGE} on ${DOCKER_HOST}
- echo Registry ${CI_REGISTRY} user=${CI_REGISTRY_USER} ${CI_REGISTRY_PASSWORD}
......@@ -83,16 +72,36 @@ docker image:
- ${DOCKER_CMD} push ${CI_REGISTRY_IMAGE}:${IMAGE_TAG}
- ${DOCKER_CMD} logout $CI_REGISTRY
deploy for review:
stage: deploy
image: docker:latest
when: manual
dockerize genesys:
<<: *docker_image
stage: dockerize
dependencies:
- package genesys
only:
- master
- staging
- tags
dockerize genesys branch:
<<: *docker_image
stage: dockerize
dependencies:
- docker image
- package genesys branch
when: manual
except:
- master
- staging
- tags
deploy for review:
stage: deploy
image: docker:latest
when: manual
environment:
name: review/$CI_COMMIT_REF_SLUG
url: https://${CI_COMMIT_REF_SLUG}.review.genesys-pgr.org
on_stop: remove review instance
name: review/$CI_COMMIT_REF_SLUG
url: https://${CI_COMMIT_REF_SLUG}.review.genesys-pgr.org
on_stop: remove review instance
script:
# Address the swarm
- export DOCKER_HOST=swarm.genesys-pgr.org
......@@ -117,14 +126,14 @@ deploy for review:
- ${DOCKER_CMD} stack deploy -c review-composed.yml genesys-${CI_COMMIT_REF_SLUG}-review
remove review instance:
stage: deploy
image: docker:latest
when: manual
stage: deploy
image: docker:latest
when: manual
variables:
GIT_STRATEGY: none
GIT_STRATEGY: none
environment:
name: review/$CI_COMMIT_REF_SLUG
action: stop
name: review/$CI_COMMIT_REF_SLUG
action: stop
script:
- echo Removing review https\://${CI_COMMIT_REF_SLUG}.review.genesys\-pgr.org
# Address the swarm
......@@ -141,10 +150,10 @@ remove review instance:
- ${DOCKER_CMD} stack rm genesys-${CI_COMMIT_REF_SLUG}-review
deploy on staging server:
stage: deploy
image: docker:latest
stage: deploy
image: docker:latest
variables:
GIT_STRATEGY: none
GIT_STRATEGY: none
script:
- echo Deploying to staging server
# Address the swarm
......@@ -162,19 +171,19 @@ deploy on staging server:
only:
- staging
environment:
name: sandbox
url: https://sandbox.genesys-pgr.org
name: sandbox
url: https://sandbox.genesys-pgr.org
deploy to production:
stage: deploy
image: docker:latest
when: manual
stage: deploy
image: docker:latest
when: manual
variables:
GIT_STRATEGY: none
GIT_STRATEGY: none
script:
- echo "Deploy to production server"
only:
- master
environment:
name: production
url: https://www.genesys-pgr.org
name: production
url: https://www.genesys-pgr.org
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