cI: update and extend gitlab-ci.yml

This commit is contained in:
Rainer Killinger
2020-11-23 18:54:59 +01:00
parent 7e23941d0b
commit c326929415
2 changed files with 46 additions and 7 deletions

View File

@@ -1,13 +1,22 @@
image: registry.gitlab.com/openstapps/projectmanagement/node
stages:
- build
- test
- audit
- publish
- deploy
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
- node_modules
before_script:
- npm ci
npm build:
stage: build
script:
- npm run build
artifacts:
paths:
- lib
audit:
allow_failure: true
@@ -15,14 +24,38 @@ audit:
- schedules
script:
- npm audit
stage: test
stage: audit
scheduled-audit:
only:
- schedules
script:
- npm audit
stage: test
- npm audit --audit-level=high
stage: audit
docker image:
image: registry.gitlab.com/openstapps/projectmanagement/builder:latest
dependencies:
- npm build
stage: publish
variables:
DOCKER_DRIVER: overlay2
services:
- docker:dind
script:
- export CORE_VERSION=$(openstapps-projectmanagement get-used-version @openstapps/core)
- export VERSION=$(echo -n "$CI_BUILD_REF_NAME" | cut -c 2-)
- export IMAGETAG_BASE=$CI_REGISTRY_IMAGE
- export IMAGETAG_CORE_VERSION=$IMAGETAG_BASE:core-$CORE_VERSION
- export IMAGETAG_VERSION=$IMAGETAG_BASE:$VERSION
- export IMAGETAG_LATEST=$IMAGETAG_BASE:latest
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY
- docker build -t $IMAGETAG_LATEST -t $IMAGETAG_VERSION -t $IMAGETAG_CORE_VERSION .
- docker push $IMAGETAG_BASE
only:
- /^v[0-9]+\.[0-9]+\.[0-9]+$/
except:
- branches
pages:
artifacts:

6
Dockerfile Normal file
View File

@@ -0,0 +1,6 @@
FROM registry.gitlab.com/openstapps/projectmanagement/node
WORKDIR /app
ENTRYPOINT ["node", "lib/cli.js"]
ADD . /app