d2g

package
v84.2.1 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2025 License: MPL-2.0 Imports: 14 Imported by: 0

README

d2g

d2g is a go library for converting legacy Docker Worker tasks into native Generic Worker tasks.

This library is used internally by Generic Worker, in order to run tasks that were originally intended for Docker Worker. On detecting that a claimed task has a Docker Worker payload, Generic Worker will first convert it to its own native format before validating and executing the task.

For users wishing to convert Docker Worker tasks to Generic Worker tasks at source, please see the taskcluster d2g cli subcommand.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertScopes

func ConvertScopes(
	dwScopes []string,
	dwPayload *dockerworker.DockerWorkerPayload,
	taskQueueID string,
	scopeExpander scopes.ScopeExpander,
) (gwScopes []string, err error)

ConvertScopes takes a slice of Docker Worker task scopes and returns a slice of equivalent Generic Worker scopes. These scopes should be used together with a converted Docker Worker task payload (see d2g.Convert function) to run Docker Worker tasks under Generic Worker.

func ConvertTaskDefinition

func ConvertTaskDefinition(
	dwTaskDef json.RawMessage,
	config map[string]any,
	scopeExpander scopes.ScopeExpander,
	directoryReader func(string) ([]os.DirEntry, error),
) (json.RawMessage, error)

Types

type ConversionInfo

type ConversionInfo struct {
	ContainerName string
	CopyArtifacts []CopyArtifact
	Image         Image
}

func ConvertPayload

func ConvertPayload(
	dwPayload *dockerworker.DockerWorkerPayload,
	config map[string]any,
	directoryReader func(string) ([]os.DirEntry, error),
) (gwPayload *genericworker.GenericWorkerPayload, conversionInfo ConversionInfo, err error)

ConvertPayload transforms a Docker Worker task payload into an equivalent Generic Worker Multiuser POSIX task payload. The resulting Generic Worker payload is a BASH script which uses Docker (by default) to contain the Docker Worker payload. Since scopes fall outside of the payload in a task definition, scopes need to be converted separately (see d2g.ConvertScopes function).

type CopyArtifact

type CopyArtifact struct {
	Name     string
	SrcPath  string
	DestPath string
}

type DockerImageArtifact

type DockerImageArtifact dockerworker.DockerImageArtifact

func (*DockerImageArtifact) FileMounts

func (dia *DockerImageArtifact) FileMounts() ([]genericworker.FileMount, error)

func (*DockerImageArtifact) ImageLoader

func (dia *DockerImageArtifact) ImageLoader() ImageLoader

func (*DockerImageArtifact) String

func (dia *DockerImageArtifact) String() string

type DockerImageName

type DockerImageName string

func (*DockerImageName) FileMounts

func (din *DockerImageName) FileMounts() ([]genericworker.FileMount, error)

func (*DockerImageName) ImageLoader

func (din *DockerImageName) ImageLoader() ImageLoader

func (*DockerImageName) String

func (din *DockerImageName) String() string

type FileImageLoader

type FileImageLoader struct {
	Image Image
}

func (*FileImageLoader) ChainOfTrustCommand

func (fil *FileImageLoader) ChainOfTrustCommand() string

func (*FileImageLoader) LoadCommand

func (fil *FileImageLoader) LoadCommand() string

type Image

type Image interface {
	FileMounts() ([]genericworker.FileMount, error)
	String() string
	ImageLoader() ImageLoader
}

type ImageLoader

type ImageLoader interface {
	LoadCommand() string
	ChainOfTrustCommand() string
}

type IndexedDockerImage

type IndexedDockerImage dockerworker.IndexedDockerImage

func (*IndexedDockerImage) FileMounts

func (idi *IndexedDockerImage) FileMounts() ([]genericworker.FileMount, error)

func (*IndexedDockerImage) ImageLoader

func (idi *IndexedDockerImage) ImageLoader() ImageLoader

func (*IndexedDockerImage) String

func (idi *IndexedDockerImage) String() string

type NamedDockerImage

type NamedDockerImage dockerworker.NamedDockerImage

func (*NamedDockerImage) FileMounts

func (ndi *NamedDockerImage) FileMounts() ([]genericworker.FileMount, error)

func (*NamedDockerImage) ImageLoader

func (ndi *NamedDockerImage) ImageLoader() ImageLoader

func (*NamedDockerImage) String

func (ndi *NamedDockerImage) String() string

type RegistryImageLoader

type RegistryImageLoader struct {
	Image Image
}

func (*RegistryImageLoader) ChainOfTrustCommand

func (ril *RegistryImageLoader) ChainOfTrustCommand() string

func (*RegistryImageLoader) LoadCommand

func (ril *RegistryImageLoader) LoadCommand() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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