Skip to content

Commit

Permalink
Add commit hash parameter
Browse files Browse the repository at this point in the history
Signed-off-by: Mariia Azbeleva <[email protected]>
  • Loading branch information
azbeleva committed Jan 21, 2025
1 parent 64bc517 commit 4b6b21d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions ghaf-hw-test.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,12 @@ def get_test_conf_property(String file_path, String device, String property) {
def device_data = readJSON file: file_path
property_data = "${device_data['addresses'][device][property]}"
println "Got device '${device}' property '${property}' value: '${property_data}'"
println "commit_hash ${COMMIT_HASH}"
return property_data
}

def ghaf_robot_test(String testname='boot') {
println "commit_hash ${COMMIT_HASH}"
if (!env.DEVICE_TAG) {
sh "echo 'DEVICE_TAG not set'; exit 1"
}
Expand All @@ -49,6 +51,7 @@ def ghaf_robot_test(String testname='boot') {
-v DEVICE:$DEVICE_NAME \
-v DEVICE_TYPE:$DEVICE_TAG \
-v BUILD_ID:${BUILD_NUMBER} \
-v COMMIT_HASH:${params.COMMIT_HASH} \
-i $INCLUDE_TEST_TAGS .
'''
if (testname == 'boot') {
Expand Down
4 changes: 4 additions & 0 deletions utils.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,9 @@ def ghaf_hw_test(String flakeref, String device_config, String testset='_boot_')
def imgdir = find_img_relpath(flakeref, 'archive')
def remote_path = "artifacts/${env.ARTIFACTS_REMOTE_PATH}"
def img_url = "${env.JENKINS_URL}/${remote_path}/${imgdir}"
def commit_hash = "${env.TARGET_COMMIT}"
println "TARGET_COMMIT global env variable ${env.TARGET_COMMIT}"
println "commit_hash $commit_hash"
def build_url = "${env.JENKINS_URL}/job/${env.JOB_NAME}/${env.BUILD_ID}"
def build_href = "<a href=\"${build_url}\">${env.JOB_NAME}#${env.BUILD_ID}</a>"
def flakeref_trimmed = "${flakeref_trim(flakeref)}"
Expand All @@ -221,6 +224,7 @@ def ghaf_hw_test(String flakeref, String device_config, String testset='_boot_')
string(name: "DESC", value: "$description"),
string(name: "TESTSET", value: "$testset"),
string(name: "TARGET", value: "$flakeref_trimmed"),
string(name: "COMMIT_HASH", value: "$commit_hash"),
],
wait: true,
)
Expand Down

0 comments on commit 4b6b21d

Please sign in to comment.