Homepage https://gitlab.com/kuberocketci/ci-golang
296
This repository contains a collection of reusable GitLab CI/CD templates that can be included in Go application repositories' .gitlab-ci.yml files.
This library provides a set of standardized CI/CD templates specifically designed for Go applications. The templates are configurable through inputs and can be easily integrated into any GitLab project.
A base template that provides shared functionality used by other templates, including Go caching, build jobs, Helm validation, and more.
A comprehensive template for building, testing, packaging, and publishing Go applications.
include:
- local: 'templates/build.yml'
inputs:
codebase_name: 'my-go-app'
go_image: 'docker.io/golang:1.24-bookworm'
image_registry: 'docker.io/myusername'
| Name | Description | Default |
|---|---|---|
| stage_prepare | Preparation stage name | 'prepare' |
| stage_build | Build stage name | 'build' |
| stage_test | Test stage name | 'test' |
| stage_package | Package stage name | 'package' |
| stage_publish | Publish stage name | 'publish' |
| codebase_name | Name of the Go project | 'gin-go' |
| go_image | Go Docker image to use | 'docker.io/golang:1.24-bookworm' |
| chart_dir | Directory containing Helm charts | 'deploy-templates' |
| image_registry | Docker registry for image publishing | 'docker.io/${DOCKERHUB_USERNAME}' |
A template for running CI checks on merge requests and other non-main branches.
include:
- local: 'templates/review.yml'
inputs:
codebase_name: 'my-go-app'
| Name | Description | Default |
|---|---|---|
| stage_prepare | Preparation stage name | 'prepare' |
| stage_build | Build stage name | 'build' |
| stage_test | Test stage name | 'test' |
| stage_verify | Verification stage name | 'verify' |
| codebase_name | Name of the Go project | 'gin-go' |
| go_image | Go Docker image to use | 'docker.io/golang:1.24-bookworm' |
| chart_dir | Directory containing Helm charts | 'deploy-templates' |
To use these templates, you'll need to configure these CI/CD variables:
SONAR_HOST_URL: URL to your SonarQube instanceSONAR_TOKEN: Authentication token for SonarQubeDOCKERHUB_USERNAME: Docker Hub username for image publishingDOCKERHUB_PASSWORD: Docker Hub password for image publishingGITLAB_ACCESS_TOKEN: GitLab access token for Git operationsThe sample .gitlab-ci.yml file includes a special job called visible-job-lint-fix in the .pre stage:
visible-job-lint-fix:
stage: .pre
rules: [ when: never ]
script: [ echo "This is a visible job (but never run)" ]
This job is deliberately configured to never run (rules: [ when: never ]), but remains visible in the GitLab CI/CD interface. Its purpose is to address a linting issue in the GitLab CI validator - specifically to satisfy the requirement that there must be at least one visible job in the pipeline definition, even when all actual jobs come from included templates.
Note: This is a workaround for GitLab's CI/CD linting rules. Without this dummy job, the pipeline might fail validation if all actual jobs are defined in included templates and conditionally excluded based on pipeline rules.
To contribute to these templates:
This project is licensed under the Apache License, Version 2.0 - see the LICENSE.md file for details.
Content type
Image
Digest
sha256:b2c0d7f2e…
Size
10 MB
Last updated
12 months ago
docker pull sergk/ci-golang:fa2213f5