mirror of
https://github.com/SAP/jenkins-library.git
synced 2025-02-07 13:42:23 +02:00
Use piper exe in CWD for integration tests if available (#1231)
This change allows a development workflow where you don't need to set the `PIPER_INTEGRATION_EXECUTABLE` variable if your executable is available in the CWD. This should make it non-required to set the variable for most cases of local development.
This commit is contained in:
parent
ef330e1eee
commit
1a3275b70d
@ -5,7 +5,10 @@ package main
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"github.com/SAP/jenkins-library/pkg/piperutils"
|
||||
"os"
|
||||
"path"
|
||||
"testing"
|
||||
|
||||
"github.com/SAP/jenkins-library/pkg/command"
|
||||
@ -27,7 +30,19 @@ func TestPiperHelp(t *testing.T) {
|
||||
|
||||
func getPiperExecutable() string {
|
||||
if p := os.Getenv("PIPER_INTEGRATION_EXECUTABLE"); len(p) > 0 {
|
||||
fmt.Println("Piper executable for integration test: " + p)
|
||||
return p
|
||||
}
|
||||
|
||||
f := piperutils.Files{}
|
||||
wd, _ := os.Getwd()
|
||||
localPiper := path.Join(wd, "piper")
|
||||
exists, _ := f.FileExists(localPiper)
|
||||
if exists {
|
||||
fmt.Println("Piper executable for integration test: " + localPiper)
|
||||
return localPiper
|
||||
}
|
||||
|
||||
fmt.Println("Piper executable for integration test: Using 'piper' from PATH")
|
||||
return "piper"
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user