mirror of
https://github.com/SAP/jenkins-library.git
synced 2024-11-24 08:32:32 +02:00
Build piper binary in Consumer Tests (#1240)
This commit is contained in:
parent
2b2b57305e
commit
15ef9adaaa
@ -64,6 +64,8 @@ class TestRunnerThread extends Thread {
|
||||
"-e CASC_JENKINS_CONFIG=/workspace/jenkins.yml " +
|
||||
"-e ${testCaseConfig.deployCredentialEnv.username} " +
|
||||
"-e ${testCaseConfig.deployCredentialEnv.password} " +
|
||||
"-e LIBRARY_VERSION_UNDER_TEST=${libraryVersionUnderTest} " +
|
||||
"-e REPOSITORY_UNDER_TEST=${repositoryUnderTest} " +
|
||||
"-e BRANCH_NAME=${testCaseConfig.referenceAppRepo.branch} ppiper/jenkinsfile-runner")
|
||||
|
||||
println "*****[INFO] Test case '${uniqueName}' finished successfully.*****"
|
||||
|
@ -19,6 +19,20 @@ class PiperGoUtils implements Serializable {
|
||||
|
||||
if (utils.unstash('piper-bin').size() > 0) return
|
||||
|
||||
if (steps.env.REPOSITORY_UNDER_TEST && steps.env.LIBRARY_VERSION_UNDER_TEST) {
|
||||
steps.echo("Running in a consumer test, building unit-under-test binary for verification.")
|
||||
steps.dockerExecute(script: steps, dockerImage: 'golang:1.13', dockerOptions: '-u 0', dockerEnvVars: [
|
||||
REPOSITORY_UNDER_TEST: steps.env.REPOSITORY_UNDER_TEST,
|
||||
LIBRARY_VERSION_UNDER_TEST: steps.env.LIBRARY_VERSION_UNDER_TEST
|
||||
]) {
|
||||
steps.sh 'wget https://github.com/$REPOSITORY_UNDER_TEST/archive/$LIBRARY_VERSION_UNDER_TEST.tar.gz'
|
||||
steps.sh 'tar xzf $LIBRARY_VERSION_UNDER_TEST.tar.gz'
|
||||
steps.dir("jenkins-library-${steps.env.LIBRARY_VERSION_UNDER_TEST}") {
|
||||
steps.sh 'CGO_ENABLED=0 go build -tags release -o ../piper . && chmod +x ../piper && chown 1000:999 ../piper'
|
||||
}
|
||||
steps.sh 'rm -rf $LIBRARY_VERSION_UNDER_TEST.tar.gz jenkins-library-$LIBRARY_VERSION_UNDER_TEST'
|
||||
}
|
||||
} else {
|
||||
def libraries = getLibrariesInfo()
|
||||
String version
|
||||
libraries.each {lib ->
|
||||
@ -43,6 +57,8 @@ class PiperGoUtils implements Serializable {
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
utils.stashWithMessage('piper-bin', 'failed to stash piper binary', 'piper')
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user