artifacts

package
v1.0.44247-pre Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package artifacts implements the business logic for fetching and downloading CircleCI job artifacts.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Download

func Download(ctx context.Context, client Client, entries []Entry, dir string) error

Download fetches each entry's artifact and writes it under dir, preserving the artifact's Path as the relative file path. When entries span multiple execution indices, each execution's artifacts are placed under a subdirectory named by the index (e.g. dir/0/path, dir/3/path).

func ExecDir

func ExecDir(idx int) string

ExecDir returns the zero-padded directory name for an execution index.

func FormatMarkdown

func FormatMarkdown(entries []Entry) string

FormatMarkdown returns a markdown string listing the artifacts. When all entries share the same execution index the output is a flat list. When multiple executions are present, entries are grouped under ## Execution N headings.

Types

type Client

type Client interface {
	GetJobArtifactsV3(ctx context.Context, jobID string) ([]apiclient.Artifact, error)
	DownloadArtifact(ctx context.Context, artifactURL string, dst io.Writer) error
}

Client is the subset of apiclient.Client methods we need.

type Entry

type Entry struct {
	Path      string `json:"path"`
	URL       string `json:"url"`
	NodeIndex int    `json:"node_index"`
}

Entry is a single artifact produced by a job.

func ForJob

func ForJob(ctx context.Context, client Client, jobID string) ([]Entry, error)

ForJob fetches artifacts for a job identified by UUID.

Jump to

Keyboard shortcuts

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