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 fwupdmgr attachment job (New) #965

Closed
wants to merge 2 commits into from

Conversation

patliuu
Copy link
Contributor

@patliuu patliuu commented Jan 25, 2024

Description

This attachment job is requested from the OEM SWE team. They'd like to parse the fwupdmgr device information from the submission.
This PR added a firmware/fwupdmgr_get_devices attachment job and the related test plan to be nested in the client-cert-desktop test plan.

The firmware/fwupdmgr_get_devices only does the following command:

fwupdmgr get-devices --json

Requires

requires:
    executable.name == "fwupdmgr"
    environment.SNAP == ""  # only execute on Debian checkbox

The tests will only be executed when fwupdmgr executable is available.
Also, we found a limitation:

Our purpose is to run the fwupdmgr command from the default deb package to get the needed information. However, while Checkbox is running in the snap environment, the fwupdmgr will try to find the snap services snap.fwupd.fwupd.service, which leads to the following daemon and client mismatch error,

root@u-Inspiron-15-5508:/home/u# fwupdmgr get-devices
Mismatched daemon and client, use fwupd.fwupdmgr instead

This environment check is written in https://github.com/fwupd/fwupd/blob/main/src/fu-util-common.c#L42

#define SYSTEMD_FWUPD_UNIT	"fwupd.service"
#define SYSTEMD_SNAP_FWUPD_UNIT "snap.fwupd.fwupd.service"

fu_util_get_systemd_unit(void)
{
	if (g_getenv("SNAP") != NULL)
		return SYSTEMD_SNAP_FWUPD_UNIT;
	return SYSTEMD_FWUPD_UNIT;
}

Using the Debian version checkbox will not encounter this problem. Currently, I don’t have any good idea to solve this problem. So I intend to add a job for Debian Checkbox for now. And the environment.SNAP == "" is to ensure the job will only be executed with Debian Checkbox.

Resolved issues

Request from SWE team
https://warthogs.atlassian.net/browse/OEMQA-3797

Tests

Sideload result on an Ubuntu Desktop 22.04 laptop with Debian Checkbox
https://pastebin.canonical.com/p/4Jf5gXDKYV/
Sideload result on an Ubuntu Desktop 22.04 laptop with Snap Checkbox -> job skipped
https://pastebin.canonical.com/p/8wnCchBnWv/

@patliuu patliuu requested review from pieqq and yphus January 25, 2024 08:56
Copy link

codecov bot commented Jan 25, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (727e004) 38.07% compared to head (b90d888) 38.02%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #965      +/-   ##
==========================================
- Coverage   38.07%   38.02%   -0.06%     
==========================================
  Files         333      333              
  Lines       36921    36869      -52     
  Branches     6302     6188     -114     
==========================================
- Hits        14059    14019      -40     
- Misses      22242    22265      +23     
+ Partials      620      585      -35     
Flag Coverage Δ
provider-base 9.97% <ø> (-0.23%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@kissiel
Copy link
Contributor

kissiel commented Jan 31, 2024

/canonical/self-hosted-runners/run-workflows b90d888

@pieqq
Copy link
Collaborator

pieqq commented Mar 1, 2024

As discussed this morning during our meeting, I'm a bit concerned about silently skipping this job just because we are running Checkbox Snap version.

I just tried bypassing the heuristic used by fwupd and it seems to be working:

# Enter the checkbox snap
$ snap run --shell checkbox.checkbox-cli

# From within the snap:
$ echo $SNAP
/snap/checkbox/5224

$ fwupdmgr get-devices
Mismatched daemon and client, use fwupd.fwupdmgr instead

$ unset SNAP

# Now the command works!
$ fwupdmgr get-devices
Dell Inc. Precision 3570
│
├─12th Gen Intel Core™ i7-1265U:
(...)

So maybe an easy fix is just to unset the SNAP environment variable before running the command, and set it back after.

@pieqq
Copy link
Collaborator

pieqq commented Mar 20, 2024

I opened an issue in the fwupd project:

fwupd/fwupd#6946

Copy link
Collaborator

@pieqq pieqq left a comment

Choose a reason for hiding this comment

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

Based on previous comment, this should be reworked to use the workaround to allow calling fwupdmgr from within the Checkbox snap.

@stanley31huang
Copy link
Collaborator

Closing this PR due to I have filed another one for this feature.
#1089

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.

4 participants