Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add signature verification #86

Merged
merged 1 commit into from
Nov 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion ghaf-parallel-hw-test.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
def REPO_URL = 'https://github.com/tiiuae/ci-test-automation/'
def DEF_LABEL = 'testagent'
def TMP_IMG_DIR = 'image'
def TMP_SIG_DIR = 'signature'
def CONF_FILE_PATH = '/etc/jenkins/test_config.json'

////////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -49,6 +50,8 @@ def ghaf_robot_test(String testname='boot') {
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'
Expand All @@ -69,6 +72,8 @@ def ghaf_robot_test(String testname='boot') {
-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') {
Expand Down Expand Up @@ -160,6 +165,11 @@ pipeline {
"""
img_relpath = run_cmd("find ${TMP_IMG_DIR} -type f -print -quit | grep .")
println "Downloaded image to workspace: ${img_relpath}"
// Verify signature using the tooling from: https://github.com/tiiuae/ci-yubi
sh "wget -nv -P ${TMP_SIG_DIR} ${params.IMG_URL}.sig"
sig_relpath = run_cmd("find ${TMP_SIG_DIR} -type f -print -quit | grep .")
vjuntunen marked this conversation as resolved.
Show resolved Hide resolved
println "Downloaded signature to workspace: ${sig_relpath}"
sh "nix run github:tiiuae/ci-yubi/bdb2dbf#verify -- --path ${img_relpath} --sigfile ${sig_relpath}"
// Uncompress, keeping only the decompressed image file
if(img_relpath.endsWith("zst")) {
sh "zstd -dfv ${img_relpath} && rm ${img_relpath}"
Expand Down Expand Up @@ -198,7 +208,6 @@ pipeline {
unmount_cmd = "/run/wrappers/bin/sudo usbsdmux ${muxport} dut"
} else {
serial = get_test_conf_property(CONF_FILE_PATH, env.DEVICE_NAME, 'usbhub_serial')
//dgrep = 'PSSD'
mount_cmd = "/run/wrappers/bin/sudo AcronameHubCLI -u 0 -s ${serial}; sleep 10"
unmount_cmd = "/run/wrappers/bin/sudo AcronameHubCLI -u 1 -s ${serial}"
}
Expand Down
Loading