Commit 6624218d authored by James Lopez's avatar James Lopez

Merge branch 'zj-update-templates' into 'master'

Update templates with new CI variables

See merge request !9852
parents 9ed3db91 548b6074
...@@ -7,7 +7,7 @@ services: ...@@ -7,7 +7,7 @@ services:
build: build:
stage: build stage: build
script: script:
- export IMAGE_TAG=$(echo -en $CI_BUILD_REF_NAME | tr -c '[:alnum:]_.-' '-') - export IMAGE_TAG=$(echo -en $CI_COMMIT_REF_NAME | tr -c '[:alnum:]_.-' '-')
- docker login -u "gitlab-ci-token" -p "$CI_BUILD_TOKEN" $CI_REGISTRY - docker login -u "gitlab-ci-token" -p "$CI_JOB_TOKEN" $CI_REGISTRY
- docker build --pull -t "$CI_REGISTRY_IMAGE:$IMAGE_TAG" . - docker build --pull -t "$CI_REGISTRY_IMAGE:$IMAGE_TAG" .
- docker push "$CI_REGISTRY_IMAGE:$IMAGE_TAG" - docker push "$CI_REGISTRY_IMAGE:$IMAGE_TAG"
...@@ -3,9 +3,9 @@ ...@@ -3,9 +3,9 @@
# For docker image tags see https://hub.docker.com/_/maven/ # For docker image tags see https://hub.docker.com/_/maven/
# #
# For general lifecycle information see https://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html # For general lifecycle information see https://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html
# #
# This template will build and test your projects as well as create the documentation. # This template will build and test your projects as well as create the documentation.
# #
# * Caches downloaded dependencies and plugins between invocation. # * Caches downloaded dependencies and plugins between invocation.
# * Does only verify merge requests but deploy built artifacts of the # * Does only verify merge requests but deploy built artifacts of the
# master branch. # master branch.
...@@ -24,12 +24,12 @@ variables: ...@@ -24,12 +24,12 @@ variables:
MAVEN_CLI_OPTS: "--batch-mode --errors --fail-at-end --show-version -DinstallAtEnd=true -DdeployAtEnd=true" MAVEN_CLI_OPTS: "--batch-mode --errors --fail-at-end --show-version -DinstallAtEnd=true -DdeployAtEnd=true"
# Cache downloaded dependencies and plugins between builds. # Cache downloaded dependencies and plugins between builds.
# To keep cache across branches add 'key: "$CI_BUILD_REF_NAME"' # To keep cache across branches add 'key: "$CI_JOB_REF_NAME"'
cache: cache:
paths: paths:
- .m2/repository - .m2/repository
# This will only validate and compile stuff and run e.g. maven-enforcer-plugin. # This will only validate and compile stuff and run e.g. maven-enforcer-plugin.
# Because some enforcer rules might check dependency convergence and class duplications # Because some enforcer rules might check dependency convergence and class duplications
# we use `test-compile` here instead of `validate`, so the correct classpath is picked up. # we use `test-compile` here instead of `validate`, so the correct classpath is picked up.
.validate: &validate .validate: &validate
......
...@@ -38,11 +38,11 @@ review: ...@@ -38,11 +38,11 @@ review:
<<: *deploy <<: *deploy
stage: review stage: review
variables: variables:
APP: $CI_BUILD_REF_NAME APP: $CI_COMMIT_REF_NAME
APP_HOST: $CI_PROJECT_NAME-$CI_BUILD_REF_NAME.$OPENSHIFT_DOMAIN APP_HOST: $CI_PROJECT_NAME-$CI_ENVIRONMENT_SLUG.$OPENSHIFT_DOMAIN
environment: environment:
name: review/$CI_BUILD_REF_NAME name: review/$CI_COMMIT_REF_SLUG
url: http://$CI_PROJECT_NAME-$CI_BUILD_REF_NAME.$OPENSHIFT_DOMAIN url: http://$CI_PROJECT_NAME-$CI_ENVIRONMENT_SLUG.$OPENSHIFT_DOMAIN
on_stop: stop-review on_stop: stop-review
only: only:
- branches - branches
...@@ -56,10 +56,10 @@ stop-review: ...@@ -56,10 +56,10 @@ stop-review:
- oc delete all -l "app=$APP" - oc delete all -l "app=$APP"
when: manual when: manual
variables: variables:
APP: $CI_BUILD_REF_NAME APP: $CI_COMMIT_REF_NAME
GIT_STRATEGY: none GIT_STRATEGY: none
environment: environment:
name: review/$CI_BUILD_REF_NAME name: review/$CI_COMMIT_REF_SLUG
action: stop action: stop
only: only:
- branches - branches
......
...@@ -24,12 +24,12 @@ build: ...@@ -24,12 +24,12 @@ build:
production: production:
stage: production stage: production
variables: variables:
CI_ENVIRONMENT_URL: http://production.$KUBE_DOMAIN CI_ENVIRONMENT_URL: http://$CI_PROJECT_NAME.$KUBE_DOMAIN
script: script:
- command deploy - command deploy
environment: environment:
name: production name: production
url: http://production.$KUBE_DOMAIN url: http://$CI_PROJECT_NAME.$KUBE_DOMAIN
when: manual when: manual
only: only:
- master - master
...@@ -37,24 +37,24 @@ production: ...@@ -37,24 +37,24 @@ production:
staging: staging:
stage: staging stage: staging
variables: variables:
CI_ENVIRONMENT_URL: http://staging.$KUBE_DOMAIN CI_ENVIRONMENT_URL: http://$CI_PROJECT_NAME-staging.$KUBE_DOMAIN
script: script:
- command deploy - command deploy
environment: environment:
name: staging name: staging
url: http://staging.$KUBE_DOMAIN url: http://$CI_PROJECT_NAME-staging.$KUBE_DOMAIN
only: only:
- master - master
review: review:
stage: review stage: review
variables: variables:
CI_ENVIRONMENT_URL: http://$CI_ENVIRONMENT_SLUG.$KUBE_DOMAIN CI_ENVIRONMENT_URL: http://$CI_PROJECT_NAME-$CI_ENVIRONMENT_SLUG.$KUBE_DOMAIN
script: script:
- command deploy - command deploy
environment: environment:
name: review/$CI_BUILD_REF_NAME name: review/$CI_COMMIT_REF_NAME
url: http://$CI_ENVIRONMENT_SLUG.$KUBE_DOMAIN url: http://$CI_PROJECT_NAME-$CI_ENVIRONMENT_SLUG.$KUBE_DOMAIN
on_stop: stop_review on_stop: stop_review
only: only:
- branches - branches
...@@ -68,7 +68,7 @@ stop_review: ...@@ -68,7 +68,7 @@ stop_review:
script: script:
- command destroy - command destroy
environment: environment:
name: review/$CI_BUILD_REF_NAME name: review/$CI_COMMIT_REF_NAME
action: stop action: stop
when: manual when: manual
only: only:
......
# Explaination on the scripts: # Explanation on the scripts:
# https://gitlab.com/gitlab-examples/openshift-deploy/blob/master/README.md # https://gitlab.com/gitlab-examples/openshift-deploy/blob/master/README.md
image: registry.gitlab.com/gitlab-examples/openshift-deploy image: registry.gitlab.com/gitlab-examples/openshift-deploy
...@@ -24,12 +24,12 @@ build: ...@@ -24,12 +24,12 @@ build:
production: production:
stage: production stage: production
variables: variables:
CI_ENVIRONMENT_URL: http://production.$KUBE_DOMAIN CI_ENVIRONMENT_URL: http://$CI_PROJECT_NAME.$KUBE_DOMAIN
script: script:
- command deploy - command deploy
environment: environment:
name: production name: production
url: http://production.$KUBE_DOMAIN url: http://$CI_PROJECT_NAME.$KUBE_DOMAIN
when: manual when: manual
only: only:
- master - master
...@@ -37,24 +37,24 @@ production: ...@@ -37,24 +37,24 @@ production:
staging: staging:
stage: staging stage: staging
variables: variables:
CI_ENVIRONMENT_URL: http://staging.$KUBE_DOMAIN CI_ENVIRONMENT_URL: http://$CI_PROJECT_NAME-staging.$KUBE_DOMAIN
script: script:
- command deploy - command deploy
environment: environment:
name: staging name: staging
url: http://staging.$KUBE_DOMAIN url: http://$CI_PROJECT_NAME-staging.$KUBE_DOMAIN
only: only:
- master - master
review: review:
stage: review stage: review
variables: variables:
CI_ENVIRONMENT_URL: http://$CI_ENVIRONMENT_SLUG.$KUBE_DOMAIN CI_ENVIRONMENT_URL: http://$CI_PROJECT_NAME-$CI_ENVIRONMENT_SLUG.$KUBE_DOMAIN
script: script:
- command deploy - command deploy
environment: environment:
name: review/$CI_BUILD_REF_NAME name: review/$CI_COMMIT_REF_NAME
url: http://$CI_ENVIRONMENT_SLUG.$KUBE_DOMAIN url: http://$CI_PROJECT_NAME-$CI_ENVIRONMENT_SLUG.$KUBE_DOMAIN
on_stop: stop_review on_stop: stop_review
only: only:
- branches - branches
...@@ -68,7 +68,7 @@ stop_review: ...@@ -68,7 +68,7 @@ stop_review:
script: script:
- command destroy - command destroy
environment: environment:
name: review/$CI_BUILD_REF_NAME name: review/$CI_COMMIT_REF_NAME
action: stop action: stop
when: manual when: manual
only: only:
......
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