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

Cherry-pick Ubuntu Pro patches for 23.02.1 #1543

Merged
merged 5 commits into from Jan 30, 2023

Conversation

ogayot
Copy link
Member

@ogayot ogayot commented Jan 30, 2023

The patchset includes:

  • a bugfix for ubuntu pro: b070c30
  • more ways to test ubuntu pro in dry-run mode: fa6fcd7 (which is not ubuntu pro specific) + cd38c06 and 1bb8f60
  • the activation of the ubuntu pro screens on LTS releases: d999b7b

The addition of the dryrun machinery can feel out of place but it only affects dry-run so it should have very low risk on normal installs.

Oftentimes, we want to simulate a specific behavior of the application
when running in dry-run mode. To do so, we use either command line
parameters or environment variables.

This patch introduces a configuration object for dry-run executions
only. The object can be automatically loaded from a JSON file specified
via the --dry-run-config CLI argument.

Such a configuration object should help us cover way more test cases.
Going forward, I would like to use this object for things like:

 * drivers - to instruct Subiquity what third-party drivers it should
   suggest ; or if Subiquity should run ubuntu-drivers on the host
   instead.
 * ubuntu-pro - to specify the ua-contracts test environment URL - or
   predefined automatic replies for the server
 * to assume that /var/lib/snapd/seed/systems directory exists on the
   source (or not).
 * to specify the Ubuntu release that is returned by lsb_release ; can
   be used to test behavior on LTS vs non LTS releases.
 *
 * ...

(cherry picked from commit 93f06ee)
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
In dry-run mode, the 'magic_attach_run_locally' variable can now be used
to execute uaclient on the host (against the uacontracts environment
specified in /etc/ubuntu-advantage/uaclient.conf) instead of relying on
a mock mechanism.

(cherry picked from commit d74a506)
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
In dry-run mode, instead of reading the uacontracts environment URL from
/etc/ubuntu-advantage/uaclient.conf, we can now override this variable
by specifying the 'pro_ua_contracts_url' dry-run parameter.

In conjunction with 'pro_magic_attach_run_locally', this allows us to
test Subiquity against testing environments. By default it will use the
staging environment (i.e., https://contracts.staging.canonical.com).

(cherry picked from commit fc056b0)
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
Upon reaching the Ubuntu Pro screen that shows the user-code, we need to
initiate a contract selection. If we are navigating to the screen a
second time though, we need to cancel existing contract selections
before initiating a new one.

Failing to do so results in a UPCSAlreadyInitiatedError.

(cherry picked from commit 0736885)
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
The version of ubuntu-advantage-tools present in focal-updates contains
all we need with regard to the magic attach implementation.

Although we are still missing the ubuntu.com/pro/attach screens, they
should get active in the near future. It should be enough for testing.

(cherry picked from commit 9ec0ce7)
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
@ogayot ogayot changed the title Cherry-pick Ubuntu Pro patches for 22.04.2 Cherry-pick Ubuntu Pro patches for 23.02.1 Jan 30, 2023
Copy link
Collaborator

@dbungert dbungert left a comment

Choose a reason for hiding this comment

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

Nice work. I have done a test build against today's Jammy daily and the attach was painless.

@ogayot ogayot merged commit cc0301a into canonical:ubuntu/kinetic Jan 30, 2023
@ogayot ogayot deleted the ubuntu-pro-22.04.2 branch January 30, 2023 18:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants