pathutil

package
v0.5.5 Latest Latest
Warning

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

Go to latest
Published: May 18, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// PROJECT represents project in command line arguments for push, pull and yank commands.
	PROJECT = "project"
	// WORKFLOW represents workflow in command line arguments for push, pull and yank commands.
	WORKFLOW = "workflow"
	// JOB represents job in command line arguments for push, pull and yank commands.
	JOB = "job"
	// ExpirePrefix is where object expires are stored in the same bucket.
	ExpirePrefix = "var/expires-in/"
)

Variables

View Source
var (

	// CategoryEnv returns environment variable names for project ID, workflow ID and job ID.
	CategoryEnv = map[string]string{
		PROJECT:  "SEMAPHORE_PROJECT_ID",
		WORKFLOW: "SEMAPHORE_WORKFLOW_ID",
		JOB:      "SEMAPHORE_JOB_ID",
	}
)

Functions

func InitPathID

func InitPathID(category, defVal string) error

InitPathID initiates path category ID. The default is an empty string, in that case the ID is read from environment variable. Otherwise it comes from command-line argument --job-id or --workflow-id.

func PathFromSource

func PathFromSource(dstFilepath, srcFilepath string) string

PathFromSource returns a path where destination filename can be empty. If it's empty, the name is gained from the source filename.

func PrefixedPath

func PrefixedPath(filepath string) string

PrefixedPath returns paths for Google Cloud Storage. For project files, it returns like: artifacts/projects/<SEMAPHORE_PROJECT_ID>/x.zip For workflow files, it returns like: artifacts/workflows/<SEMAPHORE_WORKFLOW_ID>/x.zip For job files, it returns like: artifacts/jobs/<SEMAPHORE_JOB_ID>/x.zip

func PrefixedPathFromSource

func PrefixedPathFromSource(dstFilepath, srcFilepath string) string

PrefixedPathFromSource returns a path for Google Cloud Storage, where destination filename can be empty. In this case filename is gained from source filename, eg. uploading /from/this/path/x.zip with empty --destination to the project will return artifacts/projects/<SEMAPHORE_PROJECT_ID>/x.zip, but with --destination=y.zip will result in artifacts/projects/<SEMAPHORE_PROJECT_ID>/y.zip .

func ToRelative

func ToRelative(filepath string) string

ToRelative removes all ./, ../ etc prefixes from the string.

Types

This section is empty.

Jump to

Keyboard shortcuts

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