Documentation ¶
Overview ¶
Package artifact models links to files created during task execution.
Index ¶
- Constants
- Variables
- func ByBuildId(id string) db.Q
- func BySecret(secret string) db.Q
- func ByTaskId(id string) db.Q
- func ByTaskIdAndExecution(id string, execution int) db.Q
- func ByTaskIdWithoutExecution(id string) db.Q
- func ByTaskIds(taskIds []string) db.Q
- func ByTaskIdsAndExecutions(tasks []TaskIDAndExecution) db.Q
- func RotateSecrets(toReplace, replacement string, dryRun bool) (map[TaskIDAndExecution][]string, error)
- type Entry
- type File
- type Params
- type TaskIDAndExecution
Constants ¶
const ( // strings for setting visibility Public = "public" Private = "private" None = "none" Signed = "signed" )
const Collection = "artifact_files"
Variables ¶
var ( // BSON fields for artifact file structs TaskIdKey = bsonutil.MustHaveTag(Entry{}, "TaskId") TaskNameKey = bsonutil.MustHaveTag(Entry{}, "TaskDisplayName") BuildIdKey = bsonutil.MustHaveTag(Entry{}, "BuildId") FilesKey = bsonutil.MustHaveTag(Entry{}, "Files") ExecutionKey = bsonutil.MustHaveTag(Entry{}, "Execution") CreateTimeKey = bsonutil.MustHaveTag(Entry{}, "CreateTime") NameKey = bsonutil.MustHaveTag(File{}, "Name") LinkKey = bsonutil.MustHaveTag(File{}, "Link") ContentTypeKey = bsonutil.MustHaveTag(File{}, "ContentType") AwsSecretKey = bsonutil.MustHaveTag(File{}, "AwsSecret") )
Functions ¶
func ByTaskIdAndExecution ¶
ByTaskIdAndExecution returns a query for entries with the given Task Id and execution number
func ByTaskIdWithoutExecution ¶
ByTaskIdWithoutExecution returns a query for entries with the given Task Id that do not have an execution number associated with them
func ByTaskIdsAndExecutions ¶
func ByTaskIdsAndExecutions(tasks []TaskIDAndExecution) db.Q
func RotateSecrets ¶
func RotateSecrets(toReplace, replacement string, dryRun bool) (map[TaskIDAndExecution][]string, error)
Types ¶
type Entry ¶
type Entry struct { TaskId string `json:"task" bson:"task"` TaskDisplayName string `json:"task_name" bson:"task_name"` BuildId string `json:"build" bson:"build"` Files []File `json:"files" bson:"files"` Execution int `json:"execution" bson:"execution"` CreateTime time.Time `json:"create_time" bson:"create_time"` }
Entry stores groups of names and links (not content!) for files uploaded to the api server by a running agent. These links could be for build or task-relevant files (things like extra results, test coverage, etc.)
type File ¶
type File struct { // Name is a human-readable name for the file being linked, e.g. "Coverage Report" Name string `json:"name" bson:"name"` // Link is the link to the file, e.g. "http://fileserver/coverage.html" Link string `json:"link" bson:"link"` // Visibility determines who can see the file in the UI Visibility string `json:"visibility" bson:"visibility"` // When true, these artifacts are excluded from reproduction IgnoreForFetch bool `bson:"fetch_ignore,omitempty" json:"ignore_for_fetch"` // AwsKey is the key with which the file was uploaded to S3. AwsKey string `json:"aws_key,omitempty" bson:"aws_key,omitempty"` // AwsSecret is the secret with which the file was uploaded to S3. AwsSecret string `json:"aws_secret,omitempty" bson:"aws_secret,omitempty"` // Bucket is the aws bucket in which the file is stored. Bucket string `json:"bucket,omitempty" bson:"bucket,omitempty"` // FileKey is the path to the file in the bucket. FileKey string `json:"filekey,omitempty" bson:"filekey,omitempty"` // ContentType is the content type of the file. ContentType string `json:"content_type" bson:"content_type"` }
File is a pairing of name and link for easy storage/display
func EscapeFiles ¶
EscapeFiles escapes the base of the file link to avoid issues opening links with special characters in the UI. For example, "url.com/something/file#1.tar.gz" will be escaped to "url.com/something/file%231.tar.gz
func GetAllArtifacts ¶
func GetAllArtifacts(tasks []TaskIDAndExecution) ([]File, error)
type Params ¶
Params stores file entries as key-value pairs, for easy parameter parsing.
Key = Human-readable name for file Value = link for the file