githubaction

package
v0.93.0 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2025 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ACTIONKINDDEFAULT is the default kind of action
	// such as "actions/checkout@v2"
	ACTIONKINDDEFAULT = "default"
	// ACTIONKINDLOCAL is the kind of action that is a local path action
	// such as "./actions/checkout"
	ACTIONKINDLOCAL = "local"
	// ACTIONKINDDOCKER is the kind of action that is a docker image
	// such as "docker://alpine:latest"
	ACTIONKINDDOCKER = "docker"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Container added in v0.93.0

type Container struct {
	Image string `yaml:"image,omitempty"`
}

type GitHubAction

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

GitHubAction holds all information needed to generate GitHubAction manifest.

func New

func New(spec interface{}, rootDir, scmID string) (GitHubAction, error)

New return a new valid Flux object.

func (GitHubAction) DiscoverManifests

func (g GitHubAction) DiscoverManifests() ([][]byte, error)

type Job

type Job struct {
	Steps     []Step    `yaml:"steps,omitempty"`
	Container Container `yaml:"container,omitempty"`
}

type MatchingRule

type MatchingRule struct {
	// Path specifies a Flux filepath pattern, the pattern requires to match all of name, not just a subpart of the path.
	Path string
	// Actions specifies the list of artifacts to check
	//
	// The key is the artifact name and the value is the artifact version
	//
	// The artifact name must match the GitHub action name or the Docker image name.
	// In case of a Docker image, it must have the prefix docker://
	//
	// If the value is empty, then the artifact name is enough to match
	// If the value is a valid Git branch, Git tag, release, a Docker image tag , then the artifact version must match the constraint
	Actions map[string]string
}

MatchingRule allows to specifies rules to identify manifest

type MatchingRules

type MatchingRules []MatchingRule

type Spec

type Spec struct {
	// files allows to specify the accepted GitHub Action workflow file name
	//
	// default:
	//   - ".github/workflows/*.yaml",
	//   - ".github/workflows/*.yml",
	//   - ".gitea/workflows/*.yaml",
	//   - ".gitea/workflows/*.yml",
	//   - ".forgejo/workflows/*.yaml",
	//   - ".forgejo/workflows/*.yml",
	Files []string `yaml:",omitempty"`
	// ignore allows to specify rule to ignore autodiscovery a specific GitHub action based on a rule
	//
	// default: empty
	//
	Ignore MatchingRules `yaml:",omitempty"`
	// only allows to specify rule to only autodiscover manifest for a specific GitHub action based on a rule
	//
	// default: empty
	//
	Only MatchingRules `yaml:",omitempty"`
	// rootDir allows to specify the root directory from where looking for GitHub Action
	//
	// default: empty
	RootDir string `yaml:",omitempty"`
	// versionfilter provides parameters to specify the version pattern used when generating manifest.
	//
	// kind - semver
	//		versionfilter of kind `semver` uses semantic versioning as version filtering
	//		pattern accepts one of:
	//			`patch` - patch only update patch version
	//			`minor` - minor only update minor version
	//			`major` - major only update major versions
	//			`a version constraint` such as `>= 1.0.0`
	//
	//	kind - regex
	//		versionfilter of kind `regex` uses regular expression as version filtering
	//		pattern accepts a valid regular expression
	//
	//	example:
	//	“`
	//		versionfilter:
	//			kind: semver
	//			pattern: minor
	//	“`
	//
	//	and its type like regex, semver, or just latest.
	//
	VersionFilter version.Filter `yaml:",omitempty"`
	// Credentials allows to specify the credentials to use to authenticate to the git provider
	// The ID of the credential must be the domain of the git provider to configure
	//
	// default: empty
	//
	// examples:
	// “`
	//   autodiscovery:
	//     crawlers:
	//       github/action:
	//         credentials:
	//           "code.forgejo.com":
	//             kind: gitea
	//             token: xxx
	//           "github.com":
	//             kind: github
	//             token: '{{ requiredEnv "GITHUB_TOKEN" }}'
	// “`
	Credentials map[string]gitProviderToken `yaml:",omitempty"`
	// CredentialsDocker provides a map of registry credentials where the key is the registry URL without scheme
	CredentialsDocker map[string]docker.InlineKeyChain `yaml:",omitempty"`
	// Digest provides parameters to specify if the generated manifest should use a digest instead of the branch or tag.
	//
	// Remark:
	// 	- The digest is only supported for GitHub Action and docker image tag update.
	//    Feel free to open an issue for the Gitea and Forgejo integration.
	Digest *bool `yaml:",omitempty"`
}

Spec defines the parameters which can be provided to the Github Action crawler.

type Step

type Step struct {
	Name          string `yaml:"name,omitempty"`
	Uses          string `yaml:"uses,omitempty"`
	CommentDigest string // Captured comment for the 'uses' field
}

type Workflow

type Workflow struct {
	Name string         `yaml:"name,omitempty"`
	Jobs map[string]Job `yaml:"jobs,omitempty"`
}

Jump to

Keyboard shortcuts

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