link

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package link reads and writes teamcity.toml: a committed file binding a repository to one or more TeamCity servers, with optional per-path overrides inside each server entry.

Index

Constants

View Source
const FileName = "teamcity.toml"

FileName is the canonical committed-config filename.

Variables

This section is empty.

Functions

func Find

func Find(start string) (string, bool)

Find walks up from start looking for FileName, stopping at the git repo root so an unrelated ancestor teamcity.toml can't leak in; returns absolute path + true on hit.

func RelPath

func RelPath(root, target string) string

RelPath returns target relative to root using forward slashes ("" at root); resolves symlinks first.

func Save

func Save(path string, c *Config) error

Save writes c to path.

Types

type Config

type Config struct {
	Servers []Server `toml:"server,omitempty"`
}

Config is the parsed teamcity.toml.

func Load

func Load(path string) (*Config, error)

Load parses path into a Config.

func (*Config) Match

func (c *Config) Match(serverURL string) *Server

Match returns the entry for serverURL (compared with normalizeURL), or nil.

func (*Config) UpsertScope

func (c *Config) UpsertScope(serverURL, path string, scope PathScope)

UpsertScope merges scope into the entry for serverURL at path (path="" = server top-level). Unspecified fields are preserved so re-linking with one flag doesn't blow away the others — except when --project changes, which invalidates any existing job bindings tied to the old project (including inherited child paths whose effective project comes from the server).

type PathScope

type PathScope struct {
	Project string   `toml:"project,omitempty"`
	Job     string   `toml:"job,omitempty"`
	Jobs    []string `toml:"jobs,omitempty"`
}

PathScope is a per-subdirectory binding inside a server entry.

type Server

type Server struct {
	URL     string               `toml:"url"`
	Project string               `toml:"project,omitempty"`
	Job     string               `toml:"job,omitempty"`
	Jobs    []string             `toml:"jobs,omitempty"`
	Paths   map[string]PathScope `toml:"paths,omitempty"`
}

Server is one [[server]] entry: a TC instance with default project/job and optional per-path overrides.

func (*Server) Resolve

func (s *Server) Resolve(rel string) PathScope

Resolve returns the effective scope for rel — deepest path match overlaid on server-level defaults.

Jump to

Keyboard shortcuts

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