2024-02-01 10:23:23 +00:00
|
|
|
stages:
|
|
|
|
- test
|
|
|
|
- deploy
|
|
|
|
|
|
|
|
testCommit:
|
|
|
|
stage: test
|
|
|
|
image: node:latest
|
|
|
|
services:
|
|
|
|
- postgres:15
|
|
|
|
- redis
|
|
|
|
variables:
|
|
|
|
POSTGRES_PASSWORD: ci
|
|
|
|
script:
|
|
|
|
- apt-get update && apt-get install -y git wget curl build-essential python3
|
|
|
|
- cp .config/ci.yml .config/default.yml
|
|
|
|
- corepack enable
|
|
|
|
- corepack prepare pnpm@latest --activate
|
|
|
|
- git submodule update --init
|
|
|
|
- pnpm install --frozen-lockfile
|
|
|
|
- pnpm run build
|
|
|
|
- pnpm run migrate
|
|
|
|
cache:
|
|
|
|
key: test
|
|
|
|
policy: pull-push
|
|
|
|
when: on_success
|
|
|
|
paths:
|
|
|
|
- node_modules/
|
|
|
|
- packages/*/node_modules/
|
|
|
|
only:
|
|
|
|
- develop
|
|
|
|
- stable
|
|
|
|
|
|
|
|
getImageTag:
|
|
|
|
stage: deploy
|
|
|
|
image: ubuntu:latest
|
|
|
|
script:
|
|
|
|
- apt-get update && apt-get install -y jq
|
|
|
|
- |
|
|
|
|
if test -n "$CI_COMMIT_TAG"; then
|
|
|
|
tag="$CI_COMMIT_TAG"
|
|
|
|
elif test "$CI_COMMIT_BRANCH" == "stable"; then
|
|
|
|
tag="latest"
|
2024-02-01 13:35:30 +00:00
|
|
|
version="$(cat package.json | jq -r '.version'), stable"
|
2024-02-01 10:23:23 +00:00
|
|
|
elif test "$CI_COMMIT_BRANCH" == "develop"; then
|
|
|
|
tag="develop"
|
2024-02-01 13:35:30 +00:00
|
|
|
version=$(cat package.json | jq -r '.version')
|
2024-02-01 10:23:23 +00:00
|
|
|
else
|
|
|
|
tag="$CI_COMMIT_BRANCH"
|
2024-02-01 13:35:30 +00:00
|
|
|
version=$(cat package.json | jq -r '.version')
|
|
|
|
fi
|
2024-02-01 10:23:23 +00:00
|
|
|
- echo "REGISTRY_PUSH_TAG=$tag" >> build.env
|
|
|
|
- echo "REGISTRY_PUSH_VERSION=$version" >> build.env
|
2024-02-01 13:35:30 +00:00
|
|
|
|
2024-02-01 10:23:23 +00:00
|
|
|
artifacts:
|
|
|
|
reports:
|
|
|
|
dotenv: build.env
|
|
|
|
only:
|
|
|
|
- stable
|
|
|
|
- develop
|
|
|
|
- tags
|
|
|
|
buildDocker:
|
|
|
|
stage: deploy
|
|
|
|
parallel:
|
|
|
|
matrix:
|
|
|
|
- ARCH: amd64
|
|
|
|
- ARCH: arm64
|
|
|
|
tags:
|
|
|
|
- ${ARCH}
|
|
|
|
image:
|
|
|
|
name: gcr.io/kaniko-project/executor:debug
|
|
|
|
entrypoint: [""]
|
|
|
|
script:
|
|
|
|
- >-
|
|
|
|
/kaniko/executor
|
|
|
|
--context "${CI_PROJECT_DIR}"
|
|
|
|
--dockerfile "${CI_PROJECT_DIR}/Dockerfile"
|
|
|
|
--destination "${CI_REGISTRY_IMAGE}:${ARCH}"
|
|
|
|
only:
|
|
|
|
- stable
|
|
|
|
- develop
|
|
|
|
- tags
|
|
|
|
mergeManifests:
|
|
|
|
stage: deploy
|
|
|
|
needs:
|
|
|
|
- job: buildDocker
|
|
|
|
artifacts: false
|
|
|
|
- job: getImageTag
|
|
|
|
artifacts: true
|
|
|
|
tags:
|
|
|
|
- docker
|
|
|
|
image:
|
|
|
|
name: mplatform/manifest-tool:alpine
|
|
|
|
entrypoint: [""]
|
|
|
|
script:
|
|
|
|
- >-
|
|
|
|
manifest-tool
|
|
|
|
--username=${CI_REGISTRY_USER}
|
|
|
|
--password=${CI_REGISTRY_PASSWORD}
|
|
|
|
push from-args
|
|
|
|
--platforms linux/amd64,linux/arm64
|
|
|
|
--tags ${REGISTRY_PUSH_VERSION}
|
|
|
|
--template ${CI_REGISTRY_IMAGE}:ARCH
|
|
|
|
--target ${CI_REGISTRY_IMAGE}:${REGISTRY_PUSH_TAG}
|
|
|
|
only:
|
|
|
|
- stable
|
|
|
|
- develop
|
|
|
|
- tags
|