From d6153866df86a17fee4ed53e57fc2808e14826fa Mon Sep 17 00:00:00 2001 From: Devansh Mathur Date: Mon, 3 Mar 2025 18:05:21 +0530 Subject: [PATCH] feat: [CI-16330]: Adding default OutputFile as DRONE_OUTPUT. (#139) * Adding default OutputFile as DRONE_OUTPUT. * Removing if checks and optimizing setting up of default OutputFile as DRONE_OUTPUT. --- kaniko.go | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/kaniko.go b/kaniko.go index 678fd51..4eb0448 100644 --- a/kaniko.go +++ b/kaniko.go @@ -483,14 +483,13 @@ func (p Plugin) Exec() error { } } - if p.Output.OutputFile != "" { - var tarPath string - if p.Build.TarPath != "" { - tarPath = getTarPath(p.Build.TarPath) - } - if err = output.WritePluginOutputFile(p.Output.OutputFile, getDigest(p.Build.DigestFile), tarPath); err != nil { - fmt.Fprintf(os.Stderr, "failed to write plugin output file at path: %s with error: %s\n", p.Output.OutputFile, err) - } + p.Output.OutputFile = os.Getenv("DRONE_OUTPUT") + var tarPath string + if p.Build.TarPath != "" { + tarPath = getTarPath(p.Build.TarPath) + } + if err = output.WritePluginOutputFile(p.Output.OutputFile, getDigest(p.Build.DigestFile), tarPath); err != nil { + fmt.Fprintf(os.Stderr, "failed to write plugin output file at path: %s with error: %s\n", p.Output.OutputFile, err) } return nil