Update .gitlab/.gitlab-ci.yml
Some checks failed
Continues Integration / Install dependencies (push) Successful in 52s
Continues Integration / Build (push) Failing after 9s
Continues Integration / Build production (push) Failing after 10s
Continues Integration / Build docker image (push) Has been skipped

This commit is contained in:
Zakary Timson 2023-08-01 15:00:19 +00:00
parent a0e0b8b4d8
commit e3cfe8246a

View File

@ -3,6 +3,7 @@ image: node:16
stages: stages:
- build - build
- test - test
- publish
- deploy - deploy
npm: npm:
@ -48,7 +49,7 @@ audit:
- if: $CI_COMMIT_BRANCH - if: $CI_COMMIT_BRANCH
registry: registry:
stage: deploy stage: publish
image: docker image: docker
cache: cache:
- key: $CI_PIPELINE_ID - key: $CI_PIPELINE_ID
@ -66,7 +67,7 @@ registry:
allow_failure: true allow_failure: true
tag: tag:
stage: deploy stage: publish
image: image:
name: alpine/git name: alpine/git
entrypoint: [ "" ] entrypoint: [ "" ]
@ -80,3 +81,21 @@ 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: docker
cache: []
variables:
SERVICE_NAME: phone-reminders_api
before_script:
- docker login -u $CI_REGISTRY_USER -p $CI_JOB_TOKEN $CI_REGISTRY
- TAG=$([ "$CI_COMMIT_BRANCH" = "$CI_DEFAULT_BRANCH" ] && echo "latest" || echo "$CI_COMMIT_BRANCH" | sed -E "s/[_/]/-/g")
script:
- docker pull "$CI_REGISTRY_IMAGE:$TAG"
- docker service update --force --with-registry-auth --image "$CI_REGISTRY_IMAGE:$TAG" "$SERVICE_NAME" || echo "Continuing in background"
allow_failure: true
rules:
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
- if: '$CI_COMMIT_BRANCH && $CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH'
when: manual