Forked from https://gitlab.com/to-be-continuous/golang at 20240702.
Find usage example at: [https://git.code.tecnalia.com/smartdatalab/libraries/applications/docker-custom-network-mtu-changer)
gitlab-ci-golang
include:
- component: $CI_SERVER_FQDN/smartdatalab/public/ci-cd-components/golang/gitlab-ci-golang@4.13.0
Name | Mandatory | Type | Description | Default |
---|---|---|---|---|
image | false | string | The Docker image used to run Go (build+test or build only) - **set the version required by your project** | registry.hub.docker.com/library/golang:bookworm |
goproxy | false | string | URL of Go module proxy (see [Go env](https://golang.org/cmd/go/#hdr-Environment_variables)) | |
list-args | false | string | Arguments used by the list command | list -u -m -mod=readonly -json all |
sbom-opts | false | string | [@cyclonedx/cyclonedx-gomod options](https://github.com/CycloneDX/cyclonedx-gomod#usage) used for SBOM analysis | -main . |
target-os | false | string | The `$GOOS` target [see available values](https://gist.github.com/asukakenji/f15ba7e588ac42795f421b48b8aede63) Fallbacks to default `$GOOS` from the Go Docker image | |
build-mode | false | string | The template build mode (accepted values are `application`, `modules` and `auto`) | auto |
sbom-image | false | string | Specific Docker image used to run cyclonedx-gomod | $GO_IMAGE |
test-flags | false | string | Flags used by the [go test command](https://pkg.go.dev/cmd/go#hdr-Test_packages) | -mod=readonly -v -race |
test-image | false | string | Specific Docker image used to run Go tests (as a separate job) | |
build-flags | false | string | Flags used by the [go build command](https://pkg.go.dev/cmd/go#hdr-Compile_packages_and_dependencies) | -mod=readonly |
project-dir | false | string | Go project root directory | . |
target-arch | false | string | The `$GOARCH` target [see available values](https://gist.github.com/asukakenji/f15ba7e588ac42795f421b48b8aede63) Fallbacks to default `$GOARCH` from the Go Docker image | |
ci-lint-args | false | string | `golangci-lint` [command line arguments](https://github.com/golangci/golangci-lint#command-line-options) | -E gosec ./... |
semgrep-args | false | string | Semgrep [scan options](https://semgrep.dev/docs/cli-reference#semgrep-scan-command-options) | --metrics off --disable-version-check |
ci-lint-image | false | string | The Docker image used to run `golangci-lint` | registry.hub.docker.com/golangci/golangci-lint:latest-alpine |
sbom-disabled | false | boolean | Disable Software Bill of Materials | |
semgrep-image | false | string | The Docker image used to run [Semgrep](https://semgrep.dev/docs/) | registry.hub.docker.com/semgrep/semgrep:latest |
semgrep-rules | false | string | Space-separeted list of [Semgrep rules](https://semgrep.dev/docs/running-rules). Can be both local YAML files or remote rules from the [Semgrep Registry](https://semgrep.dev/explore) (denoted by the `p/` prefix) | p/golang p/gosec |
test-packages | false | string | Packages to test with the [go test command](https://pkg.go.dev/cmd/go#hdr-Test_packages) | ./... |
build-packages | false | string | Packages to build with the [go build command](https://pkg.go.dev/cmd/go#hdr-Compile_packages_and_dependencies) | ./... |
vulncheck-args | false | string | `govulncheck` [command line arguments](https://pkg.go.dev/golang.org/x/vuln/cmd/govulncheck#hdr-Flags) | ./... |
cobertura-flags | false | string | Build flags to add to use gocover-cobertura, leave blank if not needed | |
ci-lint-disabled | false | boolean | Disable GolangCI-Lint | |
generate-modules | false | string | Space separated list of Go code generator modules (ex: `stringer mockery`) | |
go-sbom-job-tags | false | array | tags to filter applicable runners for go-sbom job | [] |
go-test-job-tags | false | array | tags to filter applicable runners for go-test job | [] |
semgrep-disabled | false | boolean | Disable Semgrep | |
go-build-job-tags | false | array | tags to filter applicable runners for go-build job | [] |
mod-outdated-args | false | string | `god-mod-outdated` [command line arguments](https://github.com/psampaz/go-mod-outdated#usage | -update -direct |
build-linker-flags | false | string | Linker flags used by the [go build command](https://pkg.go.dev/cmd/go#hdr-Compile_packages_and_dependencies) `-ldflags` | -s -w |
vulncheck-disabled | false | boolean | Disable Govulncheck | |
go-ci-lint-job-tags | false | array | tags to filter applicable runners for go-ci-lint job | [] |
go-generate-job-tags | false | array | tags to filter applicable runners for go-generate job | [] |
go-build-test-job-tags | false | array | tags to filter applicable runners for go-build-test job | [] |
go-govulncheck-job-tags | false | array | tags to filter applicable runners for go-govulncheck job | [] |
go-mod-outdated-job-tags | false | array | tags to filter applicable runners for go-mod-outdated job | [] |
semgrep-download-rules-enabled | false | boolean | Download Semgrep remote rules | true |