Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
DevOps
Project Templates
Commits
7012163f
Commit
7012163f
authored
Oct 17, 2021
by
Georgi Petkov
Browse files
chore: adjusting images to latest instead of upgrade tag
parent
cf05d561
Pipeline
#32656
passed with stages
in 24 seconds
Changes
15
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
gitlab-ci/build-ignore-engines.yml
View file @
7012163f
build
:
image
:
registry.brickblock.sh/devops/docker/build:
node16
image
:
registry.brickblock.sh/devops/docker/build:
latest
stage
:
test
extends
:
-
.except-ci-release
...
...
gitlab-ci/build-with-node-12.yml
deleted
100644 → 0
View file @
cf05d561
build
:
image
:
registry.brickblock.sh/devops/docker/build:node-12
stage
:
test
extends
:
-
.except-ci-release
-
.cache-pull-only
-
.skip-artifacts
interruptible
:
true
artifacts
:
paths
:
-
node_modules
-
build
script
:
-
yarn build
-
yarn install --production --frozen-lockfile --ignore-scripts --network-timeout
300000
--ignore-engines
gitlab-ci/build.yml
View file @
7012163f
build
:
image
:
registry.brickblock.sh/devops/docker/build:
node16
image
:
registry.brickblock.sh/devops/docker/build:
latest
stage
:
test
extends
:
-
.except-ci-release
...
...
gitlab-ci/production.yml
View file @
7012163f
...
...
@@ -23,7 +23,7 @@ tag:
production
:
stage
:
deploy
image
:
registry.brickblock.sh/devops/deploy:
node16
image
:
registry.brickblock.sh/devops/deploy:
latest
variables
:
NODE_ENV
:
production
GOOGLE_PROJECT
:
bbk-production
...
...
@@ -32,7 +32,7 @@ production:
|
{
host:
.host,
path:
(.path
//
"/")
}]
else
[
{
host:
"${PRODUCTION_SUBDOMAIN}.${PRODUCTION_DOMAIN}",
path:
"/"
}
]
end
|
{
"ingresses":
.
}'
JQ_FIRST_INGRESS
:
'
.ingresses[0]
|
(.host
+
.path)
'
JQ_FIRST_INGRESS
:
"
.ingresses[0]
|
(.host
+
.path)
"
extends
:
.use-gcloud
retry
:
1
environment
:
...
...
gitlab-ci/register-graphql-
documen
t-service.yml
→
gitlab-ci/register-graphql-
shor
t-service
-names
.yml
View file @
7012163f
File moved
gitlab-ci/review.yml
deleted
100644 → 0
View file @
cf05d561
review
:
stage
:
review
image
:
registry.brickblock.sh/devops/deploy:node16
variables
:
NODE_ENV
:
review
GOOGLE_PROJECT
:
bbk-review
ISSUER_SUBDOMAIN
:
demo
JQ_TRANSFORMATION
:
'
if
.deployAt.${NODE_ENV}
|
type=="array"
then
.deployAt.${NODE_ENV}
|
[.[]
|
{
host:
.host,
path:
(.path
//
"/")
}]
else
[
{
host:
"${CI_ENVIRONMENT_SLUG}.${ISSUER_SUBDOMAIN}.${REVIEW_DOMAIN}",
path:
"/"
}
]
end
|
{
"ingresses":
.
}'
JQ_FIRST_INGRESS
:
"
.ingresses[0]
|
(.host
+
.path)"
DEPLOYMENT_NAME
:
${CI_ENVIRONMENT_SLUG}
extends
:
-
.except-ci-release
-
.use-gcloud
-
.skip-artifacts
# Overwrites .except-ci-release.refs
except
:
refs
:
-
tags
-
master
interruptible
:
true
retry
:
1
script
:
-
node -v
-
jq "${JQ_TRANSFORMATION}" brickblock.json > terraform.tfvars.json
-
export FIRST_INGRESS=$(jq "${JQ_FIRST_INGRESS}" terraform.tfvars.json)
-
|
cat << EOF > main.tf
terraform {
backend "gcs" {
bucket = "bbk-review-terraform-deploys"
}
}
module "bbk_deploy" {
source = "git::https://git.brickblock.sh/devops/infrastructure/k8s-cluster-deploy.git"
app = {
name = "${DEPLOYMENT_NAME}"
group = "${NAMESPACE_SLUG}"
image = "${CI_REGISTRY_IMAGE}"
image_tag = "${CI_COMMIT_REF_SLUG}"
runtime_environment = "${NODE_ENV}"
replicas = "${REPLICAS}"
port = "${APP_PORT}"
commit_sha = "${CI_COMMIT_SHORT_SHA}"
}
db = {
enabled = ${HAS_DB}
should_delete = ${DB_SHOULD_DELETE}
}
ingresses = var.ingresses
}
variable "ingresses" {}
EOF
-
kubectl create namespace ${NAMESPACE_SLUG} --dry-run -o yaml | kubectl
apply -f -
-
terraform --version
-
terraform init
-
terraform workspace new ${DEPLOYMENT_NAME} ||
true
-
terraform workspace select ${DEPLOYMENT_NAME}
-
terraform refresh
-
terraform plan -input=false
-
terraform apply -auto-approve
-
kubectl wait --for=condition=available --timeout=3m
deployment/${DEPLOYMENT_NAME} -n ${NAMESPACE_SLUG}
-
printf "\n\n ✅ Successfully deployed to
https://${DEPLOYMENT_NAME}.${ISSUER_SUBDOMAIN}.${REVIEW_DOMAIN}\n\n"
environment
:
name
:
$CI_COMMIT_REF_SLUG
url
:
https://${DEPLOYMENT_NAME}.${ISSUER_SUBDOMAIN}.${REVIEW_DOMAIN}
on_stop
:
stop_review
stop_review
:
stage
:
review
image
:
registry.brickblock.sh/devops/deploy:node16
variables
:
GIT_STRATEGY
:
fetch
NODE_ENV
:
review
GOOGLE_PROJECT
:
bbk-review
ISSUER_SUBDOMAIN
:
demo
JQ_TRANSFORMATION
:
'
if
.deployAt.${NODE_ENV}
|
type=="array"
then
.deployAt.${NODE_ENV}
|
[.[]
|
{
host:
.host,
path:
(.path
//
"/")
}]
else
[
{
host:
"${CI_ENVIRONMENT_SLUG}.${ISSUER_SUBDOMAIN}.${REVIEW_DOMAIN}",
path:
"/"
}
]
end
|
{
"ingresses":
.
}'
JQ_FIRST_INGRESS
:
"
.ingresses[0]
|
(.host
+
.path)"
DEPLOYMENT_NAME
:
${CI_ENVIRONMENT_SLUG}
extends
:
-
.except-ci-release
-
.use-gcloud
-
.skip-artifacts
interruptible
:
true
retry
:
1
# Overwrites .except-ci-release.refs
except
:
refs
:
-
tags
script
:
-
node -v
-
jq "${JQ_TRANSFORMATION}" brickblock.json > terraform.tfvars.json
-
export FIRST_INGRESS=$(jq "${JQ_FIRST_INGRESS}" terraform.tfvars.json)
-
|
cat << EOF > main.tf
terraform {
backend "gcs" {
bucket = "bbk-review-terraform-deploys"
}
}
module "bbk_deploy" {
source = "git::https://git.brickblock.sh/devops/infrastructure/k8s-cluster-deploy.git"
app = {
name = "${DEPLOYMENT_NAME}"
group = "${NAMESPACE_SLUG}"
image = "${CI_REGISTRY_IMAGE}"
image_tag = "${CI_COMMIT_REF_SLUG}"
runtime_environment = "${NODE_ENV}"
replicas = "${REPLICAS}"
port = "${APP_PORT}"
commit_sha = "${CI_COMMIT_SHORT_SHA}"
}
db = {
enabled = ${HAS_DB}
should_delete = ${DB_SHOULD_DELETE}
}
ingresses = var.ingresses
}
variable "ingresses" {}
EOF
-
terraform --version
-
terraform init
-
terraform workspace new ${DEPLOYMENT_NAME} ||
true
-
terraform workspace select ${DEPLOYMENT_NAME}
-
terraform destroy -force
-
terraform workspace select default && terraform workspace delete -force
${DEPLOYMENT_NAME}
-
kubectl wait --for=delete --timeout=3m deployment/${DEPLOYMENT_NAME} -n
${NAMESPACE_SLUG}
-
printf "\n\n ✅ Successfully destroyed review app formerly deployed to
https://${DEPLOYMENT_NAME}.${ISSUER_SUBDOMAIN}.${REVIEW_DOMAIN}\n\n"
when
:
manual
environment
:
name
:
$CI_COMMIT_REF_SLUG
action
:
stop
master_deploy_to_review
:
stage
:
deploy
image
:
registry.brickblock.sh/devops/deploy:node16
variables
:
NODE_ENV
:
review
GOOGLE_PROJECT
:
bbk-review
JQ_TRANSFORMATION
:
'
[
{
host:
"${CI_PROJECT_PATH_SLUG}.master.${REVIEW_DOMAIN}",
path:
"/"
}
]
|
{
"ingresses":
.
}'
JQ_FIRST_INGRESS
:
"
.ingresses[0]
|
(.host
+
.path)"
DEPLOYMENT_NAME
:
master-${CI_PROJECT_PATH_SLUG}
extends
:
-
.except-ci-release
-
.use-gcloud
-
.skip-artifacts
only
:
-
master
interruptible
:
true
retry
:
1
script
:
-
node -v
-
jq "${JQ_TRANSFORMATION}" brickblock.json > terraform.tfvars.json
-
export FIRST_INGRESS=$(jq "${JQ_FIRST_INGRESS}" terraform.tfvars.json)
-
|
cat << EOF > main.tf
terraform {
backend "gcs" {
bucket = "bbk-review-terraform-deploys"
}
}
module "bbk_deploy" {
source = "git::https://git.brickblock.sh/devops/infrastructure/k8s-cluster-deploy.git"
app = {
name = "${DEPLOYMENT_NAME}"
group = "${NAMESPACE_SLUG}"
image = "${CI_REGISTRY_IMAGE}"
image_tag = "latest"
runtime_environment = "${NODE_ENV}"
replicas = "${REPLICAS}"
port = "${APP_PORT}"
commit_sha = "${CI_COMMIT_SHORT_SHA}"
}
db = {
enabled = ${HAS_DB}
should_delete = ${DB_SHOULD_DELETE}
}
ingresses = var.ingresses
}
variable "ingresses" {}
EOF
-
kubectl create namespace ${NAMESPACE_SLUG} --dry-run -o yaml | kubectl
apply -f -
-
terraform init
-
terraform workspace new ${DEPLOYMENT_NAME} ||
true
-
terraform workspace select ${DEPLOYMENT_NAME}
-
terraform plan -input=false
-
terraform apply -auto-approve
-
kubectl wait --for=condition=available --timeout=3m
deployment/${DEPLOYMENT_NAME} -n ${NAMESPACE_SLUG}
-
printf "\n\n ✅ Successfully deployed to
https://${CI_PROJECT_PATH_SLUG}.master.${REVIEW_DOMAIN}\n\n"
environment
:
name
:
review-master-deployments
url
:
https://${CI_PROJECT_PATH_SLUG}.master.${REVIEW_DOMAIN}
gitlab-ci/setup-ignore-engines.yml
deleted
100644 → 0
View file @
cf05d561
setup
:
stage
:
setup
extends
:
-
.except-ci-release
-
.cache
-
.skip-artifacts
interruptible
:
true
script
:
-
yarn install --frozen-lockfile --ignore-engines --network-timeout
300000
gitlab-ci/shared.yml
View file @
7012163f
...
...
@@ -70,7 +70,7 @@ variables:
.restart-deployment
:
stage
:
post-deploy
image
:
registry.brickblock.sh/devops/deploy:
node16
image
:
registry.brickblock.sh/devops/deploy:
latest
allow_failure
:
true
when
:
delayed
start_in
:
2 minutes
...
...
gitlab-ci/staging.yml
View file @
7012163f
staging
:
stage
:
deploy
image
:
registry.brickblock.sh/devops/deploy:
node16
image
:
registry.brickblock.sh/devops/deploy:
latest
variables
:
NODE_ENV
:
staging
GOOGLE_PROJECT
:
bbk-staging
...
...
@@ -9,7 +9,7 @@ staging:
|
{
host:
.host,
path:
(.path
//
"/")
}]
else
[
{
host:
"${STAGING_SUBDOMAIN}.${STAGING_DOMAIN}",
path:
"/"
}
]
end
|
{
"ingresses":
.
}'
JQ_FIRST_INGRESS
:
'
.ingresses[0]
|
(.host
+
.path)
'
JQ_FIRST_INGRESS
:
"
.ingresses[0]
|
(.host
+
.path)
"
extends
:
-
.except-ci-release
-
.use-gcloud
...
...
gitlab-ci/start-app.yml
View file @
7012163f
start-app
:
image
:
registry.brickblock.sh/devops/docker/build:
node16
image
:
registry.brickblock.sh/devops/docker/build:
latest
stage
:
test
extends
:
-
.except-ci-release
...
...
gitlab-ci/test-with-node-12.yml
deleted
100644 → 0
View file @
cf05d561
test
:
image
:
registry.brickblock.sh/devops/docker/build:node-12
stage
:
test
extends
:
-
.except-ci-release
-
.cache-pull-only
-
.skip-artifacts
interruptible
:
true
script
:
-
yarn test --coverage
gitlab-ci/test.yml
View file @
7012163f
test
:
image
:
registry.brickblock.sh/devops/docker/build:
node16
image
:
registry.brickblock.sh/devops/docker/build:
latest
stage
:
test
extends
:
-
.except-ci-release
...
...
package.json
View file @
7012163f
{
"name"
:
"project-templates"
,
"version"
:
"1.0.
0
"
,
"version"
:
"1.0.
1
"
,
"description"
:
"Config templates for all our apps, services and libraries"
,
"repository"
:
"git@ssh.brickblock.sh:devops/project-templates.git"
,
"author"
:
"Brickblock Dev Team <dev@brickblock.io>"
,
...
...
presets/rest-api/Dockerfile
View file @
7012163f
###############
# BUILD IMAGE #
###############
FROM
node:16.
0.0
-alpine3.1
3
as build
FROM
node:16.
11.1
-alpine3.1
4
as build
WORKDIR
/app
...
...
@@ -10,7 +10,7 @@ RUN apk update && apk add --no-cache --virtual deps git python3 make g++ ca-cert
{{#if strongConfig}}
# Install sops
ENV
SOPS_LATEST_VERSION="v3.7.
0
"
ENV
SOPS_LATEST_VERSION="v3.7.
1
"
ADD
https://github.com/mozilla/sops/releases/download/${SOPS_LATEST_VERSION}/sops-${SOPS_LATEST_VERSION}.linux /usr/bin
RUN
mv
/usr/bin/sops-
${
SOPS_LATEST_VERSION
}
.linux /usr/bin/sops
&&
chmod
+x /usr/bin/sops
{{/if}}
...
...
@@ -19,7 +19,7 @@ RUN mv /usr/bin/sops-${SOPS_LATEST_VERSION}.linux /usr/bin/sops && chmod +x /usr
# dependencies when the package.json or yarn.lock change and can make
# full use of docker's layer caching
COPY
package.json yarn.lock ./
RUN
yarn
install
--frozen-lockfile
--network-timeout
300000
RUN
yarn
install
--frozen-lockfile
--ignore-scripts
--network-timeout
300000
# 2. Copy rest of the app after dependencies have been installed for a higher
# chance of not having to re-install the dependencies on every 'docker build'
...
...
@@ -32,7 +32,7 @@ RUN yarn install --frozen-lockfile --production --ignore-scripts --network-timeo
#################
# RUNTIME IMAGE #
#################
FROM
node:16.
0.0
-alpine3.1
3
FROM
node:16.
11.1
-alpine3.1
4
WORKDIR
/app
...
...
@@ -42,7 +42,7 @@ RUN apk add --no-cache tini bash ca-certificates
{{#if strongConfig}}
# Install sops
ENV
SOPS_LATEST_VERSION="v3.7.
0
"
ENV
SOPS_LATEST_VERSION="v3.7.
1
"
ADD
https://github.com/mozilla/sops/releases/download/${SOPS_LATEST_VERSION}/sops-${SOPS_LATEST_VERSION}.linux /usr/bin
RUN
mv
/usr/bin/sops-
${
SOPS_LATEST_VERSION
}
.linux /usr/bin/sops
&&
chmod
+x /usr/bin/sops
{{/if}}
...
...
presets/rest-api/package.json
View file @
7012163f
...
...
@@ -10,21 +10,25 @@
"lint:docker"
:
"hadolint Dockerfile"
,
"----- AUTOGENERATED REST API SECTION END -----"
:
"----- THIS SECTION IS MAINTAINED BY BBK-DEVTOOLS -----"
},
"engines"
:
{
"node"
:
">=16.0.0"
,
"yarn"
:
">=1.22.5"
},
"dependencies"
:
{
"@brickblock/strong-config"
:
"^0.9.0"
,
"@koa/cors"
:
"^3.0.0"
,
"@sentry/node"
:
"^
4.6.4
"
,
"bunyan"
:
"^1.8.1
2
"
,
"koa"
:
"^2.
7.0
"
,
"koa-bodyparser"
:
"^4.
2.1
"
,
"@sentry/node"
:
"^
6.12.0
"
,
"bunyan"
:
"^1.8.1
5
"
,
"koa"
:
"^2.
13.1
"
,
"koa-bodyparser"
:
"^4.
3.0
"
,
"koa-bunyan-logger"
:
"^2.1.0"
,
"koa-json-error"
:
"^3.1.2"
,
"koa-router"
:
"^
7.4.0
"
"koa-router"
:
"^
10.1.1
"
},
"devDependencies"
:
{
"axios"
:
"^0.
18
.0"
,
"axios"
:
"^0.
23
.0"
,
"flow-remove-types"
:
"^1.2.3"
,
"jest"
:
"^2
4.3.1
"
,
"nodemon"
:
"^
1.18.0
"
"jest"
:
"^2
7.2.0
"
,
"nodemon"
:
"^
2.0.13
"
}
}
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