Skip to content
Snippets Groups Projects
Commit 2a587360 authored by Benguria Elguezabal, Gorka's avatar Benguria Elguezabal, Gorka
Browse files

gitlab ci for go releasing

parent 7d7fbe56
No related branches found
No related tags found
No related merge requests found
Pipeline #157421 failed
include:
# Golang template
- component: "git.code.tecnalia.com/smartdatalab/public/ci-cd-components/golang/gitlab-ci-golang@master"
inputs:
go-build-job-tags: ["docker"]
go-test-job-tags: ["docker"]
go-build-test-job-tags: ["docker"]
test-flags: -mod=readonly -v
go-ci-lint-job-tags: ["docker"]
go-mod-outdated-job-tags: ["docker"]
go-sbom-job-tags: ["docker"]
go-govulncheck-job-tags: ["docker"]
target-os: linux
target-arch: amd64
ci-lint-disabled: false
ci-lint-args: --timeout 5m -E gosec,goimports ./...
sbom-disabled: false
vulncheck-disabled: false
# semantic-release template
- component: "git.code.tecnalia.com/smartdatalab/public/ci-cd-components/semantic-release/gitlab-ci-semrel@3"
inputs:
auto-release-enabled: true
release-disabled: false
semantic-release-job-tags: ["docker"]
branches-ref: "/^(master|main)$/"
# sonar template
- component: "git.code.tecnalia.com/smartdatalab/public/ci-cd-components/sonar/gitlab-ci-sonar@master"
inputs:
sonar-job-tags: ["docker"]
# gitleaks template
- component: "git.code.tecnalia.com/smartdatalab/public/ci-cd-components/gitleaks/gitlab-ci-gitleaks@master"
inputs:
gitleaks-job-tags: ["docker"]
variables:
GIT_STRATEGY: clone
# LOG_LEVEL: debug
# variables in the GitLab CI/CD variables:
# GITLAB_TOKEN to support the semantic-release: it should have the api scope, read_repository, and write_repository permissions. It should act as maintainer if you have protected branches, and tags as it is the case.
# SONAR_TOKEN to support the sonar
# SONAR_HOST_URL to support the sonar
# Pipeline steps
stages:
- build
- test
- package-build
- package-test
- deploy
- acceptance
- publish
- production
go-build-test:
variables:
CGO_ENABLED: 0
semantic-release:
dependencies:
- go-build-test
plugins:
- '@semantic-release/commit-analyzer'
- '@semantic-release/release-notes-generator'
- - '@semantic-release/gitlab'
- assets:
- path: bin/linux/amd64/docker-custom-network-mtu-changer
label: docker-custom-network-mtu-changer (linux/amd64)
# generates the CHANGELOG.md
- '@semantic-release/changelog'
# emulates bumpversion (replaces version in pyproject.toml)
- - semantic-release-replace-plugin
- replacements:
- files:
- cmd/config.yaml
from:
- 'version: *\d+\.\d+\.\d+'
to: 'version: ${nextRelease.version}'
countMatches: true
# git commit/push modified files (CHANGELOG.md & pyproject.toml)
- - '@semantic-release/git'
- assets:
- cmd/config.yaml
# the commit MUST trigger a pipeline on tag (to perform publish jobs)
# can be skipped on prod branch
message: 'chore(semantic-release): release ${nextRelease.version} - [ci skip on prod]'
branches:
- main
- master
tagFormat: '${version}'
# From sonar setup
sonar.projectKey=smartdatalab_public_ci-cd-tools_yajsv_AZGdSUIulLHl6KbDPfWr
sonar.qualitygate.wait=true
# from golang component setup
# see: https://docs.sonarqube.org/latest/analyzing-source-code/test-coverage/test-execution-parameters/#go
# set your source directory(ies) here (relative to the sonar-project.properties file)
sonar.sources=.
# exclude unwanted directories and files from being analysed
sonar.exclusions=bin/**,**/*_test.go,**/vendor/**
# set your tests directory(ies) here (relative to the sonar-project.properties file)
sonar.tests=.
sonar.test.inclusions=**/*_test.go
sonar.test.exclusions=**/vendor/**
# tests report: JSON native format
sonar.go.tests.reportPaths=reports/go-test.native.json
# coverage report: native format
sonar.go.coverage.reportPaths=reports/go-coverage.native.out
# golanci-lint: checkstyle report (if enabled)
sonar.go.golangci-lint.reportPaths=reports/go-ci-lint.checkstyle.xml
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment