fix: temporary patch for kaniko on cgroup v2 hosts
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This is a temporary workaround that enables kaniko to run on cgroup v2 enabled hosts. Due to an upstream issue, kaniko fails to detect that it is indeed being run from a container. Solution introduced here is to force kaniko to run regardless. ref: https://github.com/GoogleContainerTools/kaniko/issues/1592
This commit is contained in:
parent
4b5ab7f6fb
commit
a34e88943a
22
kaniko.go
22
kaniko.go
|
@ -103,8 +103,28 @@ func (p Plugin) Exec() error {
|
|||
}
|
||||
|
||||
if p.Build.NoPush {
|
||||
cmdArgs = append(cmdArgs, fmt.Sprintf("--no-push"))
|
||||
pushNeeded := true
|
||||
for _, arg := range cmdArgs {
|
||||
if arg == "--no-push" {
|
||||
pushNeeded = false
|
||||
break
|
||||
}
|
||||
}
|
||||
if pushNeeded {
|
||||
cmdArgs = append(cmdArgs, fmt.Sprintf("--no-push"))
|
||||
}
|
||||
}
|
||||
// due to kaniko spontaneously failing to detect it's being run in a container
|
||||
// it's probably for the better to always force-run here until this is resolved
|
||||
// and fixed upstream. Since all of our runners are on cgroup v2 hosts, this
|
||||
// issue is quite impactful for us.
|
||||
// ref: https://github.com/GoogleContainerTools/kaniko/issues/1592
|
||||
//
|
||||
// example error message: '/kaniko/executor --dockerfile=Dockerfile --context=dir://.
|
||||
// --no-push kaniko should only be run inside of a container, run with the --force
|
||||
// flag if you are sure you want to continue'
|
||||
// another ref: https://drone.dotya.ml/wanderer/docker-archlinux-cdev/5960/2/2
|
||||
cmdArgs = append(cmdArgs, fmt.Sprintf("--force"))
|
||||
|
||||
cmd := exec.Command("/kaniko/executor", cmdArgs...)
|
||||
cmd.Stdout = os.Stdout
|
||||
|
|
Loading…
Reference in New Issue