Documentation
¶
Index ¶
- Constants
- Variables
- func MatchArtifactByPlatform(artifactNames []string) (string, bool)
- type ArtifactNotFoundError
- type CurrentResponse
- type GHR
- type GRPC
- type GS
- type GSClient
- type ListObjectsV2Pager
- type Registry
- type ReportRequest
- type S3
- func (s *S3) Current(ctx context.Context) (*CurrentResponse, error)
- func (s *S3) LatestVersion(ctx context.Context) (string, *SemVer, error)
- func (s *S3) ListObjects(ctx context.Context, prefix string) ([]types.Object, error)
- func (s *S3) PutTextObject(ctx context.Context, key, content string) error
- func (s *S3) Report(ctx context.Context, req *ReportRequest) error
- type S3Client
- type SemVer
Constants ¶
const (
// ISO8601 for time format.
ISO8601 = "20060102T150405Z0700"
)
Variables ¶
var ( // TestArch overrides runtime.GOARCH when set (for testing). TestArch string // TestOS overrides runtime.GOOS when set (for testing). TestOS string )
var ( SemVerRegexWithoutPreRelease = regexp.MustCompile(`^v?(\d+)\.(\d+)\.(\d+)$`) SemVerRegex = regexp.MustCompile(`^(v)?(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?$`) )
Functions ¶
func MatchArtifactByPlatform ¶ added in v0.15.0
MatchArtifactByPlatform finds the first artifact name that matches current OS and architecture.
Types ¶
type ArtifactNotFoundError ¶ added in v0.14.0
ArtifactNotFoundError wraps artifact not found errors with release information.
func (*ArtifactNotFoundError) Error ¶ added in v0.14.0
func (e *ArtifactNotFoundError) Error() string
func (*ArtifactNotFoundError) IsWithinGracePeriod ¶ added in v0.14.0
func (e *ArtifactNotFoundError) IsWithinGracePeriod(gracePeriod time.Duration) bool
IsWithinGracePeriod checks if the error occurred within the grace period. This helps prevent false alerts during CI/CD builds where artifacts may not be immediately available after release creation.
type CurrentResponse ¶
type CurrentResponse struct {
// ID uniquely identifies the response.
ID string
// Tag uniquely identifies the artifact concerned.
Tag string
// ArtifactURL is the URL to download the artifact.
// The URL is not only "https://"
ArtifactURL string
// CreatedAt is the creation time of the release
CreatedAt *time.Time
}
CurrentResponse is the response to get the current artifact.
type GHR ¶
type GHR struct {
Owner string `schema:"-"`
Repo string `schema:"-"`
Artifact string `schema:"artifact"`
PreRelease bool `schema:"pre-release"`
DisableRecordShipping bool // FIXME: For testing. Remove this.
// contains filtered or unexported fields
}
GHR struct.
func (*GHR) Current ¶
func (g *GHR) Current(ctx context.Context) (*CurrentResponse, error)
Current returns current artifact.
type GRPC ¶
type GRPC struct {
Target string `schema:"-"`
NoTLS bool `schema:"no-tls"`
Artifact string `schema:"artifact"`
// contains filtered or unexported fields
}
func (*GRPC) Current ¶
func (c *GRPC) Current(ctx context.Context) (*CurrentResponse, error)
Current returns current artifact.
type GS ¶ added in v0.18.0
type GS struct {
Bucket string `schema:"-"`
Prefix string `schema:"-"`
Artifact string `schema:"artifact"`
PreRelease bool `schema:"pre-release"`
// contains filtered or unexported fields
}
GS struct.
func NewGSWithClient ¶ added in v0.18.0
func NewGSWithClient(ctx context.Context, u string, log *logging.Logger, client GSClient) (*GS, error)
NewGSWithClient returns GS with custom client (for testing).
func (*GS) Current ¶ added in v0.18.0
func (g *GS) Current(ctx context.Context) (*CurrentResponse, error)
Current returns current artifact.
func (*GS) LatestVersion ¶ added in v0.18.0
type GSClient ¶ added in v0.18.0
type GSClient interface {
Bucket(name string) *storage.BucketHandle
Close() error
}
type ListObjectsV2Pager ¶
type Registry ¶
type Registry interface {
// Current returns the current artifact.
Current(context.Context) (*CurrentResponse, error)
// Report reports the result of deploying the artifact.
Report(context.Context, *ReportRequest) error
}
type ReportRequest ¶
type ReportRequest struct {
// ID is the ID of the response.
ID string
// Tag is the current tag of deployed artifact.
Tag string
// Command is the command that was used for deployment (server or assets).
Command string
// Err is the error that occurred during deployment. If Err is nil, the deployment is considered successful.
Err error
}
ReportRequest is the request to report the result of deploying the artifact.
type S3 ¶
type S3 struct {
Bucket string `schema:"-"`
Prefix string `schema:"-"`
Region string `schema:"region"`
Endpoint string `schema:"endpoint"`
Artifact string `schema:"artifact"`
PreRelease bool `schema:"pre-release"`
// contains filtered or unexported fields
}
S3 struct.
func (*S3) Current ¶
func (s *S3) Current(ctx context.Context) (*CurrentResponse, error)
Current returns current artifact.
func (*S3) ListObjects ¶
func (*S3) PutTextObject ¶
type S3Client ¶
type S3Client interface {
PutObject(ctx context.Context, input *s3.PutObjectInput, opts ...func(*s3.Options)) (*s3.PutObjectOutput, error)
ListObjectsV2(context.Context, *s3.ListObjectsV2Input, ...func(*s3.Options)) (*s3.ListObjectsV2Output, error)
}
type SemVer ¶
func FindLatestSemVer ¶ added in v0.15.0
FindLatestSemVer finds the latest semantic version from a list of version strings.