2020-02-04 18:38:41 -06:00
|
|
|
package cmd
|
|
|
|
|
|
|
|
import (
|
|
|
|
"path/filepath"
|
2021-05-18 01:14:49 -05:00
|
|
|
|
|
|
|
log "github.com/sirupsen/logrus"
|
2020-02-04 18:38:41 -06:00
|
|
|
)
|
|
|
|
|
|
|
|
// Input contains the input for the root command
|
|
|
|
type Input struct {
|
2021-03-28 23:08:40 -05:00
|
|
|
actor string
|
|
|
|
workdir string
|
|
|
|
workflowsPath string
|
|
|
|
autodetectEvent bool
|
|
|
|
eventPath string
|
|
|
|
reuseContainers bool
|
|
|
|
bindWorkdir bool
|
|
|
|
secrets []string
|
|
|
|
envs []string
|
|
|
|
platforms []string
|
|
|
|
dryrun bool
|
|
|
|
forcePull bool
|
2021-11-24 09:51:37 -06:00
|
|
|
forceRebuild bool
|
2021-03-28 23:08:40 -05:00
|
|
|
noOutput bool
|
|
|
|
envfile string
|
|
|
|
secretfile string
|
|
|
|
insecureSecrets bool
|
|
|
|
defaultBranch string
|
|
|
|
privileged bool
|
|
|
|
usernsMode string
|
|
|
|
containerArchitecture string
|
2021-05-23 09:43:09 -05:00
|
|
|
containerDaemonSocket string
|
2021-05-03 09:57:24 -05:00
|
|
|
noWorkflowRecurse bool
|
2021-05-03 09:37:20 -05:00
|
|
|
useGitIgnore bool
|
2021-05-05 11:42:34 -05:00
|
|
|
githubInstance string
|
2021-06-04 11:06:59 -05:00
|
|
|
containerCapAdd []string
|
|
|
|
containerCapDrop []string
|
2021-06-10 10:09:05 -05:00
|
|
|
autoRemove bool
|
2021-11-10 11:57:22 -06:00
|
|
|
artifactServerPath string
|
|
|
|
artifactServerPort string
|
2022-03-14 10:33:11 -05:00
|
|
|
jsonLogger bool
|
2022-03-21 06:23:06 -05:00
|
|
|
noSkipCheckout bool
|
2022-04-04 12:53:08 -05:00
|
|
|
remoteName string
|
2020-02-04 18:38:41 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
func (i *Input) resolve(path string) string {
|
2020-02-07 00:17:58 -06:00
|
|
|
basedir, err := filepath.Abs(i.workdir)
|
2020-02-04 18:38:41 -06: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 14:30:24 -06:00
|
|
|
// Envfile returns path to .env
|
|
|
|
func (i *Input) Envfile() string {
|
|
|
|
return i.resolve(i.envfile)
|
|
|
|
}
|
|
|
|
|
2020-04-17 12:04:40 -05:00
|
|
|
// Secretfile returns path to secrets
|
|
|
|
func (i *Input) Secretfile() string {
|
|
|
|
return i.resolve(i.secretfile)
|
|
|
|
}
|
|
|
|
|
2020-02-07 00:17:58 -06:00
|
|
|
// Workdir returns path to workdir
|
|
|
|
func (i *Input) Workdir() string {
|
|
|
|
return i.resolve(".")
|
|
|
|
}
|
|
|
|
|
2020-05-26 22:29:50 -05:00
|
|
|
// WorkflowsPath returns path to workflow file(s)
|
2020-02-04 18:38:41 -06: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)
|
|
|
|
}
|