ci

package
v1.10.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 21, 2026 License: MIT Imports: 2 Imported by: 0

README

No go.mod Example

This example demonstrates the synthetic go.mod generation feature that allows you to build GitLab CI pipelines without requiring a go.mod file.

Features

  • No go.mod required: The tool automatically creates a temporary module when no go.mod is found
  • Quick prototyping: Perfect for testing pipeline configurations without setting up a full Go module
  • Automatic dependency resolution: All dependencies are resolved automatically during build

Usage

From this directory:

wetwire-gitlab build .

This will:

  1. Detect that no go.mod exists in the directory or parent directories
  2. Create a temporary synthetic module using the directory name as the module path
  3. Copy your Go files to a temporary location and rewrite package declarations
  4. Resolve all dependencies automatically
  5. Generate the .gitlab-ci.yml file

How It Works

The synthetic mode:

  1. Walks up the directory tree looking for an existing go.mod
  2. If no go.mod is found, creates a temporary module with:
    • Module name based on the directory name
    • Latest version of wetwire-gitlab-go
    • Auto-detection of local wetwire-gitlab-go installation for development
  3. Copies your pipeline.go files to a temporary package
  4. Rewrites package declarations to make them importable (e.g., package ci -> package userpkg)
  5. Runs go mod tidy and go mod download to resolve all dependencies
  6. Executes the pipeline and generates YAML output
  7. Cleans up all temporary files

Limitations

  • Files must use a package declaration (any valid Go package name works)
  • Only .go files in the immediate directory are included (subdirectories are not copied)
  • Test files (*_test.go) are excluded

When to Use This

This feature is ideal for:

  • Quick experimentation with GitLab CI configurations
  • CI/CD workshops and demonstrations
  • Simple single-file pipeline definitions
  • Learning wetwire-gitlab-go syntax

For production use cases, we recommend using a proper go.mod file for better dependency management and reproducibility.

Documentation

Overview

Example pipeline without requiring go.mod Run: wetwire-gitlab build .

Index

Constants

This section is empty.

Variables

View Source
var BuildJob = pipeline.Job{
	Name:   "build",
	Stage:  "build",
	Script: List("go build ./..."),
	Image: pipeline.Image{
		Name: "golang:1.23",
	},
}
View Source
var TestJob = pipeline.Job{
	Name:   "test",
	Stage:  "test",
	Script: List("go test ./..."),
	Needs:  []any{BuildJob},
	Image: pipeline.Image{
		Name: "golang:1.23",
	},
}

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL