Commit 548b6074 authored by Z.J. van de Weg's avatar Z.J. van de Weg

Update templates with new CI variables

parent 81ad6111
...@@ -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"
...@@ -24,7 +24,7 @@ variables: ...@@ -24,7 +24,7 @@ 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
......
...@@ -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