Documentation
¶
Overview ¶
Package vcs implements the remote-only Artifactory VCS archive protocol.
Index ¶
- Constants
- Variables
- func ArchiveURL(c repo.Config, owner, name, ref, ext string) (*url.URL, error)
- func CustomFileZIP(ctx context.Context, archive []byte, ext, filename string) ([]byte, error)
- func FileZIP(ctx context.Context, archive []byte, ext, filename string) ([]byte, error)
- func GitRefsURL(c repo.Config, owner, name string) (*url.URL, error)
- func PeerFileURL(c repo.Config, owner, name, kind, ref, filename string) (*url.URL, error)
- func ValidCommitID(s string) bool
- func ValidExtension(ext string) bool
- func ValidFilePath(path string) bool
- func ValidProject(owner, name string) bool
- func ValidRef(name string) bool
- func ValidateArchive(ctx context.Context, body io.ReadSeeker, size int64, ext string) error
- func ValidateCommitArchive(ctx context.Context, body io.ReadSeeker, size int64, ext, commit string) error
- func ValidateFileZIP(ctx context.Context, body io.ReadSeeker, size int64, filename string) error
- func WrappedFileZIP(ctx context.Context, archive []byte, ext, filename string) ([]byte, error)
- type Ref
- type RefEndpoint
Constants ¶
const ( MaxArchiveBytes = 256 << 20 MaxExpandedBytes = 1 << 30 MaxArchiveFiles = 100000 )
const ( MaxRefsBytes = 8 << 20 MaxRefs = 65536 )
const MaxFileZIPBytes = MaxSelectedFileBytes + 1<<20
const MaxSelectedFileBytes = 64 << 20
Variables ¶
var ErrInvalidArchive = errors.New("vcs: invalid vcs archive")
var ErrInvalidPath = errors.New("vcs: invalid vcs path")
var ErrInvalidRefs = errors.New("vcs: invalid vcs references")
Functions ¶
func ArchiveURL ¶
ArchiveURL builds an archive address for a provider's HTTP source. The returned URL remains subject to the configured remote destination policy.
func CustomFileZIP ¶
CustomFileZIP preserves custom templates that return rootless or wrapped archives. An exact repository path takes precedence; fallback still rejects multiple matching wrapper directories.
func FileZIP ¶
FileZIP selects one file from an already validated provider archive and returns a ZIP with that file at its repository-relative path.
func GitRefsURL ¶
GitRefsURL points at Git smart-HTTP discovery on the configured provider. It does not ask for protocol v2, so a v1 ref advertisement is expected.
func PeerFileURL ¶
PeerFileURL addresses the peer's selected-file API. Its reference is mutable; callers must not cache the response as an immutable commit archive.
func ValidCommitID ¶
ValidCommitID accepts the Git SHA-1 and SHA-256 object ID forms.
func ValidExtension ¶
func ValidFilePath ¶
func ValidProject ¶
ValidProject accepts the provider's owner path and repository name. GitLab owners can contain subgroups; the number of segments is bounded because this path also becomes a source URL and an authorization/cache key.
func ValidRef ¶
ValidRef is a conservative Git branch/tag name. It rejects syntax that can alter a URL's authority or path meaning when passed to a provider.
func ValidateArchive ¶
ValidateArchive checks a complete provider archive before it is admitted to the shared source cache. It leaves the read seeker at an unspecified offset.
func ValidateCommitArchive ¶
func ValidateCommitArchive( ctx context.Context, body io.ReadSeeker, size int64, ext, commit string, ) error
ValidateCommitArchive also binds Git archive commit metadata, when present, to the immutable object requested from the provider.
func ValidateFileZIP ¶
ValidateFileZIP admits only a bounded ZIP containing the exact selected file. A peer response is returned unchanged after validation, without root inference.
Types ¶
type Ref ¶
Ref is a Git branch or tag and the object ID it resolves to. Annotated tags use the peeled object ID when one is advertised.
type RefEndpoint ¶
RefEndpoint binds a provider's discovery URL to its metadata parser.
func RefEndpoints ¶
func RefEndpoints(c repo.Config, owner, name string) ([]RefEndpoint, error)
RefEndpoints uses Git discovery for Git providers and the publisher's documented tag/branch JSON schema for an Artifactory peer.
func (RefEndpoint) Variant ¶
func (e RefEndpoint) Variant() string