harness

package
v1.0.13 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ErrorMessageKey is the key used to retrieve or store the error message content.
	ErrorMessageKey = "ERROR_MESSAGE"

	// ErrorCodeKey is the key used to identify the specific error code associated with an error.
	ErrorCodeKey = "ERROR_CODE"

	// ErrorCategoryKey is the key used to classify the category of the error, which can help in grouping similar types of errors.
	ErrorCategoryKey = "ERROR_CATEGORY"

	// MetadataFile is the key for the file that stores metadata associated with an error, such as details about the error's source or context.
	MetadataFile = "ERROR_METADATA_FILE"

	// DroneOutputFile is the key for the file where outputs can be exported and utilized in the subsequent steps in Harness CI pipeline.
	DroneOutputFile = "DRONE_OUTPUT"

	// HarnessOutputSecretFile is the key for the file where secrets can be exported and utilized in the subsequent steps in Harness CI pipeline.
	HarnessOutputSecretFile = "HARNESS_OUTPUT_SECRET_FILE"
)

Variables

This section is empty.

Functions

func DeleteOutput added in v1.0.6

func DeleteOutput(name string) error

DeleteOutput removes an output from the file entirely.

func DeleteSecret

func DeleteSecret(name string) error

DeleteSecret removes a secret from the file entirely.

func FormatKeyValue added in v1.0.7

func FormatKeyValue(key, value, ext string) string

FormatKeyValue handles formatting for .env and .out files.

func ParseKeyValue added in v1.0.7

func ParseKeyValue(line, ext string) (string, string)

ParseKeyValue parses a key-value pair from a string and returns the key and value.

func ReadLines added in v1.0.7

func ReadLines(filename string) ([]string, error)

ReadLines reads lines from a file and returns them as a slice of strings.

func SetErrorMetadata added in v1.0.7

func SetErrorMetadata(message, code, category string) error

SetErrorMetadata sets the error message, error code, and error category, writing them to the CI_ERROR_METADATA file

func SetOutput added in v1.0.6

func SetOutput(name, value string) error

SetOutput sets a new secret by adding it to the DRONE_OUTPUT file

func SetSecret

func SetSecret(name, value string) error

SetSecret sets a new secret by adding it to the HARNESS_OUTPUT_SECRET_FILE file

func UpdateOrRemoveKeyValue added in v1.0.7

func UpdateOrRemoveKeyValue(envVar, key, newValue string, deleteKey bool) error

UpdateOrRemoveKeyValue updates or deletes a key-value pair in the specified file.

func UpdateOutput added in v1.0.6

func UpdateOutput(name, value string) error

UpdateOutput overwrites the value of an existing output.

func UpdateSecret

func UpdateSecret(name, value string) error

UpdateSecret overwrites the value of an existing secret.

func WriteLines added in v1.0.7

func WriteLines(filename string, lines []string) error

WriteLines writes a slice of strings to a file, each string being written to a new line.

Types

This section is empty.

Jump to

Keyboard shortcuts

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