Back to list
sgaunet

gitlab-ci

by sgaunet

A curated collection of specialized Claude Code plugins designed to enhance your development workflow with intelligent agents, skills, and commands.

3🍴 0📅 Jan 19, 2026

SKILL.md


name: gitlab-ci description: Initialize or update GitLab CI/CD pipelines for Go projects with comprehensive testing, coverage reporting, snapshot builds, and automated releases

GitLab CI/CD Setup Skill

Automate Go project CI/CD with production-ready GitLab pipelines for testing, coverage reporting, snapshot builds, and releases.

Overview

This skill provides a complete GitLab CI/CD setup for Go projects:

  • Unit Testing: Automated test execution on every push
  • Coverage Reporting: Test coverage tracking with configurable thresholds
  • Snapshot Builds: Test release builds with GoReleaser on every push
  • Release Automation: Production releases with Docker images on tag push
  • Docker Integration: Multi-architecture container builds with GitLab Container Registry

The complete pipeline configuration is provided in assets/.gitlab-ci.yml with inline documentation.

Prerequisites

Before using this skill, ensure:

  1. GitLab repository: Project hosted on GitLab (gitlab.com or self-hosted)
  2. Go module: Project uses Go modules (go.mod present)
  3. GoReleaser config (for releases): .goreleaser.yml in repository root

Pipeline Architecture

Stages & Jobs

JobStageTriggerPurposeRequirements
unit-teststestEvery pushRun test suiteDIND service
coveragetestEvery push (optional)Coverage report & badgeDIND service
build-snapshotbuildEvery pushTest release processDIND, GoReleaser
build-releasereleaseTags only (v*)Production releaseDIND, GoReleaser, .goreleaser.yml

Pipeline Triggers

  • Every push: unit-tests, build-snapshot (validates changes don't break releases)
  • Tags only (v*): build-release (creates production releases)
  • Docker-in-Docker: All jobs use docker:dind service for container builds

Instructions

Step 1: Analyze Project Structure

Verify project setup:

# Check for required files
ls go.mod                # Required: Go module
ls .goreleaser.yml      # Required for releases
ls -la .gitlab-ci.yml   # Check existing pipeline

Step 2: Copy Pipeline Configuration

Copy the template from this skill's assets:

# Copy pipeline configuration (well-documented with inline comments)
cp assets/.gitlab-ci.yml .gitlab-ci.yml

The asset file includes comprehensive inline documentation for all customization points.

Create or update Taskfile.yml with CI tasks:

version: '3'

tasks:
  test:
    desc: Run all tests
    cmds:
      - go generate ./...
      - go test -v ./...

  coverage:
    desc: Generate coverage report
    cmds:
      - go generate ./...
      - go test -coverpkg=./... -coverprofile=profile.cov ./...
      - go tool cover -func profile.cov

  snapshot:
    desc: Create snapshot build (test release)
    cmds:
      - goreleaser --snapshot --clean

  release:
    desc: Create production release
    cmds:
      - goreleaser --clean

Step 4: Customize Pipeline

Update .gitlab-ci.yml based on your project needs. The asset file has detailed inline comments marking all customization points with # CUSTOMIZE: markers.

Key customizations (all documented in asset file):

SettingLocationCommon Values
Go versionimage.name in all jobsgolang:1.24, golang:1.25.1
Runner tagstags: in all jobsgitlab-org-docker, docker, linux, shared
GoReleaser versionimage.name in build jobsgoreleaser/goreleaser:v2.12.0
Tag patternbuild-release.onlytags, /^v\d+\.\d+\.\d+$/

For coverage tracking, uncomment the coverage job in .gitlab-ci.yml and customize exclusions:

coverage:
  script:
    # Exclude packages from coverage report
    - sed -i '/cmd\//d' profile.cov              # Exclude cmd packages
    - sed -i '/internal\/mocks/d' profile.cov    # Exclude mocks

For external Docker registries, add variables in Settings → CI/CD → Variables:

  • EXTERNAL_CI_REGISTRY: Registry URL (e.g., docker.io)
  • EXTERNAL_CI_REGISTRY_USER: Username
  • EXTERNAL_CI_REGISTRY_PASSWORD: Password (mark as protected & masked)

Step 5: Configure GoReleaser

Ensure .goreleaser.yml uses GitLab variables for Docker images:

dockers:
  - image_templates:
      - "{{ .Env.CI_REGISTRY_IMAGE }}:{{ .Version }}-amd64"
      - "{{ .Env.CI_REGISTRY_IMAGE }}:{{ .Version }}-arm64"
    dockerfile: Dockerfile
    use: buildx
    build_flag_templates:
      - "--platform=linux/amd64"
      - "--label=org.opencontainers.image.created={{.Date}}"
      - "--label=org.opencontainers.image.revision={{.FullCommit}}"

docker_manifests:
  - name_template: "{{ .Env.CI_REGISTRY_IMAGE }}:{{ .Version }}"
    image_templates:
      - "{{ .Env.CI_REGISTRY_IMAGE }}:{{ .Version }}-amd64"
      - "{{ .Env.CI_REGISTRY_IMAGE }}:{{ .Version }}-arm64"
  - name_template: "{{ .Env.CI_REGISTRY_IMAGE }}:latest"
    image_templates:
      - "{{ .Env.CI_REGISTRY_IMAGE }}:{{ .Version }}-amd64"
      - "{{ .Env.CI_REGISTRY_IMAGE }}:{{ .Version }}-arm64"

Step 6: Configure GitLab Settings

Enable required GitLab features:

  1. Container Registry: Settings → General → Visibility → Container Registry: Enabled

  2. CI/CD Variables (if using external registry):

    • Settings → CI/CD → Variables → Add Variable
    • Add EXTERNAL_CI_REGISTRY, EXTERNAL_CI_REGISTRY_USER, EXTERNAL_CI_REGISTRY_PASSWORD
  3. Protected Tags (recommended):

    • Settings → Repository → Protected tags
    • Protect v*: Allowed to create: Maintainers

Step 7: Add Pipeline Badges (Optional)

Add badges to README.md:

[![Pipeline](https://gitlab.com/OWNER/REPO/badges/main/pipeline.svg)](https://gitlab.com/OWNER/REPO/-/pipelines)
[![Coverage](https://gitlab.com/OWNER/REPO/badges/main/coverage.svg)](https://gitlab.com/OWNER/REPO/-/graphs/main/charts)

Score

Total Score

75/100

Based on repository quality metrics

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

+10
説明文

100文字以上の説明がある

+10
人気

GitHub Stars 100以上

0/15
最近の活動

1ヶ月以内に更新

+10
フォーク

10回以上フォークされている

0/5
Issue管理

オープンIssueが50未満

+5
言語

プログラミング言語が設定されている

+5
タグ

1つ以上のタグが設定されている

+5

Reviews

💬

Reviews coming soon