mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-10-23 02:23:53 +00:00
lint and test
This commit is contained in:
parent
3c7e071a56
commit
ea6e07b441
2 changed files with 16 additions and 27 deletions
|
@ -28,7 +28,6 @@ const (
|
|||
func TestGenerateContainerConf(t *testing.T) {
|
||||
gotEnv, gotEntry := GenerateContainerConf([]string{"echo hello world"}, "windows")
|
||||
assert.Equal(t, windowsScriptBase64, gotEnv["CI_SCRIPT"])
|
||||
assert.Equal(t, "c:\\root", gotEnv["HOME"])
|
||||
assert.Equal(t, "powershell.exe", gotEnv["SHELL"])
|
||||
assert.Equal(t, []string{"powershell", "-noprofile", "-noninteractive", "-command", "[System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($Env:CI_SCRIPT)) | iex"}, gotEntry)
|
||||
gotEnv, gotEntry = GenerateContainerConf([]string{"echo hello world"}, "linux")
|
||||
|
|
|
@ -33,6 +33,7 @@ import (
|
|||
const (
|
||||
StepLabel = "step"
|
||||
podPrefix = "wp-"
|
||||
defaultFSGroup int64 = 1000
|
||||
)
|
||||
|
||||
func mkPod(step *types.Step, config *config, podName, goos string, options BackendOptions) (*v1.Pod, error) {
|
||||
|
@ -382,7 +383,6 @@ func podSecurityContext(sc *SecurityContext, secCtxConf SecurityContextConfig, s
|
|||
user *int64
|
||||
group *int64
|
||||
fsGroup *int64
|
||||
// fsGroupChangePolicy *v1.PodFSGroupChangePolicy
|
||||
seccomp *v1.SeccompProfile
|
||||
apparmor *v1.AppArmorProfile
|
||||
)
|
||||
|
@ -414,16 +414,7 @@ func podSecurityContext(sc *SecurityContext, secCtxConf SecurityContextConfig, s
|
|||
|
||||
// if unset, set fsGroup to 1000 by default to support non-root images
|
||||
if sc.FSGroup == nil {
|
||||
fsGroup = newInt64(1000)
|
||||
do the same for fsGroupChangePolicy but only if fsGroup is also set accordingly
|
||||
if sc.FSGroupChangePolicy == nil {
|
||||
policy := v1.PodFSGroupChangePolicyOnRootMismatch
|
||||
}
|
||||
fsGroupChangePolicy = &policy
|
||||
}
|
||||
else {
|
||||
fsGroupChangePolicy = sc.FSGroupChangePolicy
|
||||
}
|
||||
fsGroup = newInt64(defaultFSGroup)
|
||||
}
|
||||
|
||||
seccomp = seccompProfile(sc.SeccompProfile)
|
||||
|
@ -439,7 +430,6 @@ func podSecurityContext(sc *SecurityContext, secCtxConf SecurityContextConfig, s
|
|||
RunAsUser: user,
|
||||
RunAsGroup: group,
|
||||
FSGroup: fsGroup,
|
||||
FSGroupChangePolicy: fsGroupChangePolicy,
|
||||
SeccompProfile: seccomp,
|
||||
AppArmorProfile: apparmor,
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue