Simplified pipeline

This commit is contained in:
Zakary Timson 2022-09-20 14:32:46 -04:00
parent a9fa35e496
commit e89adf05e6

View File

@ -3,7 +3,6 @@ image: node:16
stages: stages:
- build - build
- test - test
- publish
- deploy - deploy
npm: npm:
@ -17,8 +16,7 @@ npm:
files: files:
- package.json - package.json
paths: paths:
- node_modules/ - node_modules
- package-lock.json
policy: pull-push policy: pull-push
- key: $CI_PIPELINE_ID - key: $CI_PIPELINE_ID
paths: paths:
@ -32,13 +30,7 @@ npm:
audit: audit:
stage: test stage: test
cache: cache: [ ]
- key:
files:
- package.json
paths:
- package-lock.json
policy: pull
script: script:
- AUDIT=$(npm audit) - AUDIT=$(npm audit)
- echo "vulnerabilities_high $(echo $AUDIT | grep -oE '[0-9]+ high' | grep -oE '[0-9]+' || echo 0)" > metrics.txt - echo "vulnerabilities_high $(echo $AUDIT | grep -oE '[0-9]+ high' | grep -oE '[0-9]+' || echo 0)" > metrics.txt
@ -50,9 +42,10 @@ audit:
metrics: metrics.txt metrics: metrics.txt
rules: rules:
- if: $CI_COMMIT_BRANCH - if: $CI_COMMIT_BRANCH
allow_failure: true
registry: registry:
stage: publish stage: deploy
image: docker image: docker
cache: cache:
- key: $CI_PIPELINE_ID - key: $CI_PIPELINE_ID
@ -67,9 +60,10 @@ registry:
- docker push "$CI_REGISTRY_IMAGE:$TAG" - docker push "$CI_REGISTRY_IMAGE:$TAG"
rules: rules:
- if: $CI_COMMIT_BRANCH - if: $CI_COMMIT_BRANCH
allow_failure: true
tag: tag:
stage: publish stage: deploy
image: image:
name: alpine/git name: alpine/git
entrypoint: [ "" ] entrypoint: [ "" ]
@ -83,15 +77,3 @@ tag:
rules: rules:
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH' - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
allow_failure: true allow_failure: true
production:
stage: deploy
image: node:16
cache: [ ]
script:
- curl -X POST https://portainer.zakscode.com/api/webhooks/9fcc5dce-a884-4063-8666-34c0acf0aec5
environment:
name: Production
url: https://legioxxx.zakscode.com
rules:
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_DEPLOY_FREEZE == null'