daggers

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package daggers provides a set of utilities to make it easier to work with dagger.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitConfig

func InitConfig[T any](modifiers ...Option[T]) (T, error)

InitConfig initialize new config using env variables and given options.

Types

type Logger

type Logger struct {
	// contains filtered or unexported fields
}

Logger is a simple interface wrapper around the standard io.Writer interface.

func NewLogger

func NewLogger(verbose bool) (Logger, error)

NewLogger returns simple logger that writes logs to a log file under default output directory(.daggers). If verbose is true, logs will be shown in os.Stdout at the sametime.

func (Logger) Close

func (l Logger) Close() error

Close closes the underlying writer.

func (Logger) Write

func (l Logger) Write(p []byte) (n int, err error)

Write writes the given bytes to the underlying writer.

type Option

type Option[T any] func(T) T

Option represents an option that can be applied to a config.

func WithVerbose

func WithVerbose(verbose bool) Option[runtimeConfig]

WithVerbose sets the verbose option for the runtime config.

func WithWorkdirFn

func WithWorkdirFn(workdirFn func(client *dagger.Client) *dagger.Directory) Option[runtimeConfig]

WithWorkdirFn sets the workdir function for getting workdir information.

func WithWorkdirFromHostPath

func WithWorkdirFromHostPath(workdir string, opts ...dagger.HostDirectoryOpts) Option[runtimeConfig]

WithWorkdirFromHostPath sets the workdir option from host path for the runtime config.

type Runtime

type Runtime struct {
	// contains filtered or unexported fields
}

Runtime defines the runtime for a dagger.

func NewRuntime

func NewRuntime(ctx context.Context, opts ...Option[runtimeConfig]) (*Runtime, error)

NewRuntime returns a new runtime with given options.

func (*Runtime) Client

func (r *Runtime) Client() *dagger.Client

Client returns the dagger client.

func (*Runtime) Close

func (r *Runtime) Close() error

Close closes the dagger client.

func (*Runtime) IsCI

func (r *Runtime) IsCI() bool

IsCI returns true if the runtime is running in a CI environment. This check rely on CI environment variable set by GitHub Actions. If the CI environment variable is not set, it returns false.

https://docs.github.com/en/actions/learn-github-actions/environment-variables#default-environment-variables

func (*Runtime) Workdir

func (r *Runtime) Workdir() *dagger.Directory

Workdir returns the workdir directory.

Directories

Path Synopsis
Package containers provides a set of utilities to create and run containers.
Package containers provides a set of utilities to create and run containers.

Jump to

Keyboard shortcuts

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