runner

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	JobResultSuccess   = "success"
	JobResultFailure   = "failure"
	JobResultCancelled = "cancelled"
	JobResultUnknown   = "unknown"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client added in v0.4.0

type Client interface {
	PutDeletionTime(ctx context.Context, ip string, tm time.Time) error
	GetStatus(ctx context.Context, ip string) (*Status, error)
}

func NewClient added in v0.4.0

func NewClient() Client

type DeletionTimePayload added in v0.4.0

type DeletionTimePayload struct {
	DeletionTime time.Time `json:"deletion_time"`
}

type FakeClient added in v0.4.0

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

FakeClient is a fake client

func NewFakeClient added in v0.4.0

func NewFakeClient() *FakeClient

func (*FakeClient) GetStatus added in v0.4.0

func (c *FakeClient) GetStatus(ctx context.Context, ip string) (*Status, error)

func (*FakeClient) PutDeletionTime added in v0.4.0

func (c *FakeClient) PutDeletionTime(ctx context.Context, ip string, tm time.Time) error

func (*FakeClient) SetStatus added in v0.4.0

func (c *FakeClient) SetStatus(ip string, st *Status)

type JobInfo added in v0.4.0

type JobInfo struct {
	Actor          string `json:"actor,omitempty"`
	GitRef         string `json:"git_ref,omitempty"`
	JobID          string `json:"job_id,omitempty"`
	PullRequestNum int    `json:"pull_request_number,omitempty"`
	Repository     string `json:"repository,omitempty"`
	RunID          int    `json:"run_id,omitempty"`
	RunNumber      int    `json:"run_number,omitempty"`
	WorkflowName   string `json:"workflow_name,omitempty"`
}

JobInfo represents information about a CI job.

func GetJobInfo added in v0.4.0

func GetJobInfo() (*JobInfo, error)

GetJobInfo reads environment variables and creates JobInfo.

func GetJobInfoFromFile added in v0.4.0

func GetJobInfoFromFile(file string) (*JobInfo, error)

func (*JobInfo) BranchTagURL added in v0.4.0

func (info *JobInfo) BranchTagURL() string

func (*JobInfo) PullRequestURL added in v0.4.0

func (info *JobInfo) PullRequestURL() string

func (*JobInfo) RepositoryURL added in v0.4.0

func (info *JobInfo) RepositoryURL() string

func (*JobInfo) WorkflowURL added in v0.4.0

func (info *JobInfo) WorkflowURL() string

type Listener

type Listener interface {
	// contains filtered or unexported methods
}

func NewListener

func NewListener(runnerDir string) Listener

type Option

type Option struct {
	SetupCommand []string `json:"setup_command,omitempty"`
}

Omittable options

type Runner

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

func NewRunner

func NewRunner(listener Listener, listenAddr, runnerDir, workDir, varDir string) (*Runner, error)

func (*Runner) Run

func (r *Runner) Run(ctx context.Context) error

type Status added in v0.4.0

type Status struct {
	State        string     `json:"state,omitempty"`
	Result       string     `json:"result,omitempty"`
	FinishedAt   *time.Time `json:"finished_at,omitempty"`
	DeletionTime *time.Time `json:"deletion_time,omitempty"`
	Extend       *bool      `json:"extend,omitempty"`
	JobInfo      *JobInfo   `json:"job_info,omitempty"`
	SlackChannel string     `json:"slack_channel,omitempty"`
}

Jump to

Keyboard shortcuts

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