-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Mariia Azbeleva <[email protected]>
- Loading branch information
Showing
2 changed files
with
56 additions
and
103 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,58 +38,34 @@ def ghaf_robot_test(String testname='boot') { | |
} else { | ||
env.INCLUDE_TEST_TAGS = "${testname}AND${env.DEVICE_TAG}" | ||
} | ||
// TODO: do we really need credentials to access the target devices? | ||
// Target devices are connected to the testagent, which itself is | ||
// only available over a private network. What is the risk | ||
// we are protecting against by having additional authentication | ||
// for the test devices? | ||
// The current configuration requires additional manual configuration | ||
// on the jenkins UI to add the following secrets: | ||
withCredentials([ | ||
string(credentialsId: 'testagent-dut-pass', variable: 'DUT_PASS'), | ||
string(credentialsId: 'testagent-plug-pass', variable: 'PLUG_PASS'), | ||
string(credentialsId: 'testagent-switch-token', variable: 'SW_TOKEN'), | ||
string(credentialsId: 'testagent-switch-secret', variable: 'SW_SECRET'), | ||
string(credentialsId: 'testagent-wifi-ssid', variable: 'WIFI_SSID'), | ||
string(credentialsId: 'testagent-wifi-password', variable: 'WIFI_PSWD'), | ||
]) { | ||
dir("Robot-Framework/test-suites") { | ||
sh 'rm -f *.png output.xml report.html log.html' | ||
// On failure, continue the pipeline execution | ||
try { | ||
// Pass the secrets to the shell as environment variables, as we | ||
// don't want Groovy to interpolate them. Similary, we pass | ||
// other variables as environment variables to shell. | ||
// Ref: https://www.jenkins.io/doc/book/pipeline/jenkinsfile/#string-interpolation | ||
sh ''' | ||
nix run .#ghaf-robot -- \ | ||
-v DEVICE:$DEVICE_NAME \ | ||
-v DEVICE_TYPE:$DEVICE_TAG \ | ||
-v LOGIN:ghaf \ | ||
-v PASSWORD:$DUT_PASS \ | ||
-v PLUG_USERNAME:[email protected] \ | ||
-v PLUG_PASSWORD:$PLUG_PASS \ | ||
-v SWITCH_TOKEN:$SW_TOKEN \ | ||
-v SWITCH_SECRET:$SW_SECRET \ | ||
-v BUILD_ID:${BUILD_NUMBER} \ | ||
-v TEST_WIFI_SSID:${WIFI_SSID} \ | ||
-v TEST_WIFI_PSWD:${WIFI_PSWD} \ | ||
-i $INCLUDE_TEST_TAGS . | ||
''' | ||
if (testname == 'boot') { | ||
// Set an environment variable to indicate boot test passed | ||
env.BOOT_PASSED = 'true' | ||
} | ||
} catch (Exception e) { | ||
currentBuild.result = "FAILURE" | ||
unstable("FAILED '${testname}': ${e.toString()}") | ||
} finally { | ||
// Move the test output (if any) to a subdirectory | ||
sh """ | ||
rm -fr $testname; mkdir -p $testname | ||
mv -f *.png output.xml report.html log.html $testname/ || true | ||
""" | ||
} | ||
dir("Robot-Framework/test-suites") { | ||
sh 'rm -f *.png output.xml report.html log.html' | ||
// On failure, continue the pipeline execution | ||
try { | ||
// Pass the secrets to the shell as environment variables, as we | ||
// don't want Groovy to interpolate them. Similary, we pass | ||
// other variables as environment variables to shell. | ||
// Ref: https://www.jenkins.io/doc/book/pipeline/jenkinsfile/#string-interpolation | ||
sh ''' | ||
nix run .#ghaf-robot -- \ | ||
-v DEVICE:$DEVICE_NAME \ | ||
-v DEVICE_TYPE:$DEVICE_TAG \ | ||
-v BUILD_ID:${BUILD_NUMBER} \ | ||
-i $INCLUDE_TEST_TAGS . | ||
''' | ||
if (testname == 'boot') { | ||
// Set an environment variable to indicate boot test passed | ||
env.BOOT_PASSED = 'true' | ||
} | ||
} catch (Exception e) { | ||
currentBuild.result = "FAILURE" | ||
unstable("FAILED '${testname}': ${e.toString()}") | ||
} finally { | ||
// Move the test output (if any) to a subdirectory | ||
sh """ | ||
rm -fr $testname; mkdir -p $testname | ||
mv -f *.png output.xml report.html log.html $testname/ || true | ||
""" | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -101,58 +101,34 @@ def ghaf_robot_test(String test_tags) { | |
println "Test tags is empty, give test tags as parameter when build this job!" | ||
} | ||
} | ||
// TODO: do we really need credentials to access the target devices? | ||
// Target devices are connected to the testagent, which itself is | ||
// only available over a private network. What is the risk | ||
// we are protecting against by having additional authentication | ||
// for the test devices? | ||
// The current configuration requires additional manual configuration | ||
// on the jenkins UI to add the following secrets: | ||
withCredentials([ | ||
string(credentialsId: 'testagent-dut-pass', variable: 'DUT_PASS'), | ||
string(credentialsId: 'testagent-plug-pass', variable: 'PLUG_PASS'), | ||
string(credentialsId: 'testagent-switch-token', variable: 'SW_TOKEN'), | ||
string(credentialsId: 'testagent-switch-secret', variable: 'SW_SECRET'), | ||
string(credentialsId: 'testagent-wifi-ssid', variable: 'WIFI_SSID'), | ||
string(credentialsId: 'testagent-wifi-password', variable: 'WIFI_PSWD'), | ||
]) { | ||
dir("Robot-Framework/test-suites") { | ||
sh 'rm -f *.png output.xml report.html log.html' | ||
// On failure, continue the pipeline execution | ||
try { | ||
// Pass the secrets to the shell as environment variables, as we | ||
// don't want Groovy to interpolate them. Similary, we pass | ||
// other variables as environment variables to shell. | ||
// Ref: https://www.jenkins.io/doc/book/pipeline/jenkinsfile/#string-interpolation | ||
sh ''' | ||
nix run .#ghaf-robot -- \ | ||
-v DEVICE:$DEVICE_NAME \ | ||
-v DEVICE_TYPE:$DEVICE_TAG \ | ||
-v LOGIN:ghaf \ | ||
-v PASSWORD:$DUT_PASS \ | ||
-v PLUG_USERNAME:[email protected] \ | ||
-v PLUG_PASSWORD:$PLUG_PASS \ | ||
-v SWITCH_TOKEN:$SW_TOKEN \ | ||
-v SWITCH_SECRET:$SW_SECRET \ | ||
-v BUILD_ID:${BUILD_NUMBER} \ | ||
-v TEST_WIFI_SSID:${WIFI_SSID} \ | ||
-v TEST_WIFI_PSWD:${WIFI_PSWD} \ | ||
-i $INCLUDE_TEST_TAGS . | ||
''' | ||
if (test_tags == 'boot') { | ||
// Set an environment variable to indicate boot test passed | ||
env.BOOT_PASSED = 'true' | ||
} | ||
} catch (Exception e) { | ||
currentBuild.result = "FAILURE" | ||
unstable("FAILED '${test_tags}': ${e.toString()}") | ||
} finally { | ||
// Move the test output (if any) to a subdirectory | ||
sh """ | ||
rm -fr $test_tags; mkdir -p $test_tags | ||
mv -f *.png output.xml report.html log.html $test_tags/ || true | ||
""" | ||
dir("Robot-Framework/test-suites") { | ||
sh 'rm -f *.png output.xml report.html log.html' | ||
// On failure, continue the pipeline execution | ||
try { | ||
// Pass the secrets to the shell as environment variables, as we | ||
// don't want Groovy to interpolate them. Similary, we pass | ||
// other variables as environment variables to shell. | ||
// Ref: https://www.jenkins.io/doc/book/pipeline/jenkinsfile/#string-interpolation | ||
sh ''' | ||
nix run .#ghaf-robot -- \ | ||
-v DEVICE:$DEVICE_NAME \ | ||
-v DEVICE_TYPE:$DEVICE_TAG \ | ||
-v BUILD_ID:${BUILD_NUMBER} \ | ||
-i $INCLUDE_TEST_TAGS . | ||
''' | ||
if (test_tags == 'boot') { | ||
// Set an environment variable to indicate boot test passed | ||
env.BOOT_PASSED = 'true' | ||
} | ||
} catch (Exception e) { | ||
currentBuild.result = "FAILURE" | ||
unstable("FAILED '${test_tags}': ${e.toString()}") | ||
} finally { | ||
// Move the test output (if any) to a subdirectory | ||
sh """ | ||
rm -fr $test_tags; mkdir -p $test_tags | ||
mv -f *.png output.xml report.html log.html $test_tags/ || true | ||
""" | ||
} | ||
} | ||
} | ||
|
@@ -313,6 +289,7 @@ pipeline { | |
archiveDirName: 'robot-plugin', | ||
outputPath: 'Robot-Framework/test-suites', | ||
outputFileName: '**/output.xml', | ||
otherFiles: '**/*.png', | ||
disableArchiveOutput: false, | ||
reportFileName: '**/report.html', | ||
logFileName: '**/log.html', | ||
|