git_provider

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package git_provider provides a client for fetching deployment metadata published as GitHub Release assets.

Uses google/go-github (v88) instead of a hand-rolled HTTP client. The primary motivation is DownloadReleaseAsset: GitHub asset downloads redirect to S3/blob storage, and the SDK handles that transparently when passed an http.Client for redirect following. Managing that redirect manually requires intercepting 302s, stripping auth headers before following to S3, and handling edge cases — maintenance we don't want.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoDeploymentMetaFound = errors.New("no deployment metadata found")
)

Functions

This section is empty.

Types

type DeploymentMetadata

type DeploymentMetadata struct {
	// Environment is the target environment name (e.g. "dev", "production").
	Environment string `json:"environment"`

	// Image is the full image reference including tag.
	Image string `json:"image"`

	// ImageTag is the Docker image tag (e.g. "dev-latest", "prod-latest").
	ImageTag string `json:"image_tag"`

	// ManifestDigest is the immutable OCI digest of the pushed image.
	// sha256:... — this is the canonical key for drift detection.
	ManifestDigest string `json:"manifest_digest"`

	// GitSHA is the commit SHA that triggered this release.
	GitSHA string `json:"git_sha"`

	// CreatedAt is when CI published this metadata.
	CreatedAt time.Time `json:"created_at"`
}

DeploymentMetadata is the structure published as a release asset by CI. The GitHub Actions workflow serializes this after a successful image push.

type GitProvider

type GitProvider interface {
	FetchLatestDeploymentMetadata(ctx context.Context, environment string) (meta DeploymentMetadata, err error)
}

func NewGithubClient

func NewGithubClient(owner, repo, token string) (GitProvider, error)

NewGithubClient constructs a githubClient for the given repository. token may be empty for public repositories (unauthenticated: 60 req/hr). For production use, always provide a token (authenticated: 5000 req/hr).

Jump to

Keyboard shortcuts

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