jfrog

package
v1.22.0 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrorParamEmpty liberr.CodeError = iota + libart.MinArtifactJfrog
	ErrorURLParse
	ErrorRequestInit
	ErrorRequestDo
	ErrorRequestResponse
	ErrorRequestResponseBodyEmpty
	ErrorRequestResponseBodyDecode
	ErrorArtifactoryNotFound
	ErrorArtifactoryDownload
	ErrorDestinationSize
)

Variables

This section is empty.

Functions

func NewArtifactory

func NewArtifactory(ctx context.Context, Do func(req *http.Request) (*http.Response, error), uri, releaseRegex string, releaseGroup int, reposPath ...string) (libart.Client, error)

NewArtifactory creates a JFrog Artifactory artifact client using the Storage API. Version extraction is performed via regex matching on artifact file names.

Parameters:

  • ctx: Request context for API calls
  • Do: HTTP client Do function (e.g., http.Client.Do) for custom authentication/transport
  • uri: Artifactory base URL (e.g., "https://artifactory.example.com")
  • releaseRegex: Regex pattern to match artifacts and extract versions (must have at least one capture group)
  • releaseGroup: Capture group index (1-based) that contains the version string
  • reposPath: Repository path segments (e.g., "repo-name", "path", "to", "artifacts")

The regex pattern must include a capture group for version extraction:

  • Pattern: `myapp-(\d+\.\d+\.\d+)\.tar\.gz` extracts "1.2.3" from "myapp-1.2.3.tar.gz"
  • Pattern: `release-v(\d+\.\d+\.\d+)-linux\.zip` extracts "2.1.0" from "release-v2.1.0-linux.zip"

Returns a client implementing the artifact.Client interface for:

  • Listing releases by scanning repository files
  • Version extraction via regex
  • Direct artifact downloads

Example:

ctx := context.Background()
httpClient := &http.Client{}
client, err := NewArtifactory(
    ctx,
    httpClient.Do,
    "https://artifactory.example.com",
    `myapp-(\d+\.\d+\.\d+)\.tar\.gz`,  // Regex with version capture
    1,                                   // Group 1 contains version
    "releases", "myapp",                 // Path: releases/myapp/
)

Types

type Checksum added in v1.19.0

type Checksum struct {
	Md5    string // MD5 hash
	Sha1   string // SHA-1 hash
	Sha256 string // SHA-256 hash
}

Checksum contains file integrity checksums returned by Artifactory.

type ChildStore added in v1.19.0

type ChildStore struct {
	Uri    string // Relative URI
	Folder bool   // True if item is a folder
}

ChildStore represents a child item (file or folder) in a repository listing.

type RepoStore added in v1.19.0

type RepoStore struct {
	Uri          string       // API URI
	Repo         string       // Repository name
	Path         string       // Folder path
	Created      time.Time    // Creation timestamp
	CreatedBy    string       // Creator username
	LastModified time.Time    // Last modification timestamp
	ModifiedBy   string       // Last modifier username
	LastUpdated  time.Time    // Last update timestamp
	Children     []ChildStore // Child items
}

RepoStore represents a repository or folder listing in Artifactory. This structure is returned by the Storage API for directory listings.

type Storage added in v1.19.0

type Storage struct {
	Uri          string    // API URI
	DownloadUri  string    // Download URL
	Repo         string    // Repository name
	Path         string    // File path
	RemoteUrl    string    // Remote URL (if proxy)
	Created      time.Time // Creation timestamp
	CreatedBy    string    // Creator username
	LastModified time.Time // Last modification timestamp
	ModifiedBy   string    // Last modifier username
	LastUpdated  time.Time // Last update timestamp
	Size         string    // Size as string

	MimeType          string   // MIME type
	Checksums         Checksum // File checksums
	OriginalChecksums Checksum // Original checksums (if proxy)
	// contains filtered or unexported fields
}

Storage represents a file object in Artifactory with its metadata. This structure is returned by the Storage API for individual files.

Jump to

Keyboard shortcuts

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