git

package
v0.0.0-...-62e82e8 Latest Latest
Warning

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

Go to latest
Published: May 19, 2025 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const GitImage = "alpine/git"

Variables

This section is empty.

Functions

func CloneContainer

func CloneContainer(d *dagger.Client, opts *GitCloneOptions) (*dagger.Container, error)

CloneContainer returns the container definition that uses git clone to clone the 'git url' and checks out the ref provided at 'ref'. Multiple refs can be provided via a space character (' '). If multiple refs are provided, then the container will attempt to checkout each ref at a time, stopping at the first one that is successful. This can be useful in PRs which have a coupled association with another codebase. A practical example (and why this exists): "${pr_source_branch} ${pr_target_branch} ${main}" will first attempt to checkout the PR source branch, then the PR target branch, then "main"; whichever is successul first.

func CloneWithGitHubToken

func CloneWithGitHubToken(d *dagger.Client, token, url, ref string) (*dagger.Directory, error)

func LookupGitHubToken

func LookupGitHubToken(ctx context.Context) (string, error)

LookupGitHubToken will try to find a GitHub access token that can then be used for various API calls but also cloning of private repositories.

Types

type GitCloneOptions

type GitCloneOptions struct {
	Ref string
	URL string

	SSHKeyPath string

	// Username is injected into the final URL used for cloning
	Username string
	// Password is injected into the final URL used for cloning
	Password string
}

Jump to

Keyboard shortcuts

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