Documentation
¶
Index ¶
- type Client
- type Platform
- func (p *Platform) Check(ctx context.Context) error
- func (p *Platform) CheckAssets() error
- func (p *Platform) CreateRelease(ctx context.Context, tag, notes string, prerelease bool) error
- func (p *Platform) HasAssets() bool
- func (p *Platform) LinkContext() port.LinkContext
- func (p *Platform) Name() string
- func (p *Platform) ReleaseURL(tag string) string
- func (p *Platform) ReleaseURLFromContext(tag string, lc *port.LinkContext) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶ added in v0.77.0
type Client struct {
// contains filtered or unexported fields
}
Client publishes GitLab releases over the REST API (ADR-0069).
func NewClient ¶ added in v0.77.0
NewClient builds a client for baseURL (instance root, optionally with a relative URL root). With jobToken the token is sent as JOB-TOKEN (CI_JOB_TOKEN), otherwise as PRIVATE-TOKEN.
func (*Client) CreateRelease ¶ added in v0.77.0
func (c *Client) CreateRelease(ctx context.Context, project, tag, notes string, assets []platforms.Asset) error
CreateRelease uploads each asset to the project's Generic Packages registry, then creates the release for tag with one package link per asset. Uploads come first so a failed upload leaves no asset-less release behind. Each asset is read from its open file, never reopened by path (platforms.OpenAssets). POST /uploads is not used: it rejects CI_JOB_TOKEN, the Generic Packages API accepts it. Each link's direct_asset_path keeps the public download URL (.../releases/<tag>/downloads/<file>) independent of the package version. ctx stops the requests (Ctrl-C); an upload cut short creates no release.
func (*Client) VerifyReleasesAccess ¶ added in v0.77.0
VerifyReleasesAccess checks that the token can read the project's releases, the API CI_JOB_TOKEN is documented to reach. project is a path or a numeric ID.
type Platform ¶
type Platform struct {
// contains filtered or unexported fields
}
Platform implements port.Platform for GitLab over the REST API (ADR-0069).
func (*Platform) Check ¶
Check verifies a token is available, the project is resolvable, and the token authenticates against the GitLab API.
func (*Platform) CheckAssets ¶ added in v0.81.0
CheckAssets applies the asset rules (confinement to the repository, and every pattern matching a file unless release.allow_missing_assets is set) ahead of publishing.
func (*Platform) CreateRelease ¶
CreateRelease opens the asset files once (platforms.OpenAssets), uploads them and creates the release (Client.CreateRelease). As on GitHub, a pattern matching nothing warns and is skipped. prerelease is accepted to satisfy the shared port.Platform contract and ignored — GitLab releases have no pre-release concept (ADR-0064).
func (*Platform) LinkContext ¶ added in v0.24.0
func (p *Platform) LinkContext() port.LinkContext
LinkContext resolves this platform's link coordinates. GitLab projects may be nested (group/subgroup/project), so the path splits on the last slash: everything before is the owner (namespace), the final segment is the repo. BaseURL falls back to the default host when unset (e.g. a config that was not run through the loader's normalize step).
func (*Platform) ReleaseURL ¶
func (*Platform) ReleaseURLFromContext ¶ added in v0.36.5
func (p *Platform) ReleaseURLFromContext(tag string, lc *port.LinkContext) string
ReleaseURLFromContext builds the release URL from a pre-resolved link context so the displayed URL stays consistent with the one used to generate release notes (ADR-0022). Ambient contexts carry the full project URL in BaseURL (Owner/Repo empty); platform contexts carry the host in BaseURL with Owner and Repo set separately.