2020-02-05 00:38:41 +00:00
|
|
|
package cmd
|
|
|
|
|
|
|
|
import (
|
|
|
|
"path/filepath"
|
2021-05-18 06:14:49 +00:00
|
|
|
|
|
|
|
log "github.com/sirupsen/logrus"
|
2020-02-05 00:38:41 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// Input contains the input for the root command
|
|
|
|
type Input struct {
|
2022-06-21 13:52:21 +00:00
|
|
|
actor string
|
|
|
|
workdir string
|
|
|
|
workflowsPath string
|
|
|
|
autodetectEvent bool
|
|
|
|
eventPath string
|
|
|
|
reuseContainers bool
|
|
|
|
bindWorkdir bool
|
|
|
|
secrets []string
|
2023-06-10 18:09:27 +00:00
|
|
|
vars []string
|
2022-06-21 13:52:21 +00:00
|
|
|
envs []string
|
2023-01-13 19:28:17 +00:00
|
|
|
inputs []string
|
2022-06-21 13:52:21 +00:00
|
|
|
platforms []string
|
|
|
|
dryrun bool
|
|
|
|
forcePull bool
|
|
|
|
forceRebuild bool
|
|
|
|
noOutput bool
|
|
|
|
envfile string
|
2023-01-13 19:28:17 +00:00
|
|
|
inputfile string
|
2022-06-21 13:52:21 +00:00
|
|
|
secretfile string
|
2023-06-10 18:09:27 +00:00
|
|
|
varfile string
|
2022-06-21 13:52:21 +00:00
|
|
|
insecureSecrets bool
|
|
|
|
defaultBranch string
|
|
|
|
privileged bool
|
|
|
|
usernsMode string
|
|
|
|
containerArchitecture string
|
|
|
|
containerDaemonSocket string
|
2022-12-06 15:58:47 +00:00
|
|
|
containerOptions string
|
2022-06-21 13:52:21 +00:00
|
|
|
noWorkflowRecurse bool
|
|
|
|
useGitIgnore bool
|
|
|
|
githubInstance string
|
|
|
|
containerCapAdd []string
|
|
|
|
containerCapDrop []string
|
|
|
|
autoRemove bool
|
|
|
|
artifactServerPath string
|
2023-01-16 14:12:20 +00:00
|
|
|
artifactServerAddr string
|
2022-06-21 13:52:21 +00:00
|
|
|
artifactServerPort string
|
2023-04-28 15:57:40 +00:00
|
|
|
noCacheServer bool
|
|
|
|
cacheServerPath string
|
|
|
|
cacheServerAddr string
|
|
|
|
cacheServerPort uint16
|
2022-06-21 13:52:21 +00:00
|
|
|
jsonLogger bool
|
|
|
|
noSkipCheckout bool
|
|
|
|
remoteName string
|
|
|
|
replaceGheActionWithGithubCom []string
|
|
|
|
replaceGheActionTokenWithGithubCom string
|
2023-03-19 17:25:55 +00:00
|
|
|
matrix []string
|
2023-06-15 01:16:00 +00:00
|
|
|
actionCachePath string
|
2023-07-19 21:45:44 +00:00
|
|
|
logPrefixJobID bool
|
2020-02-05 00:38:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (i *Input) resolve(path string) string {
|
2020-02-07 06:17:58 +00:00
|
|
|
basedir, err := filepath.Abs(i.workdir)
|
2020-02-05 00:38:41 +00:00
|
|
|
if err != nil {
|
|
|
|
log.Fatal(err)
|
|
|
|
}
|
|
|
|
if path == "" {
|
|
|
|
return path
|
|
|
|
}
|
|
|
|
if !filepath.IsAbs(path) {
|
|
|
|
path = filepath.Join(basedir, path)
|
|
|
|
}
|
|
|
|
return path
|
|
|
|
}
|
|
|
|
|
2020-03-06 20:30:24 +00:00
|
|
|
// Envfile returns path to .env
|
|
|
|
func (i *Input) Envfile() string {
|
|
|
|
return i.resolve(i.envfile)
|
|
|
|
}
|
|
|
|
|
2020-04-17 17:04:40 +00:00
|
|
|
// Secretfile returns path to secrets
|
|
|
|
func (i *Input) Secretfile() string {
|
|
|
|
return i.resolve(i.secretfile)
|
|
|
|
}
|
|
|
|
|
2023-06-10 18:09:27 +00:00
|
|
|
func (i *Input) Varfile() string {
|
|
|
|
return i.resolve(i.varfile)
|
|
|
|
}
|
|
|
|
|
2020-02-07 06:17:58 +00:00
|
|
|
// Workdir returns path to workdir
|
|
|
|
func (i *Input) Workdir() string {
|
|
|
|
return i.resolve(".")
|
|
|
|
}
|
|
|
|
|
2020-05-27 03:29:50 +00:00
|
|
|
// WorkflowsPath returns path to workflow file(s)
|
2020-02-05 00:38:41 +00:00
|
|
|
func (i *Input) WorkflowsPath() string {
|
|
|
|
return i.resolve(i.workflowsPath)
|
|
|
|
}
|
|
|
|
|
|
|
|
// EventPath returns the path to events file
|
|
|
|
func (i *Input) EventPath() string {
|
|
|
|
return i.resolve(i.eventPath)
|
|
|
|
}
|
2023-01-13 19:28:17 +00:00
|
|
|
|
|
|
|
// Inputfile returns the path to the input file
|
|
|
|
func (i *Input) Inputfile() string {
|
|
|
|
return i.resolve(i.inputfile)
|
|
|
|
}
|