dockerworker

package
v56.0.3 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2023 License: MPL-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func JSONSchema

func JSONSchema() string

Returns json schema for the payload part of the task definition. Please note we use a go string and do not load an external file, since we want this to be *part of the compiled executable*. If this sat in another file that was loaded at runtime, it would not be burned into the build, which would be bad for the following two reasons:

  1. we could no longer distribute a single binary file that didn't require installation/extraction
  2. the payload schema is specific to the version of the code, therefore should be versioned directly with the code and *frozen on build*.

Run `generic-worker show-payload-schema` to output this schema to standard out.

Types

type Artifact

type Artifact struct {
	Expires tcclient.Time `json:"expires,omitempty"`

	Path string `json:"path"`

	// Possible values:
	//   * "file"
	//   * "directory"
	Type string `json:"type"`
}

type Capabilities

type Capabilities struct {

	// Allows devices from the host system to be attached to a task container similar to using `--device` in docker.
	Devices Devices `json:"devices,omitempty"`

	// Allows a task to run in a privileged container, similar to running docker with `--privileged`.  This only works for worker-types configured to enable it.
	//
	// Default:    false
	Privileged bool `json:"privileged" default:"false"`
}

Set of capabilities that must be enabled or made available to the task container Example: ```{ "capabilities": { "privileged": true }```

type Devices

type Devices struct {

	// Mount /dev/shm from the host in the container.
	HostSharedMemory bool `json:"hostSharedMemory,omitempty"`

	// Mount /dev/kvm from the host in the container.
	KVM bool `json:"kvm,omitempty"`

	// Audio loopback device created using snd-aloop
	LoopbackAudio bool `json:"loopbackAudio,omitempty"`

	// Video loopback device created using v4l2loopback.
	LoopbackVideo bool `json:"loopbackVideo,omitempty"`
}

Allows devices from the host system to be attached to a task container similar to using `--device` in docker.

type DockerImageArtifact

type DockerImageArtifact struct {
	Path string `json:"path"`

	TaskID string `json:"taskId"`

	// Possible values:
	//   * "task-image"
	Type string `json:"type"`
}

Image to use for the task. Images can be specified as an image tag as used by a docker registry, or as an object declaring type and name/namespace

type DockerImageName

type DockerImageName string

Image to use for the task. Images can be specified as an image tag as used by a docker registry, or as an object declaring type and name/namespace

type DockerWorkerPayload

type DockerWorkerPayload struct {

	// Artifact upload map example: “`{"public/build.tar.gz": {"path": "/home/worker/build.tar.gz", "expires": "2016-05-28T16:12:56.693817Z", "type": "file"}}“`
	Artifacts map[string]Artifact `json:"artifacts,omitempty"`

	// Caches are mounted within the docker container at the mount point specified. Example: “`{ "CACHE NAME": "/mount/path/in/container" }“`
	//
	// Map entries:
	Cache map[string]string `json:"cache,omitempty"`

	// Set of capabilities that must be enabled or made available to the task container Example: “`{ "capabilities": { "privileged": true }“`
	Capabilities Capabilities `json:"capabilities,omitempty"`

	// Example: `['/bin/bash', '-c', 'ls']`.
	//
	// Default:    []
	//
	// Array items:
	Command []string `json:"command,omitempty"`

	// Example: “`
	// {
	//   "PATH": '/borked/path'
	//   "ENV_NAME": "VALUE"
	// }
	// “`
	//
	// Map entries:
	Env map[string]string `json:"env,omitempty"`

	// Used to enable additional functionality.
	Features FeatureFlags `json:"features,omitempty"`

	// Image to use for the task.  Images can be specified as an image tag as used by a docker registry, or as an object declaring type and name/namespace
	//
	// One of:
	//   * DockerImageName
	//   * NamedDockerImage
	//   * IndexedDockerImage
	//   * DockerImageArtifact
	Image json.RawMessage `json:"image"`

	// Specifies a custom name for the livelog artifact. Note that this is also used in determining the name of the backing log artifact name. Backing log artifact name matches livelog artifact name with `_backing` appended, prior to the file extension (if present). For example, `apple/banana.log.txt` results in livelog artifact `apple/banana.log.txt` and backing log artifact `apple/banana.log_backing.txt`. Defaults to `public/logs/live.log`.
	//
	// Default:    "public/logs/live.log"
	Log string `json:"log" default:"public/logs/live.log"`

	// Maximum time the task container can run in seconds.
	//
	// Mininum:    1
	// Maximum:    86400
	MaxRunTime int64 `json:"maxRunTime"`

	// By default docker-worker will fail a task with a non-zero exit status without retrying.  This payload property allows a task owner to define certain exit statuses that will be marked as a retriable exception.
	OnExitStatus ExitStatusHandling `json:"onExitStatus,omitempty"`

	// Maintained for backward compatibility, but no longer used
	SupersederURL string `json:"supersederUrl,omitempty"`
}

`.payload` field of the queue.

type ExitStatusHandling

type ExitStatusHandling struct {

	// If the task exits with a purge caches exit status, all caches associated with the task will be purged.
	//
	// Array items:
	PurgeCaches []int64 `json:"purgeCaches,omitempty"`

	// If the task exits with a retriable exit status, the task will be marked as an exception and a new run created.
	//
	// Array items:
	Retry []int64 `json:"retry,omitempty"`
}

By default docker-worker will fail a task with a non-zero exit status without retrying. This payload property allows a task owner to define certain exit statuses that will be marked as a retriable exception.

type FeatureFlags

type FeatureFlags struct {

	// This allows you to use the Linux ptrace functionality inside the container; it is otherwise disallowed by Docker's security policy.
	//
	// Default:    false
	AllowPtrace bool `json:"allowPtrace" default:"false"`

	// Default:    true
	Artifacts bool `json:"artifacts" default:"true"`

	// Useful if live logging is not interesting but the overalllog is later on
	//
	// Default:    true
	BulkLog bool `json:"bulkLog" default:"true"`

	// Artifacts named chain-of-trust.json and chain-of-trust.json.sig should be generated which will include information for downstream tasks to build a level of trust for the artifacts produced by the task and the environment it ran in.
	//
	// Default:    false
	ChainOfTrust bool `json:"chainOfTrust" default:"false"`

	// Runs docker-in-docker and binds `/var/run/docker.sock` into the container. Doesn't allow privileged mode, capabilities or host volume mounts.
	//
	// Default:    false
	Dind bool `json:"dind" default:"false"`

	// Uploads docker images as artifacts
	//
	// Default:    false
	DockerSave bool `json:"dockerSave" default:"false"`

	// This allows you to interactively run commands inside the container and attaches you to the stdin/stdout/stderr over a websocket. Can be used for SSH-like access to docker containers.
	//
	// Default:    false
	Interactive bool `json:"interactive" default:"false"`

	// Logs are stored on the worker during the duration of tasks and available via http chunked streaming then uploaded to s3
	//
	// Default:    true
	LocalLiveLog bool `json:"localLiveLog" default:"true"`

	// The auth proxy allows making requests to taskcluster/queue and taskcluster/scheduler directly from your task with the same scopes as set in the task. This can be used to make api calls via the [client](https://github.com/taskcluster/taskcluster-client) CURL, etc... Without embedding credentials in the task.
	//
	// Default:    false
	TaskclusterProxy bool `json:"taskclusterProxy" default:"false"`
}

Used to enable additional functionality.

type IndexedDockerImage

type IndexedDockerImage struct {
	Namespace string `json:"namespace"`

	Path string `json:"path"`

	// Possible values:
	//   * "indexed-image"
	Type string `json:"type"`
}

Image to use for the task. Images can be specified as an image tag as used by a docker registry, or as an object declaring type and name/namespace

type NamedDockerImage

type NamedDockerImage struct {
	Name string `json:"name"`

	// Possible values:
	//   * "docker-image"
	Type string `json:"type"`
}

Image to use for the task. Images can be specified as an image tag as used by a docker registry, or as an object declaring type and name/namespace

Jump to

Keyboard shortcuts

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