Skip to content
Snippets Groups Projects

Refactor deployment

Open Kalin Daskalov requested to merge refactor-deployment into main
1 file
+ 5
76
Compare changes
  • Side-by-side
  • Inline
+ 5
76
include:
- project: '${HELPERS_PATH}'
file: svdh-cicd.yml
file:
- cicd-template.yml
- go-template.yml
variables:
RUNNER_AMD: amd64-docker
DOCKER_FILE: ./deployment/ci/Dockerfile
RUNNER_TAG: amd64-docker
GO_VERSION: 1.22.4
stages:
- test
- build
- trigger-deploy
lint:
image: golangci/golangci-lint:latest
stage: test
tags:
- amd64-docker
script:
- golangci-lint --version
- golangci-lint run
before_script:
- ln -s /builds /go/src/code.vereign.com
- cd /go/src/code.vereign.com/${CI_PROJECT_PATH}
unit tests:
image: golang:${GO_VERSION}
extends: .gotest
stage: test
tags:
- amd64-docker
before_script: []
coverage: '/total:\s+\(statements\)\s+(\d+.\d+\%)/'
govulncheck:
image: golang:${GO_VERSION}
stage: test
tags:
- amd64-docker
before_script:
- ln -s /builds /go/src/code.vereign.com
- cd /go/src/code.vereign.com/${CI_PROJECT_PATH}
script:
- go version
- go install golang.org/x/vuln/cmd/govulncheck@latest
- govulncheck ./...
build-dev:
extends: .docker-build-dev
stage: build
tags:
- $RUNNER_AMD
rules:
# Only run if the branch is not main, the pipeline is not triggered by a merge request and the commit is not a tag
- if: '$CI_COMMIT_BRANCH != "main" && $CI_PIPELINE_SOURCE != "merge_request_event" && $CI_COMMIT_TAG == null'
build-stg:
extends: .docker-build-dev
stage: build
tags:
- $RUNNER_AMD
rules:
- if: '$CI_COMMIT_TAG'
deploy-dev:
extends: .deploy-dev
stage: trigger-deploy
needs:
- job: build-dev
rules:
# Only run if the branch is not main, the pipeline is not triggered by a merge request and the commit is not a tag
- if: '$CI_COMMIT_BRANCH != "main" && $CI_PIPELINE_SOURCE != "merge_request_event" && $CI_COMMIT_TAG == null'
deploy-stg:
extends: .deploy-stg
stage: trigger-deploy
needs:
- job: build-stg
rules:
- if: '$CI_COMMIT_TAG'
\ No newline at end of file
GOLANGCI_LINT_VERSION: latest
\ No newline at end of file
Loading