diff --git a/pkg/model/workflow.go b/pkg/model/workflow.go index 05d210b61d4..a453c417249 100644 --- a/pkg/model/workflow.go +++ b/pkg/model/workflow.go @@ -23,21 +23,6 @@ type Workflow struct { Defaults Defaults `yaml:"defaults"` } -// CompositeRestrictions is the structure to control what is allowed in composite actions -type CompositeRestrictions struct { - AllowCompositeUses bool - AllowCompositeIf bool - AllowCompositeContinueOnError bool -} - -func defaultCompositeRestrictions() *CompositeRestrictions { - return &CompositeRestrictions{ - AllowCompositeUses: true, - AllowCompositeIf: true, - AllowCompositeContinueOnError: false, - } -} - // On events for the workflow func (w *Workflow) On() []string { switch w.RawOn.Kind { @@ -427,17 +412,14 @@ func (s *Step) Type() StepType { return StepTypeUsesActionRemote } -func (s *Step) Validate(config *CompositeRestrictions) error { - if config == nil { - config = defaultCompositeRestrictions() - } - if s.Type() != StepTypeRun && !config.AllowCompositeUses { +func (s *Step) Validate() error { + if s.Type() != StepTypeRun { return fmt.Errorf("(StepID: %s): Unexpected value 'uses'", s.String()) } else if s.Type() == StepTypeRun && s.Shell == "" { return fmt.Errorf("(StepID: %s): Required property is missing: 'shell'", s.String()) - } else if !s.If.IsZero() && !config.AllowCompositeIf { + } else if !s.If.IsZero() { return fmt.Errorf("(StepID: %s): Property is not available: 'if'", s.String()) - } else if s.ContinueOnError && !config.AllowCompositeContinueOnError { + } else if s.ContinueOnError { return fmt.Errorf("(StepID: %s): Property is not available: 'continue-on-error'", s.String()) } return nil diff --git a/pkg/runner/action.go b/pkg/runner/action.go index 6a8d31ad07f..0d027d736a4 100644 --- a/pkg/runner/action.go +++ b/pkg/runner/action.go @@ -364,12 +364,6 @@ func execAsComposite(step actionStep) common.Executor { action := step.getActionModel() return func(ctx context.Context) error { - // Disable some features of composite actions, only for feature parity with github - for _, compositeStep := range action.Runs.Steps { - if err := compositeStep.Validate(rc.Config.CompositeRestrictions); err != nil { - return err - } - } inputs := make(map[string]interface{}) eval := step.getRunContext().NewExpressionEvaluator() // Set Defaults diff --git a/pkg/runner/runner.go b/pkg/runner/runner.go index 751ee8a1877..3aab6824fa3 100644 --- a/pkg/runner/runner.go +++ b/pkg/runner/runner.go @@ -23,35 +23,34 @@ type Runner interface { // Config contains the config for a new runner type Config struct { - Actor string // the user that triggered the event - Workdir string // path to working directory - BindWorkdir bool // bind the workdir to the job container - EventName string // name of event to run - EventPath string // path to JSON file to use for event.json in containers - DefaultBranch string // name of the main branch for this repository - ReuseContainers bool // reuse containers to maintain state - ForcePull bool // force pulling of the image, even if already present - ForceRebuild bool // force rebuilding local docker image action - LogOutput bool // log the output from docker run - JSONLogger bool // use json or text logger - Env map[string]string // env for containers - Secrets map[string]string // list of secrets - InsecureSecrets bool // switch hiding output when printing to terminal - Platforms map[string]string // list of platforms - Privileged bool // use privileged mode - UsernsMode string // user namespace to use - ContainerArchitecture string // Desired OS/architecture platform for running containers - ContainerDaemonSocket string // Path to Docker daemon socket - UseGitIgnore bool // controls if paths in .gitignore should not be copied into container, default true - GitHubInstance string // GitHub instance to use, default "github.com" - ContainerCapAdd []string // list of kernel capabilities to add to the containers - ContainerCapDrop []string // list of kernel capabilities to remove from the containers - AutoRemove bool // controls if the container is automatically removed upon workflow completion - ArtifactServerPath string // the path where the artifact server stores uploads - ArtifactServerPort string // the port the artifact server binds to - CompositeRestrictions *model.CompositeRestrictions // describes which features are available in composite actions - NoSkipCheckout bool // do not skip actions/checkout - RemoteName string // remote name in local git repo config + Actor string // the user that triggered the event + Workdir string // path to working directory + BindWorkdir bool // bind the workdir to the job container + EventName string // name of event to run + EventPath string // path to JSON file to use for event.json in containers + DefaultBranch string // name of the main branch for this repository + ReuseContainers bool // reuse containers to maintain state + ForcePull bool // force pulling of the image, even if already present + ForceRebuild bool // force rebuilding local docker image action + LogOutput bool // log the output from docker run + JSONLogger bool // use json or text logger + Env map[string]string // env for containers + Secrets map[string]string // list of secrets + InsecureSecrets bool // switch hiding output when printing to terminal + Platforms map[string]string // list of platforms + Privileged bool // use privileged mode + UsernsMode string // user namespace to use + ContainerArchitecture string // Desired OS/architecture platform for running containers + ContainerDaemonSocket string // Path to Docker daemon socket + UseGitIgnore bool // controls if paths in .gitignore should not be copied into container, default true + GitHubInstance string // GitHub instance to use, default "github.com" + ContainerCapAdd []string // list of kernel capabilities to add to the containers + ContainerCapDrop []string // list of kernel capabilities to remove from the containers + AutoRemove bool // controls if the container is automatically removed upon workflow completion + ArtifactServerPath string // the path where the artifact server stores uploads + ArtifactServerPort string // the port the artifact server binds to + NoSkipCheckout bool // do not skip actions/checkout + RemoteName string // remote name in local git repo config } // Resolves the equivalent host path inside the container