2020-01-24 16:32:01 +00:00
|
|
|
image: node:10-alpine
|
|
|
|
|
|
|
|
variables: &global_variables
|
|
|
|
DOCKER_DRIVER: overlay2
|
|
|
|
DOCKER_HOST: unix:///var/run/docker.sock
|
|
|
|
|
|
|
|
cache: &global_cache_policy
|
|
|
|
key: '$CI_COMMIT_SHORT_SHA'
|
|
|
|
policy: pull-push
|
|
|
|
paths:
|
|
|
|
- node_modules/
|
|
|
|
- build
|
2019-07-24 20:50:45 +00:00
|
|
|
|
|
|
|
stages:
|
|
|
|
- build
|
|
|
|
- test
|
2020-01-24 16:32:01 +00:00
|
|
|
- release
|
2019-07-24 20:50:45 +00:00
|
|
|
|
2020-01-24 16:32:01 +00:00
|
|
|
build:
|
|
|
|
stage: build
|
|
|
|
before_script: &before-build
|
|
|
|
- apk --no-cache add git
|
2019-07-24 20:50:45 +00:00
|
|
|
script:
|
2020-01-24 16:32:01 +00:00
|
|
|
- npm install
|
|
|
|
- npm run build:prod
|
|
|
|
artifacts: &release-artifacts
|
|
|
|
name: "admin-fe-$CI_COMMIT_REF_NAME-$CI_COMMIT_SHORT_SHA"
|
|
|
|
paths:
|
|
|
|
- dist/
|
|
|
|
|
|
|
|
lint:
|
|
|
|
stage: test
|
|
|
|
before_script: &before-yarn
|
|
|
|
- apk --no-cache add git
|
|
|
|
- yarn cache clean
|
2019-07-24 20:50:45 +00:00
|
|
|
- yarn
|
2020-01-24 16:32:01 +00:00
|
|
|
cache:
|
|
|
|
key: '$CI_COMMIT_SHORT_SHA'
|
|
|
|
policy: pull
|
|
|
|
script:
|
2019-07-24 20:50:45 +00:00
|
|
|
- yarn lint
|
|
|
|
|
|
|
|
test:
|
|
|
|
stage: test
|
2020-01-24 16:32:01 +00:00
|
|
|
before_script: *before-yarn
|
|
|
|
cache:
|
|
|
|
key: '$CI_COMMIT_SHORT_SHA'
|
|
|
|
policy: pull
|
2019-07-24 20:50:45 +00:00
|
|
|
script:
|
2020-10-13 12:18:40 +00:00
|
|
|
- yarn test --detectOpenHandles
|
2019-07-24 20:50:45 +00:00
|
|
|
|
2020-01-24 16:32:01 +00:00
|
|
|
docker:
|
|
|
|
stage: release
|
|
|
|
image: docker:latest
|
|
|
|
cache: {}
|
|
|
|
dependencies: []
|
|
|
|
variables: &docker-variables
|
|
|
|
IMAGE_TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA
|
|
|
|
IMAGE_TAG_SLUG: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
|
|
|
|
IMAGE_TAG_LATEST: $CI_REGISTRY_IMAGE:latest
|
|
|
|
IMAGE_TAG_LATEST_STABLE: $CI_REGISTRY_IMAGE:stable
|
|
|
|
before_script: &before-docker
|
|
|
|
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
|
|
|
|
- docker pull $IMAGE_TAG_SLUG || true
|
|
|
|
- export CI_JOB_TIMESTAMP=$(date --utc -Iseconds)
|
|
|
|
- export CI_VCS_REF=$CI_COMMIT_SHORT_SHA
|
|
|
|
allow_failure: true
|
2019-07-24 20:50:45 +00:00
|
|
|
script:
|
2020-01-24 16:32:01 +00:00
|
|
|
- docker build --cache-from $IMAGE_TAG_SLUG --build-arg VCS_REF=$CI_VCS_REF --build-arg BUILD_DATE=$CI_JOB_TIMESTAMP -t $IMAGE_TAG -t $IMAGE_TAG_SLUG -t $IMAGE_TAG_LATEST .
|
|
|
|
- docker push $IMAGE_TAG
|
|
|
|
- docker push $IMAGE_TAG_SLUG
|
|
|
|
- docker push $IMAGE_TAG_LATEST
|
|
|
|
tags:
|
|
|
|
- dind
|
|
|
|
only:
|
|
|
|
- develop@pleroma/admin-fe
|
|
|
|
- /^(features|ci)\/.*/@jp/admin-fe
|
|
|
|
|
|
|
|
docker-stable:
|
|
|
|
stage: release
|
|
|
|
image: docker:latest
|
|
|
|
cache: {}
|
|
|
|
dependencies: []
|
|
|
|
variables: *docker-variables
|
|
|
|
before_script: *before-docker
|
|
|
|
allow_failure: true
|
|
|
|
script:
|
|
|
|
- docker build --cache-from $IMAGE_TAG_SLUG --build-arg VCS_REF=$CI_VCS_REF --build-arg BUILD_DATE=$CI_JOB_TIMESTAMP -t $IMAGE_TAG -t $IMAGE_TAG_SLUG -t $IMAGE_TAG_LATEST_STABLE .
|
|
|
|
- docker push $IMAGE_TAG
|
|
|
|
- docker push $IMAGE_TAG_SLUG
|
|
|
|
- docker push $IMAGE_TAG_LATEST_STABLE
|
|
|
|
tags:
|
|
|
|
- dind
|
|
|
|
only:
|
|
|
|
- master@pleroma/admin-fe
|
|
|
|
|
|
|
|
|