Documentation
¶
Overview ¶
Package vcshttp implements the remote-only Artifactory VCS archive protocol: the VCS partial strict server (VCSAPI), whose 17 operations list a project's tags, branches and references and serve its archives and selected files, and the route for GitLab subgroup owners (VCSNested), over the item kit. It builds the upstream address of a project's reference listing, archive or selected file (RefEndpoints, GitRefsURL, ArchiveURL, PeerFileURL) for GitHub, GitHub Enterprise, GitLab, Bitbucket, Bitbucket Server (STASH and OLDSTASH), a peer Artifactory VCS repository or a CUSTOM template; parses the references a provider lists (ParseRefs, RefEndpoint.Parse); checks an archive in full before the remote cache admits it (ValidateArchive, ValidateCommitArchive, ValidateFile); selects one file from an archive (SelectFile, SelectWrappedFile, SelectCustomFile); and zips a selected file for ext=zip (FileZIP).
Role ¶
artifacts module, ecosystem vcs, HTTP layer: the VCS slice's protocol handlers, with its archive, file, reference and peer rules; the slice is remote only. It is named vcshttp so that it does not shadow net/http. The slice has no format package, so the item service gives VCS repositories the generic hooks (decision 0032). Outside tests, only its own http subtree, the module's http adapters and app may import it (decision 0044, dependency rule 9).
Inputs ¶
- Driving: the router, which embeds VCSAPI in the artifactory spec's strict server and mounts VCSNested at GET /artifactory/api/vcs/*, where the generated routes do not match a GitLab subgroup owner. Within the package, vcs_routes.go lists a project's references (ValidProject, RefEndpoints, then each endpoint's Variant and Parse, within MaxRefsBytes and MaxRefs); vcs_download.go resolves a branch, tag or release to its commit (ValidRef, ValidCommitID), fetches that commit's archive (ArchiveURL, ValidateCommitArchive) and selects a file from it within MaxArchiveBytes (ValidFilePath, SelectFile, SelectWrappedFile, SelectCustomFile, ErrInvalidPath); vcs_nested.go routes GitLab subgroup paths (ValidProject, ValidRef, ValidFilePath, ValidExtension); vcs_peer_file.go asks a peer for a selected file itself (PeerFileURL, ValidateFile, within MaxSelectedFileBytes); and vcs_served.go answers every archive and file download.
- KeepRequest, which app's router adds to the strict server's middleware, hands the 14 archive and file downloads their request, whose validators and range their answer needs.
- Driven: the item kit (artifacts/adapters/http/itemkit), which resolves the repository and the caller's access, reads a cached archive's properties through the content store, opens cached blobs and writes errors; and the kit's remote source service (artifacts/core/remote/source), which fetches and caches reference listings, archives and peer files. The address and archive rules build from a repository's configuration (artifacts/api/repo) and read only the bytes they are given.
- Settings: none. A repository's url and vcsGitProvider, and for CUSTOM its vcsGitDownloadUrl template, select the provider and its address.
Outputs ¶
- VCSAPI: the VCS partial strict server, whose operations answer the reference listings as JFrog's JSON; archives as application/x-gzip or application/zip by their extension, named as 7.x's GitRef names them (<repo>-<tag>.<ext>, <repo>-<branch>-<commit>.<ext>) in X-Artifactory-Filename and Content-Disposition, with the checksums their read knows (#1580); and a selected file as the file itself, typed by its extension and named by its base name (RTFACT-29495), or with ext=zip as the ZIP that holds it, named <file>.zip [I]. Every archive and file answers as a 7.x file download does [I]: its SHA-1 as a bare ETag, its time as Last-Modified, a 304 to either, and a range with 206, or 416 past its end.
- VCSNested: the handler of the GitLab subgroup path forms, which answers an archive and a selected file as VCSAPI does and a form it does not own with 404.
- The name rules: ValidProject, ValidRef, ValidCommitID, ValidFilePath and ValidExtension.
- The provider addresses: RefEndpoints, GitRefsURL, ArchiveURL and PeerFileURL, which fail with ErrInvalidPath.
- The reference rules: Ref, RefEndpoint with Variant and Parse, and ParseRefs, which fail with ErrInvalidRefs; MaxRefsBytes and MaxRefs.
- The archive rules: ValidateArchive, ValidateCommitArchive, ValidateFile, SelectFile, SelectWrappedFile, SelectCustomFile and FileZIP, which fail with ErrInvalidArchive, or ErrInvalidPath for a file the archive does not hold; MaxArchiveBytes, MaxExpandedBytes, MaxArchiveFiles and MaxSelectedFileBytes.
Invariants ¶
- Every provider address starts from the configured remote URL, which must be http or https with a host and no user information, query, fragment or encoded path, and no project, reference or file name may change its authority or path. The partial also applies the remote's destination and redirect policy: a reference listing, a peer's file and a STASH, OLDSTASH or peer archive follow no redirect to another URL, and any other archive only one on the configured origin under the project's path, or to codeload.github.com for github.com, without user information or a fragment.
- A properties filter only selects an archive that is already cached; it never fetches one to create a match.
- The caller's read permission is checked on the project before the remote source is read, and on an archive's or file's path before it is fetched; a reference the caller may not read is left out of a listing.
- The download policy (decision 0032) comes after Read permission. The references, which a listing and a tag, branch or release download read first, are checked at 7.x's cached refs file, <owner>/<name>/gitrefs (RTFACT-30171, RTFACT-30743), and an archive at its cache path; a blacked-out remote or a path its patterns reject answers 404 with the policy's message.
- An archive is read in full before it is admitted, a tar.gz to the end of its gzip stream and every ZIP member to its declared size, within 256 MiB, 1 GiB expanded and 100,000 entries; every entry path is relative and clean, and a tar holds only directories, regular files and git archive's single global commit record.
- A commit marker in an archive (git archive's PAX comment, or a ZIP comment that is a commit ID) must name the commit that was asked for.
- A reference listing is at most 8 MiB and 65,536 references and names each reference once; an annotated tag resolves to the commit its peeled entry names.
- A peer's selected file follows a reference that can move, so it is never treated as an immutable commit archive.
- The Variant values are part of the remote cache key, so they stay byte-identical, as do statuses and error and log text, until what is cached changes: vcs-peer-file-v2 holds the peer's file itself, where v1 held a ZIP of it.
References ¶
- Decision 0007: docs/research/decisions/0007-remote-repositories.md (VCS is remote only, and its reads cross the shared source boundary and cache); decision 0032: docs/research/decisions/0032-package-format-handlers.md (the format hooks, which VCS repositories take from generic).
- docs/testing/vcs.md (the REST contract, the providers, GitLab subgroups, the peer and the acceptance evidence), docs/research/39-vcs-legacy.md (the STASH, OLDSTASH and peer contracts) and docs/client-recipes/vcs.md (the client recipe).
- JFrog VCS repositories: https://docs.jfrog.com/artifactory/docs/vcs-repositories.
- Decision 0044: docs/research/decisions/0044-modular-monolith-migration.md, "Dependency rules".
- Target layout: docs/research/architecture-options/5-modular-monolith.md, line 234 (ecosystem/vcs), line 379 (the slice row), line 409 (the root files that join this package; vcs_peer_file.go joins them too) and line 1024 (the mapping row).
- Plan: docs/implementation/plan.md#p33-automation-and-source-repositories and #p9d-modular-monolith-migration, epic ECO (https://github.com/weaveplatform/artifactweave/issues/943).
- https://github.com/weaveplatform/artifactweave/issues/786, https://github.com/weaveplatform/artifactweave/issues/1044 and https://github.com/weaveplatform/artifactweave/issues/1085
Status ¶
Implemented P9c, which delivered the plan's P33 group (issues #782 to #788). Moved here in P9d (ECO-20), which made the server root's VCS handlers the VCS partial strict server (WEB-08) and moved them here (WEB-16).
Testing ¶
- archive_test.go: provider tar and ZIP archives, traversal and corruption, exact and rootless file selection, name validation, provider addresses kept on the configured origin, invalid configuration, unsafe ZIP entries, and missing, duplicate and corrupt selections.
- archive_git_test.go: real git archive output bound to its commit with rootless paths, global PAX records, a peer's selected file within its bound, and CUSTOM exact and wrapped layouts; the VCS client recipe cites it.
- paths_test.go: the STASH and OLDSTASH addresses.
- peer_test.go: the peer's endpoints and payloads, malformed or ambiguous references, and the selected-file address.
- refs_test.go: ParseRefs with branches and peeled tags, and malformed or ambiguous advertisements.
- vcs_routes_test.go calls the partial's code without the router, over a kittest world's store and blob store (fixture_test.go, which keeps the names of the root fixtures the tests used): the archive redirect policy and its fallback for a malformed base, exact reference URLs, the property filter's parsing and its match against a cached item's properties, archive requests refused before the source, and a result's revalidation, usage and missing cached blob.
- vcs_served_test.go: a download's headers, 304, range, 416 and HEAD, a body that cannot seek or whose checksums are not known, and KeepRequest.
testdata holds unchanged git archive output, the legacy and refreshed tar.gz and ZIP archives, with git-archives.json, which records each commit and archive digest, and generate.py, which builds them (testdata/README.md). The route suite test/server/artifacts/vcs and the acceptance steps also read it. The REST evidence is TestAccVCSRemoteRESTAndSubgroup in that route suite, which serves the operations and the subgroup route through the router; TestAccVCSRefsFollowThePolicyAtTheirCachedPath there checks the references' download policy at their 7.x path; and the @vcs acceptance scenarios (test/acceptance/features/vcs.feature, vcs_legacy.feature and vcs_recipes.feature).
Index ¶
- Constants
- Variables
- func ArchiveURL(c repo.Config, owner, name, ref, ext string) (*url.URL, error)
- func FileZIP(filename string, data []byte) ([]byte, error)
- func GitRefsURL(c repo.Config, owner, name string) (*url.URL, error)
- func KeepRequest(f artgen.StrictHandlerFunc, operationID string) artgen.StrictHandlerFunc
- func PeerFileURL(c repo.Config, owner, name, kind, ref, filename string) (*url.URL, error)
- func SelectCustomFile(ctx context.Context, archive []byte, ext, filename string) ([]byte, error)
- func SelectFile(ctx context.Context, archive []byte, ext, filename string) ([]byte, error)
- func SelectWrappedFile(ctx context.Context, archive []byte, ext, filename string) ([]byte, 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 ValidateFile(ctx context.Context, body io.ReadSeeker, size int64) error
- type Ref
- type RefEndpoint
- type VCSAPI
- func (s VCSAPI) DownloadFileInVcsBranchInSubgroupRepository(ctx context.Context, ...) (artgen.DownloadFileInVcsBranchInSubgroupRepositoryResponseObject, error)
- func (s VCSAPI) DownloadFileInVcsTagInSubgroupRepository(ctx context.Context, ...) (artgen.DownloadFileInVcsTagInSubgroupRepositoryResponseObject, error)
- func (s VCSAPI) DownloadFileWithinVcsBranch(ctx context.Context, req artgen.DownloadFileWithinVcsBranchRequestObject) (artgen.DownloadFileWithinVcsBranchResponseObject, error)
- func (s VCSAPI) DownloadFileWithinVcsBranchAlternative(ctx context.Context, ...) (artgen.DownloadFileWithinVcsBranchAlternativeResponseObject, error)
- func (s VCSAPI) DownloadFileWithinVcsTag(ctx context.Context, req artgen.DownloadFileWithinVcsTagRequestObject) (artgen.DownloadFileWithinVcsTagResponseObject, error)
- func (s VCSAPI) DownloadFileWithinVcsTagAlternative(ctx context.Context, ...) (artgen.DownloadFileWithinVcsTagAlternativeResponseObject, error)
- func (s VCSAPI) DownloadVcsBranch(ctx context.Context, req artgen.DownloadVcsBranchRequestObject) (artgen.DownloadVcsBranchResponseObject, error)
- func (s VCSAPI) DownloadVcsBranchAlternative(ctx context.Context, req artgen.DownloadVcsBranchAlternativeRequestObject) (artgen.DownloadVcsBranchAlternativeResponseObject, error)
- func (s VCSAPI) DownloadVcsBranchFromSubgroupRepository(ctx context.Context, ...) (artgen.DownloadVcsBranchFromSubgroupRepositoryResponseObject, error)
- func (s VCSAPI) DownloadVcsCommit(ctx context.Context, req artgen.DownloadVcsCommitRequestObject) (artgen.DownloadVcsCommitResponseObject, error)
- func (s VCSAPI) DownloadVcsRelease(ctx context.Context, req artgen.DownloadVcsReleaseRequestObject) (artgen.DownloadVcsReleaseResponseObject, error)
- func (s VCSAPI) DownloadVcsTag(ctx context.Context, req artgen.DownloadVcsTagRequestObject) (artgen.DownloadVcsTagResponseObject, error)
- func (s VCSAPI) DownloadVcsTagAlternative(ctx context.Context, req artgen.DownloadVcsTagAlternativeRequestObject) (artgen.DownloadVcsTagAlternativeResponseObject, error)
- func (s VCSAPI) DownloadVcsTagFromSubgroupRepository(ctx context.Context, ...) (artgen.DownloadVcsTagFromSubgroupRepositoryResponseObject, error)
- func (s VCSAPI) GetVcsBranches(ctx context.Context, req artgen.GetVcsBranchesRequestObject) (artgen.GetVcsBranchesResponseObject, error)
- func (s VCSAPI) GetVcsRefs(ctx context.Context, req artgen.GetVcsRefsRequestObject) (artgen.GetVcsRefsResponseObject, error)
- func (s VCSAPI) GetVcsTags(ctx context.Context, req artgen.GetVcsTagsRequestObject) (artgen.GetVcsTagsResponseObject, error)
- func (s VCSAPI) VCSNested(w http.ResponseWriter, r *http.Request)
Constants ¶
const ( MaxArchiveBytes = 256 << 20 MaxExpandedBytes = 1 << 30 MaxArchiveFiles = 100000 )
MaxArchiveBytes, MaxExpandedBytes and MaxArchiveFiles bound a provider archive: 256 MiB as fetched, 1 GiB expanded and 100,000 entries. The root files read at most MaxArchiveBytes of an archive before selecting a file from it.
const ( MaxRefsBytes = 8 << 20 MaxRefs = 65536 )
MaxRefsBytes and MaxRefs bound a reference listing, a Git ref advertisement or a peer's tags or branches JSON alike: 8 MiB of response and 65,536 references. The root files read at most MaxRefsBytes of a listing and refuse more than MaxRefs references across a project's listings.
const MaxSelectedFileBytes = 64 << 20
MaxSelectedFileBytes bounds a selected file, 64 MiB, whether it is taken from an archive (SelectFile, SelectWrappedFile, SelectCustomFile) or arrives from a peer (ValidateFile).
Variables ¶
var ErrInvalidArchive = errors.New("vcs: invalid vcs archive")
ErrInvalidArchive is the error the archive and file checks return for an archive or selected-file ZIP they refuse: over a bound, corrupt, holding an unsafe entry, or marked with another commit.
var ErrInvalidPath = errors.New("vcs: invalid vcs path")
ErrInvalidPath is the error the address rules return for a project, reference, file path, extension or remote URL they refuse, and the file selectors return when the archive holds no such file, which the root files answer 404.
var ErrInvalidRefs = errors.New("vcs: invalid vcs references")
ErrInvalidRefs is the error ParseRefs and RefEndpoint.Parse return for a reference listing they refuse; the root files answer it as an invalid upstream result (502).
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 FileZIP ¶
FileZIP is a ZIP holding data, a selected file, at its repository-relative path filename, which a file within a tag or branch answers when ext=zip asks for one (JFrog's VCS repositories page, "download a file within a tag as a zip").
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 KeepRequest ¶
func KeepRequest(f artgen.StrictHandlerFunc, operationID string) artgen.StrictHandlerFunc
KeepRequest is the generated server's strict middleware that gives the VCS file downloads their request, whose If-None-Match, If-Modified-Since, Range and If-Range decide the answer (vcsServed.serve) and which a strict operation does not otherwise see. Every other operation passes as it was.
func PeerFileURL ¶
PeerFileURL addresses the peer's selected-file API, without ext, so that the peer answers the file itself, as a 7.x remote VCS repository answered downloadBranchFile/.../main!bazel_registry.json (RTFACT-29495). Its reference is mutable; callers must not cache the response as an immutable commit archive.
func SelectCustomFile ¶
SelectCustomFile preserves custom templates that return rootless or wrapped archives. An exact repository path takes precedence; fallback still rejects multiple matching wrapper directories.
func SelectFile ¶
SelectFile selects one file's bytes from an already validated provider archive by its repository-relative path.
func SelectWrappedFile ¶
SelectWrappedFile selects a path from providers whose archive contract adds one enclosing directory. Rootless providers must use SelectFile instead.
func ValidCommitID ¶
ValidCommitID accepts the Git SHA-1 and SHA-256 object ID forms.
func ValidExtension ¶
ValidExtension reports whether ext is an archive format the protocol serves: tar.gz or zip.
func ValidFilePath ¶
ValidFilePath reports whether path is a file a client may select from a project: relative, at most 1,024 bytes, without a trailing slash or an empty, "." or ".." segment, and with no backslash, "!", "%" or control character. "!" separates a peer's reference from its file (PeerFileURL), and "%" is refused so that no encoded form reaches the provider.
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 ValidateFile ¶
ValidateFile admits a peer's selected file of size bytes within MaxSelectedFileBytes. A 7.x peer answers the file itself, as a remote VCS repository answered downloadBranchFile/.../main!bazel_registry.json with its JSON (RTFACT-29495), so its bytes are not otherwise checked.
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) Parse ¶
func (e RefEndpoint) Parse(data []byte) ([]Ref, error)
Parse reads data, the endpoint's response, into its references: a Git ref advertisement through ParseRefs, or a peer's JSON array, in which every entry gives a valid reference name, a commit ID and an isBranch flag that matches the endpoint, each name once, within MaxRefsBytes and MaxRefs. It fails with ErrInvalidRefs.
func (RefEndpoint) Variant ¶
func (e RefEndpoint) Variant() string
Variant names the response format of the endpoint: a Git ref advertisement, or a peer's tags or branches JSON. The remote cache key includes it, so the formats never share a cached entry, and every cached listing is stored under it, so the values never change.
type VCSAPI ¶
VCSAPI is the VCS ecosystem's partial strict server: the branch, tag and ref listings and the archive and file downloads of a VCS remote repository, and the route for GitLab subgroup owners (VCSNested), over the item kit. VCS repositories are remote only, so every operation reads through the kit's remote sources, after the caller's read permission on the project and reference paths.
func (VCSAPI) DownloadFileInVcsBranchInSubgroupRepository ¶
func (s VCSAPI) DownloadFileInVcsBranchInSubgroupRepository( ctx context.Context, req artgen.DownloadFileInVcsBranchInSubgroupRepositoryRequestObject, ) (artgen.DownloadFileInVcsBranchInSubgroupRepositoryResponseObject, error)
DownloadFileInVcsBranchInSubgroupRepository serves one file of a branch (DownloadFileWithinVcsBranch) for the /archive/refs/ form. VCSNested serves the same form when the owner spans several segments.
func (VCSAPI) DownloadFileInVcsTagInSubgroupRepository ¶
func (s VCSAPI) DownloadFileInVcsTagInSubgroupRepository( ctx context.Context, req artgen.DownloadFileInVcsTagInSubgroupRepositoryRequestObject, ) (artgen.DownloadFileInVcsTagInSubgroupRepositoryResponseObject, error)
DownloadFileInVcsTagInSubgroupRepository serves one file of a tag (DownloadFileWithinVcsTag) for the /archive/refs/ form. VCSNested serves the same form when the owner spans several segments.
func (VCSAPI) DownloadFileWithinVcsBranch ¶
func (s VCSAPI) DownloadFileWithinVcsBranch( ctx context.Context, req artgen.DownloadFileWithinVcsBranchRequestObject, ) (artgen.DownloadFileWithinVcsBranchResponseObject, error)
DownloadFileWithinVcsBranch serves one file of a branch, selected as <branch>!<path>, as DownloadFileWithinVcsTag does for a tag.
func (VCSAPI) DownloadFileWithinVcsBranchAlternative ¶
func (s VCSAPI) DownloadFileWithinVcsBranchAlternative( ctx context.Context, req artgen.DownloadFileWithinVcsBranchAlternativeRequestObject, ) (artgen.DownloadFileWithinVcsBranchAlternativeResponseObject, error)
DownloadFileWithinVcsBranchAlternative serves one file of a branch (DownloadFileWithinVcsBranch) for JFrog's short form, whose one userOrg segment names both the owner and the project.
func (VCSAPI) DownloadFileWithinVcsTag ¶
func (s VCSAPI) DownloadFileWithinVcsTag( ctx context.Context, req artgen.DownloadFileWithinVcsTagRequestObject, ) (artgen.DownloadFileWithinVcsTagResponseObject, error)
DownloadFileWithinVcsTag serves one file of a tag, selected as <tag>!<path>: the file itself, or with ext=zip a ZIP that holds it (vcsFile). A path the tag does not hold answers 404.
func (VCSAPI) DownloadFileWithinVcsTagAlternative ¶
func (s VCSAPI) DownloadFileWithinVcsTagAlternative( ctx context.Context, req artgen.DownloadFileWithinVcsTagAlternativeRequestObject, ) (artgen.DownloadFileWithinVcsTagAlternativeResponseObject, error)
DownloadFileWithinVcsTagAlternative serves one file of a tag (DownloadFileWithinVcsTag) for JFrog's short form, whose one userOrg segment names both the owner and the project.
func (VCSAPI) DownloadVcsBranch ¶
func (s VCSAPI) DownloadVcsBranch( ctx context.Context, req artgen.DownloadVcsBranchRequestObject, ) (artgen.DownloadVcsBranchResponseObject, error)
DownloadVcsBranch serves the archive of a branch's commit, as DownloadVcsTag does for a tag. A properties filter selects only an already cached archive whose properties match, and never fetches one to create a match; none matching answers 404.
func (VCSAPI) DownloadVcsBranchAlternative ¶
func (s VCSAPI) DownloadVcsBranchAlternative( ctx context.Context, req artgen.DownloadVcsBranchAlternativeRequestObject, ) (artgen.DownloadVcsBranchAlternativeResponseObject, error)
DownloadVcsBranchAlternative serves a branch's archive for JFrog's short form, whose one userOrg segment names both the owner and the project.
func (VCSAPI) DownloadVcsBranchFromSubgroupRepository ¶
func (s VCSAPI) DownloadVcsBranchFromSubgroupRepository( ctx context.Context, req artgen.DownloadVcsBranchFromSubgroupRepositoryRequestObject, ) (artgen.DownloadVcsBranchFromSubgroupRepositoryResponseObject, error)
DownloadVcsBranchFromSubgroupRepository serves a branch's archive for the /archive/refs/ form, with the properties filter DownloadVcsBranch takes. VCSNested serves the same form when the owner spans several segments.
func (VCSAPI) DownloadVcsCommit ¶
func (s VCSAPI) DownloadVcsCommit( ctx context.Context, req artgen.DownloadVcsCommitRequestObject, ) (artgen.DownloadVcsCommitResponseObject, error)
DownloadVcsCommit serves the archive of a commit named by its ID, which needs no reference listing; an invalid commit ID answers 400.
func (VCSAPI) DownloadVcsRelease ¶
func (s VCSAPI) DownloadVcsRelease( ctx context.Context, req artgen.DownloadVcsReleaseRequestObject, ) (artgen.DownloadVcsReleaseResponseObject, error)
DownloadVcsRelease serves the archive of a release, which resolves as the tag of the same name (DownloadVcsTag).
func (VCSAPI) DownloadVcsTag ¶
func (s VCSAPI) DownloadVcsTag( ctx context.Context, req artgen.DownloadVcsTagRequestObject, ) (artgen.DownloadVcsTagResponseObject, error)
DownloadVcsTag serves the archive of a tag's commit in the ext format (tar.gz by default). The tag resolves to its commit through the project's reference listing, and the archive is fetched through the remote source and checked against that commit before the cache admits it. A tag the listing does not name answers 404.
func (VCSAPI) DownloadVcsTagAlternative ¶
func (s VCSAPI) DownloadVcsTagAlternative( ctx context.Context, req artgen.DownloadVcsTagAlternativeRequestObject, ) (artgen.DownloadVcsTagAlternativeResponseObject, error)
DownloadVcsTagAlternative serves a tag's archive for JFrog's short form, whose one userOrg segment names both the owner and the project.
func (VCSAPI) DownloadVcsTagFromSubgroupRepository ¶
func (s VCSAPI) DownloadVcsTagFromSubgroupRepository( ctx context.Context, req artgen.DownloadVcsTagFromSubgroupRepositoryRequestObject, ) (artgen.DownloadVcsTagFromSubgroupRepositoryResponseObject, error)
DownloadVcsTagFromSubgroupRepository serves a tag's archive for the /archive/refs/ form, with the properties filter DownloadVcsBranch takes. VCSNested serves the same form when the owner spans several segments.
func (VCSAPI) GetVcsBranches ¶
func (s VCSAPI) GetVcsBranches( ctx context.Context, req artgen.GetVcsBranchesRequestObject, ) (artgen.GetVcsBranchesResponseObject, error)
GetVcsBranches lists the project's branches that the caller may read, as JFrog's JSON array of name, commitId and isBranch true, from the same reference listing as GetVcsTags.
func (VCSAPI) GetVcsRefs ¶
func (s VCSAPI) GetVcsRefs( ctx context.Context, req artgen.GetVcsRefsRequestObject, ) (artgen.GetVcsRefsResponseObject, error)
GetVcsRefs returns the references the caller may read in git's advertisement form, one "<commit> refs/<heads|tags>/<name>" line each, as a JSON string, from the same reference listing as GetVcsTags.
func (VCSAPI) GetVcsTags ¶
func (s VCSAPI) GetVcsTags( ctx context.Context, req artgen.GetVcsTagsRequestObject, ) (artgen.GetVcsTagsResponseObject, error)
GetVcsTags lists the project's tags that the caller may read, as JFrog's JSON array of name, commitId and isBranch false. The references come from the provider's listing, read through the remote source within MaxRefsBytes and MaxRefs, and a reference the caller may not read is left out.
func (VCSAPI) VCSNested ¶
func (s VCSAPI) VCSNested(w http.ResponseWriter, r *http.Request)
VCSNested serves GET /artifactory/api/vcs/* for the path forms JFrog documents for GitLab subgroup owners: the tag, branch and ref listings and the tag and branch archive and file downloads. The generated strict router owns the ordinary one-segment forms. A separate wildcard is necessary because chi's {userOrg} captures only one segment, while a GitLab group/subgroup is represented by several segments. A form it does not own, or a nested owner on a provider other than GitLab, answers 404; an unsafe or invalid path answers 400; errors are written in the artifactory profile.