Commit cf6a2908 authored by Mark Harding's avatar Mark Harding

(feat): use gitlab environments vs commit message

parent 831c5249
No related merge requests found
Pipeline #68690628 failed with stages
in 8 minutes and 50 seconds
......@@ -22,7 +22,7 @@ test:
- npm install # Should be cached...
- npm run test -- --no-watch --no-progress --browsers=ChromeHeadlessCI
build:staging:
build:review:
stage: build
script:
- npm install # TODO: Why is this needed?
......@@ -35,9 +35,6 @@ build:staging:
paths:
- dist
policy: push
only:
variables:
- $CI_COMMIT_MESSAGE =~ /-subdomain/
except:
refs:
- master
......@@ -87,41 +84,52 @@ prepare:
- docker login -u gitlab-ci-token -p ${CI_BUILD_TOKEN} ${CI_REGISTRY}
- docker build -t $CI_REGISTRY_IMAGE/front-init:$CI_BUILD_REF -f containers/front-init/Dockerfile dist/.
- docker push $CI_REGISTRY_IMAGE/front-init:$CI_BUILD_REF
environment:
name: staging
except:
refs:
- master
- test/gitlab-ci
deploy:staging:
deploy:review:
stage: deploy
image: minds/helm-eks:latest
script:
- aws eks update-kubeconfig --name=sandbox
- STAGING_SUBDOMAIN=$(echo $CI_COMMIT_MESSAGE | sed -n 's/.* -subdomain=\([^ ]*\).*/\1/p')
- echo "Subdomain will be setup at $STAGING_SUBDOMAIN"
- git clone --branch=sandbox-wip https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.com/minds/helm-charts.git
- "helm upgrade \
--install \
--reuse-values \
--set frontInit.image.repository=$CI_REGISTRY_IMAGE/front-init \
--set frontInit.image.tag=$CI_BUILD_REF \
--set domain=$STAGING_SUBDOMAIN.$STAGING_DOMAIN \
--set elasticsearch.clusterName=$STAGING_SUBDOMAIN-elasticsearch \
--set domain=$CI_BUILD_REF_SLUG.$KUBE_INGRESS_BASE_DOMAIN \
--set elasticsearch.clusterName=$CI_BUILD_REF_SLUG--elasticsearch \
--wait \
$STAGING_SUBDOMAIN \
$CI_BUILD_REF_SLUG \
./helm-charts/minds"
environment:
name: staging
only:
variables:
- $CI_COMMIT_MESSAGE =~ /-subdomain/
name: review/$CI_COMMIT_REF_NAME
url: https://$CI_BUILD_REF_SLUG.$KUBE_INGRESS_BASE_DOMAIN
on_stop: deploy:review:stop
except:
refs:
- master
- test/gitlab-ci
deploy:review:stop:
stage: deploy
image: minds/helm-eks:latest
script:
- aws eks update-kubeconfig --name=sandbox
- helm del --purge $CI_BUILD_REF_SLUG
environment:
name: review/$CI_COMMIT_REF_NAME
url: https://$CI_BUILD_REF_SLUG.$KUBE_INGRESS_BASE_DOMAIN
action: stop
except:
refs:
- master
- test/gitlab-ci
deploy:production:
stage: deploy
image: minds/ci:latest
......
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