Skip to content
Next
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
Minds Frontend
Project
Project
Details
Activity
Releases
Cycle Analytics
Insights
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Locked Files
Issues
876
Issues
876
List
Boards
Labels
Service Desk
Milestones
Merge Requests
52
Merge Requests
52
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
List
Container Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Minds
Minds Frontend
Commits
3be59af0
Commit
3be59af0
authored
2 hours ago
by
Mark Harding
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(chore): use yaml templates and introduce cleanup job for review sites
parent
d4461b15
chore/improve-review-ci
No related merge requests found
Pipeline
#78070308
running with stages
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
62 additions
and
90 deletions
+62
-90
.gitlab-ci.yml
.gitlab-ci.yml
+62
-90
No files found.
.gitlab-ci.yml
View file @
3be59af0
...
...
@@ -12,6 +12,7 @@ stages:
-
test:e2e
-
deploy:canary
-
deploy:production
-
cleanup
variables
:
CYPRESS_INSTALL_BINARY
:
0
# Speeds up the install process
...
...
@@ -25,33 +26,6 @@ test:
-
npm ci
-
npm run test -- --no-watch --no-progress --browsers=ChromeHeadlessCI
e2e:base:
image
:
cypress/base:10
stage
:
test:e2e
variables
:
CYPRESS_INSTALL_BINARY
:
3.4.1
script
:
-
npm ci
-
>
if [ "$CI_BUILD_REF_NAME" == "master" ]; then
export E2E_DOMAIN=https://www.minds.com
else
export E2E_DOMAIN=https://$CI_BUILD_REF_SLUG.$KUBE_INGRESS_BASE_DOMAIN
fi
-
export CYPRESS_baseUrl=$E2E_DOMAIN
-
echo "E2E tests for $CI_BUILD_REF_NAME running against $E2E_DOMAIN with user $CYPRESS_username"
-
$(npm bin)/cypress run --record --key $CYPRESS_RECORD_ID --config CYPRESS_baseUrl=$E2E_DOMAIN
artifacts
:
when
:
always
paths
:
-
cypress/screenshots
-
cypress/videos
cache
:
paths
:
-
.npm
-
cache/Cypress
allow_failure
:
true
#manual inspection in case of timeouts
e2e:chrome:
image
:
cypress/browsers:chrome67
stage
:
test:e2e
...
...
@@ -79,6 +53,10 @@ e2e:chrome:
-
cache/Cypress
allow_failure
:
true
#manual inspection in case of timeouts
###############
# Build Stage #
###############
build:review:
stage
:
build
before_script
:
...
...
@@ -133,6 +111,10 @@ build:production:i18n:
-
master
-
test/gitlab-ci
#################
# Prepare Stage #
#################
.sentry_prepare
:
&sentry_prepare
stage
:
prepare
image
:
getsentry/sentry-cli
...
...
@@ -159,7 +141,7 @@ prepare:review:
-
test/gitlab-ci
prepare:review:sentry:
<<
:
*sentry_prepare
<<
:
*sentry_prepare
variables
:
SOURCEMAP_PREFIX
:
"
~/en"
except
:
...
...
@@ -196,6 +178,26 @@ prepare:production:sentry:
-
build:production:en
-
build:production:i18n
################
# Review Stage #
################
.cleanup_review
:
&cleanup_review
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
variables
:
GIT_STRATEGY
:
none
except
:
refs
:
-
master
-
test/gitlab-ci
review:start:
stage
:
review
image
:
minds/helm-eks:latest
...
...
@@ -224,28 +226,17 @@ review:start:
-
test/gitlab-ci
review:stop:
<<
:
*cleanup_review
stage
:
review
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
variables
:
GIT_STRATEGY
:
none
when
:
manual
except
:
refs
:
-
master
-
test/gitlab-ci
staging:fpm:
stage
:
deploy:staging
################
# Deploy Stage #
################
.deploy
:
&deploy
image
:
minds/ci:latest
script
:
-
IMAGE_LABEL="staging"
## Sync assets with CDN
-
aws s3 sync dist $S3_REPOSITORY_URL
-
$(aws ecr get-login --no-include-email --region us-east-1)
...
...
@@ -258,41 +249,28 @@ staging:fpm:
-
aws ecs update-service --service=$ECS_APP_STAGING_SERVICE --force-new-deployment --region us-east-1 --cluster=$ECS_CLUSTER
## Update sentry
-
sentry-cli releases deploys $CI_COMMIT_SHA new -e $IMAGE_LABEL
dependencies
:
-
build:production:en
-
build:production:i18n
only
:
refs
:
-
master
-
test/gitlab-ci
dependencies
:
-
build:production:en
-
build:production:i18n
staging:fpm:
<<
:
*deploy
stage
:
deploy:staging
variables
:
IMAGE_LABEL
:
"
staging"
environment
:
name
:
staging
url
:
https://www.minds.com
# requires staging cookie
deploy:canary:
<<
:
*deploy
stage
:
deploy:canary
image
:
minds/ci:latest
script
:
-
IMAGE_LABEL="canary"
## Sync assets with CDN
-
aws s3 sync dist $S3_REPOSITORY_URL
-
$(aws ecr get-login --no-include-email --region us-east-1)
## Update docker front-init container
-
docker login -u gitlab-ci-token -p ${CI_BUILD_TOKEN} ${CI_REGISTRY}
-
docker pull $CI_REGISTRY_IMAGE/front-init:$CI_BUILD_REF
-
docker tag $CI_REGISTRY_IMAGE/front-init:$CI_BUILD_REF $ECR_REPOSITORY_URL:$IMAGE_LABEL
-
docker push $ECR_REPOSITORY_URL:$IMAGE_LABEL
## Deploy the new container in rolling restart
-
aws ecs update-service --service=$ECS_APP_CANARY_SERVICE --force-new-deployment --region us-east-1 --cluster=$ECS_CLUSTER
## Update sentry
-
sentry-cli releases deploys $CI_COMMIT_SHA new -e $IMAGE_LABEL
only
:
refs
:
-
master
-
test/gitlab-ci
dependencies
:
-
build:production:en
-
build:production:i18n
variables
:
IMAGE_LABEL
:
"
canary"
environment
:
name
:
canary
url
:
https://www.minds.com/?canary=1
# requires canary cookie
...
...
@@ -300,30 +278,24 @@ deploy:canary:
allow_failure
:
false
# prevents auto deploy to full production
deploy:production:
<<
:
*deploy
stage
:
deploy:production
image
:
minds/ci:latest
script
:
-
IMAGE_LABEL="production"
-
$(aws ecr get-login --no-include-email --region us-east-1)
## Update docker front-init container
-
docker login -u gitlab-ci-token -p ${CI_BUILD_TOKEN} ${CI_REGISTRY}
-
docker pull $CI_REGISTRY_IMAGE/front-init:$CI_BUILD_REF
-
docker tag $CI_REGISTRY_IMAGE/front-init:$CI_BUILD_REF $ECR_REPOSITORY_URL:$IMAGE_LABEL
-
docker push $ECR_REPOSITORY_URL:$IMAGE_LABEL
## Deploy the new container in rolling restart
-
aws ecs update-service --service=$ECS_APP_PRODUCTION_SERVICE --force-new-deployment --region us-east-1 --cluster=$ECS_CLUSTER
## Update sentry
-
sentry-cli releases deploys $CI_COMMIT_SHA new -e $IMAGE_LABEL
only
:
refs
:
-
master
-
test/gitlab-ci
dependencies
:
-
build:production:en
-
build:production:i18n
variables
:
IMAGE_LABEL
:
"
production"
environment
:
name
:
production
url
:
https://www.minds.com
when
:
delayed
start_in
:
2 hours
# reduce? can always be deployed manually earlier too
#################
# Cleanup stage #
#################
cleanup:review:
# We stop the review site after the e2e tests have run
<<
:
*cleanup_review
stage
:
cleanup
except
:
refs
:
-
master
-
test/gitlab-ci
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment