utils

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2026 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplicationVersionExists

func ApplicationVersionExists(t *testing.T, artifactoryManager artifactory.ArtifactoryServicesManager, applicationKey, version, projectKey string) bool

ApplicationVersionExists checks if an application version exists using AppTrust API

func CleanupEntityEvidenceFromGetOutput added in v0.10.0

func CleanupEntityEvidenceFromGetOutput(t *testing.T, servicesManager artifactory.ArtifactoryServicesManager, getOutput string)

CleanupEntityEvidenceFromGetOutput deletes the entity subjects reported by a successful entity get, identified by subject.fullPath. Artifactory and the Evidence service remove the evidence attached to a subject along with it. Warnings only — cleanup must not fail the test.

func CleanupTestApplication

func CleanupTestApplication(t *testing.T, artifactoryManager artifactory.ArtifactoryServicesManager, applicationKey, projectKey string)

CleanupTestApplication deletes the application using AppTrust API Note: This also deletes all associated versions

func CleanupTestApplicationVersion

func CleanupTestApplicationVersion(t *testing.T, artifactoryManager artifactory.ArtifactoryServicesManager, applicationKey, version string)

CleanupTestApplicationVersion deletes an application version using AppTrust API This should be called before deleting the application

func CreateTestApplication

func CreateTestApplication(t *testing.T, artifactoryManager artifactory.ArtifactoryServicesManager, projectKey string) (string, string)

CreateTestApplication creates a test application in AppTrust using the AppTrust API If the application already exists (409 Conflict), it will delete it and retry

func CreateTestApplicationVersion

func CreateTestApplicationVersion(t *testing.T, artifactoryManager artifactory.ArtifactoryServicesManager, lifecycleManager *lifecycle.LifecycleServicesManager, applicationKey, projectKey string) string

CreateTestApplicationVersion creates a test application version using AppTrust API

func CreateTestArtifact

func CreateTestArtifact(t *testing.T, content string) string

func CreateTestBuildInfo

func CreateTestBuildInfo(t *testing.T, servicesManager artifactory.ArtifactoryServicesManager, project string) (string, string)

CreateTestBuildInfo creates a test build info in Artifactory with artifacts and publishes it Returns build name and build number

func CreateTestPackage

func CreateTestPackage(t *testing.T, servicesManager artifactory.ArtifactoryServicesManager, packageType string) (string, string, string)

CreateTestPackage creates a test package in Artifactory Returns package name, version, and repo name

func CreateTestReleaseBundle

func CreateTestReleaseBundle(t *testing.T, servicesManager artifactory.ArtifactoryServicesManager, lifecycleManager *lifecycle.LifecycleServicesManager, project string, opts ...ReleaseBundleOption) (string, string)

CreateTestReleaseBundle creates a test release bundle from a build Returns release bundle name and version

func CreateTestRepository

func CreateTestRepository(t *testing.T, servicesManager artifactory.ArtifactoryServicesManager, packageType string) string

func CreateTestRepositoryWithName

func CreateTestRepositoryWithName(t *testing.T, servicesManager artifactory.ArtifactoryServicesManager, packageType string, opts ...RepositoryOption) string

CreateTestRepositoryWithName is a convenience function that returns the repository name

func CreateTestRepositoryWithProject

func CreateTestRepositoryWithProject(t *testing.T, servicesManager artifactory.ArtifactoryServicesManager, packageType, project string, opts ...RepositoryOption) string

func DefaultEntityRepoKey added in v0.10.0

func DefaultEntityRepoKey(entityType string) string

DefaultEntityRepoKey returns the default-scope entity repository key: {entityType}-entity.

func DeleteTestBuildInfo

func DeleteTestBuildInfo(t *testing.T, buildName string)

DeleteTestBuildInfo deletes a test build info from Artifactory This is used for test cleanup Note: Uses max-days=0 to delete all builds matching the build name

func DeleteTrustedKey

func DeleteTrustedKey(servicesManager artifactory.ArtifactoryServicesManager, keyAlias string) error

DeleteTrustedKey deletes a trusted key from Artifactory using the REST API keyAlias: the alias of the key to delete (e.g., "e2e-shared-key-1762361018")

func EnsureEntityRepository added in v0.10.0

func EnsureEntityRepository(t *testing.T, servicesManager artifactory.ArtifactoryServicesManager, repoKey, projectKey string)

EnsureEntityRepository creates a generic local repository for entity evidence if it does not already exist. Fixed-name entity repos are left in place across runs; they are not cleaned up.

Entity repo keys are fixed, so two suites running against the same platform compete over them. Artifactory rejects the loser of a concurrent creation with 409 Conflict, which is a success for our purposes as long as the repository ends up existing.

func ProjectEntityRepoKey added in v0.10.0

func ProjectEntityRepoKey(projectKey, entityType string) string

ProjectEntityRepoKey returns the project-scope entity repository key: {projectKey}-{entityType}-entity.

func PromoteApplicationVersion

func PromoteApplicationVersion(t *testing.T, artifactoryManager artifactory.ArtifactoryServicesManager, applicationKey, version, projectKey, targetStage string) error

PromoteApplicationVersion promotes an application version using AppTrust API

func UploadArtifact

func UploadArtifact(servicesManager artifactory.ArtifactoryServicesManager, sourcePath, targetPath string) error

UploadArtifact uploads a file to Artifactory using the services manager sourcePath: local file path targetPath: full repository path (e.g., "repo-name/path/to/file.txt")

Types

type ApplicationResponse

type ApplicationResponse struct {
	ApplicationName string `json:"application_name"`
	ApplicationKey  string `json:"application_key"`
	ProjectKey      string `json:"project_key"`
}

ApplicationResponse represents the response when creating an application

type ApplicationVersionArtifact

type ApplicationVersionArtifact struct {
	Path   string `json:"path"`
	Sha256 string `json:"sha256"`
}

ApplicationVersionArtifact represents an artifact source

type ApplicationVersionResponse

type ApplicationVersionResponse struct {
	ApplicationKey string `json:"application_key"`
	Version        string `json:"version"`
}

ApplicationVersionResponse represents the response when creating an application version

type ApplicationVersionSources

type ApplicationVersionSources struct {
	Artifacts []ApplicationVersionArtifact `json:"artifacts,omitempty"`
}

ApplicationVersionSources represents the sources for an application version

type CreateApplicationRequest

type CreateApplicationRequest struct {
	ApplicationName string `json:"application_name"`
	ApplicationKey  string `json:"application_key"`
	ProjectKey      string `json:"project_key"`
	Description     string `json:"description,omitempty"`
}

CreateApplicationRequest represents the request to create an application

type CreateApplicationVersionRequest

type CreateApplicationVersionRequest struct {
	Version string                     `json:"version"`
	Sources *ApplicationVersionSources `json:"sources"`
}

CreateApplicationVersionRequest represents the request to create an application version

type PromoteApplicationVersionRequest

type PromoteApplicationVersionRequest struct {
	TargetStage string `json:"target_stage"`
	Comment     string `json:"comment,omitempty"`
}

PromoteApplicationVersionRequest represents the request to promote an application version

type ReleaseBundleOption

type ReleaseBundleOption func(*releaseBundleConfig)

ReleaseBundleOption defines options for release bundle creation

func WithReleaseBundleName

func WithReleaseBundleName(name string) ReleaseBundleOption

WithReleaseBundleName sets a custom release bundle name

func WithReleaseBundleVersion

func WithReleaseBundleVersion(version string) ReleaseBundleOption

WithReleaseBundleVersion sets a custom release bundle version

type RepositoryOption

type RepositoryOption func(*repositoryConfig)

func WithRepoKey

func WithRepoKey(key string) RepositoryOption

type TrustedKey

type TrustedKey struct {
	Kid   string `json:"kid"`
	Alias string `json:"alias"`
}

TrustedKey represents a trusted key from Artifactory

type TrustedKeysResponse

type TrustedKeysResponse struct {
	Keys []TrustedKey `json:"keys"`
}

TrustedKeysResponse represents the response from listing trusted keys

Jump to

Keyboard shortcuts

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