-
Notifications
You must be signed in to change notification settings - Fork 120
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 support to upload artifacts to SQUAD server #497
Conversation
LGTM |
} | ||
|
||
while getopts ":a:u:t:vr" opt; do | ||
case "${opt}" in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"t" is missing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for pointing out! will drop the "t" option here.
automated/utils/upload-to-squad.sh
Outdated
FAILURE_RETURN_VALUE=0 | ||
|
||
usage() { | ||
echo "Usage: $0 [-a <attachment>] [-u <artifactorial_url>] [-t <artifactorial_token>] [-v] [-r]" 1>&2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"t" option is missing from the help text.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for pointing out it! will drop the "t" description from here.
The idea here is to not support passing the token to avoid the possibility of leak.
automated/utils/upload-to-squad.sh
Outdated
fi | ||
|
||
if command -v lava-test-reference > /dev/null 2>&1; then | ||
# The 'ARTIFACTORIAL_TOKEN' needs to be defined in 'secrects' dictionary in job |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this part contradicts usage description.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will update
exit 0 | ||
else | ||
# return is the squad testrun id | ||
return=$(curl ${CURL_VERBOSE_FLAG} --header "Auth-Token: ${SQUAD_ARCHIVE_SUBMIT_TOKEN}" --form "attachment=@${ATTACHMENT}" "${ARTIFACTORIAL_URL}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is SQUAD_ARHIVE_SUBMIT_TOKEN the same thing as ARTIFACTORIAL_TOKEN?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From function level, they could be seen as the same. but they are used for different cases, and will be in different value, so need to be defined as two variables I think.
automated/utils/upload-to-squad.sh
Outdated
|
||
attachmentBasename="$(basename "${ATTACHMENT}")" | ||
if echo "${return}" | grep -E "^[0-9]+$"; then | ||
url_uploaded="https://qa-reports.linaro.org/api/testruns/${return}/attachments/?filename=${attachmentBasename}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't ARTIFACTORIAL_URL be used instead of hardcoded qa-reports.linaro.org?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for the suggestion, will update to use ARTIFACTORIAL_URL to get the new url.
@mwasilew just updated according to your comments/suggestions, please help check it again |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with one minor comment. Thanks for fixing it!
if command -v lava-test-reference > /dev/null 2>&1; then | ||
# The 'SQUAD_ARCHIVE_SUBMIT_TOKEN' needs to be defined in 'secrects' dictionary in job | ||
# definition file, or defined in the environment, it will be used. | ||
lava_test_dir="$(find /lava-* -maxdepth 0 -type d | grep -E '^/lava-[0-9]+' 2>/dev/null | sort | tail -1)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is a bit problematic. If there is lava_test_results_dir set in the job context, "/lava-*" might not be correct. However I've no idea how to make it work for all cases. I would suggest adding a comment to address this problem for future maintainers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated the comment,
to replace the uploading to archive.vlo Signed-off-by: Yongqin Liu <yongqin.liu@linaro.org>
via specifying the SQUAD_UPLOAD_URL variables. To be noted, to avoid leak of tokens, the SQUAD_ARCHIVE_SUBMIT_TOKEN used to upload is not supported to be defined in the job definition in the plain text format, it's must be defined as one profile managed token by the submitter Signed-off-by: Yongqin Liu <yongqin.liu@linaro.org>
# see https://squad.readthedocs.io/en/latest/intro.html#submitting-results. | ||
# SQUAD_ARCHIVE_SUBMIT_TOKEN is used for uploading authentication, | ||
# and must be defined by the submitter as one profile managed token | ||
SQUAD_UPLOAD_URL: "" | ||
# Specify url and token for file uploading. | ||
URL: "https://archive.validation.linaro.org/artifacts/team/qa/" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think URL
can go away now that archive.vlo is dead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in case archive.vlo is recovered some time later, the current jobs would still be able to run.
leave it here for compatibility for now.
And I also have a plan to remove this URL and the following TOKEN, and the upload-to-artifactorial.sh script in a separate PR, just one concern is that not sure if there is anyone else uses this test as well, their archive server may still work.
Hi, @bhcopeland @roxell @sumitsemwal |
With the automated/utils/upload-to-squad.sh added and the change on the noninteractive-tradefe test as an example in this pull request. there are other tests need to be update as well after pull request.
The SQUAD url should be defined in the format like described here:
https://squad.readthedocs.io/en/latest/intro.html#submitting-results
And the job definition, SQUAD_ARCHIVE_SUBMIT_TOKEN should be defined under the secrets section.
And SQUAD_UPLOAD_URL should be defined as one parameter like: