jobssh

package
v1.18.0 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2026 License: MIT Imports: 10 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package jobssh finds the ssh command for jobs rerun with SSH enabled.

A job rerun with SSH gets an "Enable SSH" step (v3 step type enable_ssh) once it starts. The step runs in the background for the life of the job, and its output names the command to connect, e.g.

You can now SSH into this job if your SSH public key is added:
    $ ssh b0023961-07d3-4943-8342-a052e5e9307a-0@ssh.circleci.com

Older jobs print the host and port form instead (ssh -p 54782 3.94.12.34); both are read the same way. A parallel job has one such step, and one command, per execution.

Index

Constants

View Source
const StepType = "enable_ssh"

StepType is the v3 step type of the step that enables SSH on a job.

Variables

This section is empty.

Functions

This section is empty.

Types

type Conn

type Conn struct {
	Job        string    // job name
	JobID      uuid.UUID // the rerun job's ID
	Execution  int       // parallel execution index
	Executions int       // number of parallel executions the job has
	Command    string    // the ssh command, as the job printed it
	User       string    // user part of the destination, if any
	Host       string
	Port       int // 0 when the command names no port
}

Conn is how to connect to one execution of a job.

func ParseOutput

func ParseOutput(output []byte) (c Conn, ok bool)

ParseOutput reads the ssh command from an SSH step's output. ok is false when the output does not hold one yet.

func Wait

func Wait(ctx context.Context, client *apiclient.Client, workflowID uuid.UUID, names []string, opts Options) ([]Conn, error)

Wait polls the rerun workflow until each named job prints its ssh command, and returns the commands in the order of names, then execution. Commands found before an error are returned with it.

type NoSSHError

type NoSSHError struct {
	Job   string
	JobID uuid.UUID
}

NoSSHError means a job ended without printing an ssh command, so there is nothing to connect to.

func (*NoSSHError) Error

func (e *NoSSHError) Error() string

type Options

type Options struct {
	// Timeout bounds the whole wait.
	Timeout time.Duration
	// Interval is the time between polls.
	Interval time.Duration
	// OnStatus is called when what Wait is waiting for changes, with a short
	// description such as "Waiting for build to start".
	OnStatus func(string)
	// OnConn is called for each command as soon as it is found.
	OnConn func(Conn)
}

Options control Wait.

type TimeoutError

type TimeoutError struct {
	Timeout time.Duration
	Pending []string
}

TimeoutError means the wait ran out of time. Pending names the jobs that still had no command.

func (*TimeoutError) Error

func (e *TimeoutError) Error() string

Jump to

Keyboard shortcuts

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