Documentation
¶
Index ¶
- Constants
- type ArtifactInfo
- type BuildManifest
- type BuildMetadata
- type Client
- func (c *Client) CompareImageDigests(ctx context.Context, serviceName, tag, imageURL string, ...) (bool, string, string, error)
- func (c *Client) Download(ctx context.Context, serviceName, version string) (*BuildManifest, error)
- func (c *Client) DownloadManifestsParallel(ctx context.Context, serviceName string, versions []string, ...) []*ManifestWithVersion
- func (c *Client) Upload(ctx context.Context, manifest *BuildManifest, serviceName, version string) error
- type Config
- type DockerInspectOutput
- type DownloadOptions
- type ECRInfo
- type ManifestWithVersion
- type PRInfo
- type ServiceInfo
Constants ¶
const ( ManifestBucketName = "nuon-build-manifests" ManifestRegion = "us-west-2" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ArtifactInfo ¶
type ArtifactInfo struct {
S3Path string `json:"s3_path,omitempty"`
Checksum string `json:"checksum,omitempty"`
Size int64 `json:"size,omitempty"`
ECR ECRInfo `json:"ecr,omitempty"`
}
ArtifactInfo contains details about artifacts (S3 files)
type BuildManifest ¶
type BuildManifest struct {
Service ServiceInfo `json:"service"`
Artifacts []ArtifactInfo `json:"artifacts,omitempty"`
Metadata BuildMetadata `json:"metadata"`
Timestamp time.Time `json:"timestamp"`
}
BuildManifest represents the complete manifest for a build
func GenerateManifest ¶
func GenerateManifest( imageURL string, ecrInfo ECRInfo, buildArgs map[string]string, metadata BuildMetadata, ) *BuildManifest
GenerateManifest creates a build manifest
func (*BuildManifest) AddArtifact ¶
func (m *BuildManifest) AddArtifact(artifact ArtifactInfo)
AddArtifact adds an artifact to the manifest
func (*BuildManifest) SetImageDetails ¶
func (m *BuildManifest) SetImageDetails(digest string, size int64)
SetImageDetails updates the service image details (digest and size)
func (*BuildManifest) ToJSON ¶
func (m *BuildManifest) ToJSON() ([]byte, error)
ToJSON converts the manifest to JSON
type BuildMetadata ¶
type BuildMetadata struct {
IsPromotion bool `json:"is_promotion"`
PRDetails *PRInfo `json:"pr_details,omitempty"`
IsMain bool `json:"is_main"`
Author string `json:"author,omitempty"` // Workflow trigger (may differ from PR author)
GitRef string `json:"git_ref,omitempty"`
GitCommit string `json:"git_commit,omitempty"`
}
BuildMetadata contains metadata about the build
func GetMetadataFromEnv ¶
func GetMetadataFromEnv() BuildMetadata
GetMetadataFromEnv extracts build metadata from environment variables
Standard GitHub Actions variables:
- GITHUB_ACTOR: GitHub username of the person who triggered the workflow
- GITHUB_REF: Full git ref (e.g., refs/heads/main, refs/pull/123/merge)
- GITHUB_SHA: Commit SHA that triggered the workflow
- GITHUB_REPOSITORY: Repository name (owner/repo)
- GITHUB_HEAD_REF: Source branch of PR (only for pull_request events)
- GITHUB_BASE_REF: Target branch of PR (only for pull_request events)
Custom variables:
- CI_ACTION_REF_NAME_SLUG: Branch slug (from FranzDiebold action)
- CI_PR_NUMBER: PR number (from FranzDiebold action)
- CI_PR_TITLE: PR title (from FranzDiebold action)
- BUILD_PROMOTION: "true" if this is a promotion build
- GITHUB_PR_AUTHOR: PR author (set manually from github.event.pull_request.user.login)
- GIT_COMMIT: Fallback commit SHA if GITHUB_SHA is not set
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client handles manifest generation and upload
func (*Client) CompareImageDigests ¶
func (c *Client) CompareImageDigests(ctx context.Context, serviceName, tag, imageURL string, getLocalInfo func(context.Context, string) (*DockerInspectOutput, error)) (bool, string, string, error)
CompareImageDigests compares local and remote image digests Returns: hasUpdate, localDigest, remoteDigest, error If error is non-nil, comparison failed and caller should handle gracefully
func (*Client) DownloadManifestsParallel ¶
func (c *Client) DownloadManifestsParallel(ctx context.Context, serviceName string, versions []string, opts *DownloadOptions) []*ManifestWithVersion
type DockerInspectOutput ¶
DockerInspectOutput represents the docker inspect output format
type DownloadOptions ¶
type DownloadOptions struct {
PromotionsOnly bool
}
type ECRInfo ¶
type ECRInfo struct {
RepositoryURL string `json:"repository_url,omitempty"`
RepositoryARN string `json:"repository_arn,omitempty"`
Registry string `json:"registry,omitempty"`
Tag string `json:"tag,omitempty"`
}
ECRInfo contains ECR repository information
type ManifestWithVersion ¶
type ManifestWithVersion struct {
Version string
Manifest *BuildManifest
}
type PRInfo ¶
type PRInfo struct {
Number string `json:"number"`
Title string `json:"title,omitempty"`
Author string `json:"author,omitempty"`
HeadBranch string `json:"head_branch,omitempty"`
BaseBranch string `json:"base_branch,omitempty"`
URL string `json:"url,omitempty"`
}
PRInfo contains pull request information
type ServiceInfo ¶
type ServiceInfo struct {
ImageURL string `json:"image_url,omitempty"`
ImageDigest string `json:"image_digest,omitempty"`
ImageSize int64 `json:"image_size,omitempty"`
ECR ECRInfo `json:"ecr,omitempty"`
BuildArgs map[string]string `json:"build_args,omitempty"`
}
ServiceInfo contains details about the service image