Commit ead0911f authored by xsyvITyt's avatar xsyvITyt

Minimum implementation of protected runner

parent 6019a38c
Pipeline #58832869 passed with stages
in 53 minutes and 39 seconds
...@@ -15,7 +15,7 @@ import ( ...@@ -15,7 +15,7 @@ import (
"time" "time"
"github.com/BurntSushi/toml" "github.com/BurntSushi/toml"
"github.com/docker/go-units" units "github.com/docker/go-units"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
api "k8s.io/api/core/v1" api "k8s.io/api/core/v1"
...@@ -273,6 +273,8 @@ type RunnerSettings struct { ...@@ -273,6 +273,8 @@ type RunnerSettings struct {
PreCloneScript string `toml:"pre_clone_script,omitempty" json:"pre_clone_script" long:"pre-clone-script" env:"RUNNER_PRE_CLONE_SCRIPT" description:"Runner-specific command script executed before code is pulled"` PreCloneScript string `toml:"pre_clone_script,omitempty" json:"pre_clone_script" long:"pre-clone-script" env:"RUNNER_PRE_CLONE_SCRIPT" description:"Runner-specific command script executed before code is pulled"`
PreBuildScript string `toml:"pre_build_script,omitempty" json:"pre_build_script" long:"pre-build-script" env:"RUNNER_PRE_BUILD_SCRIPT" description:"Runner-specific command script executed after code is pulled, just before build executes"` PreBuildScript string `toml:"pre_build_script,omitempty" json:"pre_build_script" long:"pre-build-script" env:"RUNNER_PRE_BUILD_SCRIPT" description:"Runner-specific command script executed after code is pulled, just before build executes"`
PostBuildScript string `toml:"post_build_script,omitempty" json:"post_build_script" long:"post-build-script" env:"RUNNER_POST_BUILD_SCRIPT" description:"Runner-specific command script executed after code is pulled and just after build executes"` PostBuildScript string `toml:"post_build_script,omitempty" json:"post_build_script" long:"post-build-script" env:"RUNNER_POST_BUILD_SCRIPT" description:"Runner-specific command script executed after code is pulled and just after build executes"`
NoUserScripts bool `toml:"no_user_scripts,omitempty" json:"no_user_scripts" long:"no-user-scripts" env:"RUNNER_NO_USER_SCRIPTS" description:"Runner-specific option to disable use of user-defined scripts"`
Script []string `toml:"script" json:"script" long:"script" env:"RUNNER_SCRIPT" description:"Runner-specific script to use when user scripts are disabled"`
DebugTraceDisabled bool `toml:"debug_trace_disabled,omitempty" json:"debug_trace_disabled" long:"debug-trace-disabled" env:"RUNNER_DEBUG_TRACE_DISABLED" description:"When set to true Runner will disable the possibility of using the CI_DEBUG_TRACE feature"` DebugTraceDisabled bool `toml:"debug_trace_disabled,omitempty" json:"debug_trace_disabled" long:"debug-trace-disabled" env:"RUNNER_DEBUG_TRACE_DISABLED" description:"When set to true Runner will disable the possibility of using the CI_DEBUG_TRACE feature"`
......
...@@ -533,6 +533,17 @@ func (b *AbstractShell) writeUserScript(w ShellWriter, info common.ShellScriptIn ...@@ -533,6 +533,17 @@ func (b *AbstractShell) writeUserScript(w ShellWriter, info common.ShellScriptIn
} }
} }
if info.Build.Runner.NoUserScripts {
// TODO: validate that Runner.Script is valid
scriptStep = &common.Step{
Name: "runnerdefinedstep",
Script: info.Build.Runner.Script,
Timeout: 100,
When: common.StepWhenOnSuccess,
AllowFailure: false,
}
}
if scriptStep == nil { if scriptStep == nil {
return nil return nil
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment