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 workflow with DTS tests #193

Merged
merged 6 commits into from
Nov 22, 2024
Merged

Add workflow with DTS tests #193

merged 6 commits into from
Nov 22, 2024

Conversation

PLangowski
Copy link
Collaborator

No description provided.

@PLangowski PLangowski mentioned this pull request Nov 19, 2024
@PLangowski
Copy link
Collaborator Author

@m-iwanicki

The build step is short enough to just copy to the test workflow. e58279e#diff-faff1af3d8ff408964a57b2e475f69a6b7c7b71c9978cccc8f471798caac2c88R14-R41

@m-iwanicki
Copy link
Contributor

And now if we change anything in this step we will have to remember to fix it in 3 places. We already had situations where we forgot to update second workflow. If you want to add yet another code duplication then this situation will likely happen again.

@PLangowski
Copy link
Collaborator Author

Done

@m-iwanicki
Copy link
Contributor

Looks good, 2 comments left from previous PR, lock python version + somehow print test title + test status

@PLangowski
Copy link
Collaborator Author

PLangowski commented Nov 19, 2024

I specified the Python version cc9a438 and replied to the thread #189 (comment)

@m-iwanicki
Copy link
Contributor

@PLangowski #189 (comment)

And maybe pin Python version to some we know it works e.g. 3.12 (3.13 currently doesn't work)

.github/workflows/test.yml Outdated Show resolved Hide resolved
@PLangowski PLangowski force-pushed the tests-ci branch 7 times, most recently from aa0ded1 to 1a5aa00 Compare November 20, 2024 12:19
.github/workflows/test.yml Outdated Show resolved Hide resolved
@PLangowski PLangowski force-pushed the tests-ci branch 4 times, most recently from 897473c to 6aa3b23 Compare November 20, 2024 13:54
@m-iwanicki
Copy link
Contributor

@PLangowski Can you also use build.yml in weekly.yml? There is one difference in that between checkout and build there is one additional step that disables cache.

@m-iwanicki
Copy link
Contributor

@PLangowski also update checkout action in build.yml?
image

@PLangowski PLangowski force-pushed the tests-ci branch 2 times, most recently from 8716e17 to 73a3a5f Compare November 21, 2024 09:26
Signed-off-by: Pawel Langowski <[email protected]>
@PLangowski
Copy link
Collaborator Author

I pushed my changes. @macpijan Let me know if you like this solution

shell: bash
run: |
mkdir ipxe
cp build/tmp/deploy/images/genericx86-64/dts-base-image-genericx86-64.cpio.gz ipxe
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I would put this into the osfv/scripts/ci as well, just as qemu.
This way, you could replicate this more easily locally as well. I assume you might want to run these tests locally as well, prior creating PR.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move this script to osfv: d46ef63
PR to osfv: Dasharo/open-source-firmware-validation#620

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@PLangowski please check

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@PLangowski updated script in the osfv PR, tomorrow I will update its usage here

shell: bash
id: log_dirs
run: |
timestamp=$(date -u +%Y-%m-%dT%H:%M:%S%Z)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

./scripts/run.sh already does that for you

ip_addr=$(ip -o -4 addr list eno2 | awk '{print $4}' | cut -d/ -f1)

robot -L TRACE -v config:qemu -v rte_ip:127.0.0.1 -v snipeit:no \
-v dpp_password:$DPP_PASSWORD -v dpp_download_key:$MSI_DOWNLOAD \
Copy link
Contributor

@macpijan macpijan Nov 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess you could shorten execution in CI by using https://robotframework.org/robotframework/latest/libraries/OperatingSystem.html#Get%20Environment%20Variable in tests to retrieve credentials, if we assume to always get these from OS environment

source ~/.secrets/dpp-keys
ip_addr=$(ip -o -4 addr list eno2 | awk '{print $4}' | cut -d/ -f1)

robot -L TRACE -v config:qemu -v rte_ip:127.0.0.1 -v snipeit:no \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason we do not use https://github.com/Dasharo/open-source-firmware-validation/blob/develop/scripts/run.sh here? We do not want to publish full logs?

But we do not store artifacts anyway?

Please explain it here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't want to print full logs because in case of a failure they might leak DPP credentials

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If running these DTS scripts is very different than running ./run.sh script on the DTS suite, we may consider adding regression script for DTS as well, so it is easier to run it locally, as well as to have fewer changes in this CI configuration file.

Copy link
Contributor

@macpijan macpijan Nov 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But maybe it is not (or does not have to be) and we can simply run the run.sh script?

Copy link
Contributor

@macpijan macpijan Nov 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't want to print full logs because in case of a failure they might leak DPP credentials

To the terminal console?

Do we log the DPP variables to the console?

I know we might have them in HTML log files, but can we have them in the console output as well?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can use https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/workflow-commands-for-github-actions#masking-a-value-in-a-log to lessen chance that secret information gets logged.
Though I'm not sure if build logs are visible to anyone?

-v dts_ipxe_link:http://${ip_addr}:4321/dts.ipxe
-i "msi" dts/dts-e2e.robot 2>&1 | tee $LOG_DIR/output_msi.log | grep "| PASS |\|| FAIL |"

robot -L TRACE -v config:qemu -v rte_ip:127.0.0.1 -v snipeit:no \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems overly complex and scales poorly. Again, what happens if we add another platform/test in the dts-e2e.robot? We need to update the CI file as well - this is not optimal.

Why cannot we run the whole suite in one run?

We can modify the tests in the suite to set DPP variables in each test case accordingly, based on the environment variables.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will be a problem for a short period of time, because soon, when we migrate our infrastructure to MinIO, we will be able to use one set of credentials for all subscriptions. So, I would rather stay with the way it is now.

imgfetch --name file_initrd dts-base-image-genericx86-64.cpio.gz\n
kernel file_kernel root=/dev/nfs initrd=file_initrd\n
boot" > ipxe/dts.ipxe
cd ipxe && python3-m http.server 4321 &
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we certain all of these background processes are always killed when workflow is interrupted, or we need to take care of this?

This is less of a problem on GitHub runners, as each time new VM is started, but on the self-hosted runner, we may end up with zombie processes if this is not the case.

Copy link
Contributor

@macpijan macpijan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the current solution works, we may choose not to implement all of my comments right now.

But we should at some point, at least consider implementing them.

@PLangowski
Copy link
Collaborator Author

@macpijan The current solution does work. Your points are solid (especially the one with the env vars), but we need this workflow in today's release, so maybe we should implement them later? What do you think?

@macpijan
Copy link
Contributor

The current solution does work. Your points are solid (especially the one with the env vars), but we need this workflow in today's release, so maybe we should implement them later? What do you think?

We can do that, just create an issue - can be a single one linking to this MR.

@PLangowski
Copy link
Collaborator Author

@PLangowski PLangowski merged commit a763285 into develop Nov 22, 2024
1 check passed
@PLangowski PLangowski deleted the tests-ci branch November 22, 2024 11:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants