answerer/.gitlab-ci.yml

49 lines
1.3 KiB
YAML

include:
- project: "devops/pena-continuous-integration"
file: "/templates/docker/build-template.gitlab-ci.yml"
- project: "devops/pena-continuous-integration"
file: "/templates/docker/deploy-template.gitlab-ci.yml"
- project: "devops/pena-continuous-integration"
file: "/templates/docker/golint.gitlab-ci.yml"
- project: "devops/pena-continuous-integration"
file: "/templates/docker/service-discovery.gitlab-ci.yml"
stages:
- lint
- build
- deploy
- service-discovery
lint:
extends: .golint_template
build-app:
stage: build
extends: .build_template
rules:
- if: "$CI_COMMIT_BRANCH == $STAGING_BRANCH || $CI_COMMIT_BRANCH == $PRODUCTION_BRANCH"
script:
- docker build -t $CI_REGISTRY_IMAGE/$CI_COMMIT_BRANCH-answerer:$CI_COMMIT_REF_SLUG.$CI_PIPELINE_ID --build-arg GITLAB_TOKEN=$GITLAB_TOKEN $CI_PROJECT_DIR
- docker push $CI_REGISTRY_IMAGE/$CI_COMMIT_BRANCH-answerer:$CI_COMMIT_REF_SLUG.$CI_PIPELINE_ID
deploy-staging:
stage: deploy
tags:
- staging
extends: .deploy_template
rules:
- if: "$CI_COMMIT_BRANCH == $STAGING_BRANCH"
after_script:
- docker logs 3f72ac0bce03
deploy-prod:
stage: deploy
tags:
- prod
extends: .deploy_template
rules:
- if: "$CI_COMMIT_BRANCH == $PRODUCTION_BRANCH"
service-discovery:
extends: .sd_artefacts_template