branchdeploy

package
v0.8.2 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package branchdeploy holds the pure rules for branch deploys: which branches qualify and what stable name a branch gets.

Index

Constants

View Source
const (
	ModeOff      = "off"
	ModeAll      = "all"
	ModePatterns = "patterns"
)

Modes for an app's branch deploy setting.

Variables

This section is empty.

Functions

func AppName

func AppName(appName, slug string) string

AppName is the name a branch deploy runs under.

func MatchGlob

func MatchGlob(pattern, name string) bool

MatchGlob reports whether name matches pattern, where "*" matches any run of characters (including "/") and every other character matches itself.

func MaxSlugLen

func MaxSlugLen(appName string) int

MaxSlugLen is the longest slug that keeps "<app>-br-<slug>" within one DNS label.

func Slug

func Slug(branch string, maxLen int) string

Slug turns a branch name into a DNS-safe slug of at most maxLen characters. A branch that is already lowercase alphanumerics and dashes keeps its name; any other branch gets a short hash of the original so "feature/x" and "feature-x" never share a URL. The result is deterministic.

func ValidMode

func ValidMode(m string) bool

ValidMode reports whether m is a known mode.

Types

type Settings

type Settings struct {
	Mode     string
	Patterns []string
}

Settings is an app's branch deploy policy. Patterns are exact branch names or globs where "*" matches any run of characters, including "/".

func (Settings) Eligible

func (s Settings) Eligible(branch, productionBranch string) bool

Eligible reports whether branch gets a branch deploy. The production branch is never eligible: it already deploys as the app itself.

Jump to

Keyboard shortcuts

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