nexus

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TestPermanentRepository = "ods-permanent-artifacts"
	TestTemporaryRepository = "ods-temporary-artifacts"
)

Variables

This section is empty.

Functions

func ArtifactGroup

func ArtifactGroup(project, repository, gitCommitSHA, subdir string) string

ArtifactGroup returns the group in which aritfacts are stored for the given ODS pipeline context and the subdir.

func ArtifactGroupBase

func ArtifactGroupBase(project, repository, gitCommitSHA string) string

ArtifactGroupBase returns the group base in which aritfacts are stored for the given ODS pipeline context.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client represents a Nexus client, wrapping github.com/sonatype-nexus-community/gonexus/rm.RM

func NewClient

func NewClient(clientConfig *ClientConfig) (*Client, error)

NewClient initializes a Nexus client.

func (*Client) Download

func (c *Client) Download(url, outfile string) (int64, error)

Download requests given url and writes the output into outfile.

func (*Client) Search

func (c *Client) Search(repository, group string) ([]string, error)

Search gets URLs of assets in given repository group.

func (*Client) URL

func (c *Client) URL() string

URL returns the Nexus instance URL targeted by this client.

func (*Client) Upload

func (c *Client) Upload(repository, group, file string) (string, error)

Upload a file to a repository group. The filename used inside the group is the last element of given file.

func (*Client) Username

func (c *Client) Username() string

Username returns the username used by this client.

type ClientConfig

type ClientConfig struct {
	// Nexus username.
	Username string
	// Password of Nexus user.
	Password string
	// URL of Nexus instance.
	BaseURL string
	// Logger is the logger to send logging messages to.
	Logger logging.LeveledLoggerInterface
	// Timeout of HTTP client used to download assets.
	Timeout time.Duration
	// HTTP client used to download assets.
	HTTPClient *http.Client
	// Certificate to use for HTTP communication.
	CertFile string
}

ClientConfig configures a Nexus client.

type ClientInterface

type ClientInterface interface {
	Download(url, outfile string) (int64, error)
	Search(repository, group string) ([]string, error)
	Upload(repository, group, file string) (string, error)
}

type TestArtifact

type TestArtifact struct {
	Path    string
	Content []byte
}

type TestClient

type TestClient struct {
	// Artifacts contains Artifacts per repository
	Artifacts map[string][]TestArtifact
}

func (*TestClient) Download

func (c *TestClient) Download(url, outfile string) (int64, error)

Download writes a dummy string into outfile.

func (*TestClient) Search

func (c *TestClient) Search(repository, group string) ([]string, error)

Search responds with pre-registered URLs for repository. group is ignored.

func (*TestClient) Upload

func (c *TestClient) Upload(repository, group, file string) (string, error)

Upload is not needed for the test cases below.

Jump to

Keyboard shortcuts

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