Skip to content

Conversation

@blackboxsw
Copy link
Collaborator

@blackboxsw blackboxsw commented Feb 7, 2026

Resolve PEP440 version warnings about@MISSING_MESON_BUILD_ARTIFACT@ python3 setup.py clean, build or install stages by providing debian/rules $(DEB_VERSION) to the patched setup_utils.py. This allows us to avoid either python3-setuptools-scm dependencies or complex override_dh_auto_(clean|build|install) stages to attempt to create meson_versions.py.

This branch represents 4 actions:

  • new_upsream_snapshot.py
  • Update debian/rules to export PACKAGED_VERSION=$(DEB_VERSION)
  • Simplify d/p/retain-setuptools by dropping tools.read-version and simplify setup_utils.py get_version to read os.environ("PACKAGED_VERSION")
  • update changelog

Proposed Commit Message

See individual commits

Additional Context

Test Steps

One can test the build environment behavior with the following:

$ quilt push -a
$ python3 setup.py --version
# expected error because we are missing MISSING_ENVVAR_DEB_VERSION env var
...
packaging.version.InvalidVersion: Invalid version: 'MISSING_ENVVAR_DEB_VERSION'


$ PACKAGED_VERSION=25.3-0ubuntu1~22.04.2 python3 setup.py --version
25.3
quilt pop -a

Merge type

  • Squash merge using "Proposed Commit Message"
  • Rebase and merge unique commits. Requires commit messages per-commit each referencing the pull request number (#<PR_NUM>)

MoeSalah1999 and others added 30 commits December 19, 2025 08:35
-made sure test case classes don't inherit from TestCase
-used pytest fixtures instead of unittest setUp method
-converted all self.assert to plain assert.

Related canonicalGH-6427
disable-sshd-keygen-if-cloud-init-active.conf seems to have been added twice.
Fix it.

Also replace '/usr/lib/systemd/system' by the macro %{_unitdir} to make the
spec file more portable across distros.

Signed-off-by: Ani Sinha <anisinha@redhat.com>
Add test_ds_identify functionality to provide environment variables to
tests using PATH_DI_ENV.
)

When ephemeral networking is brought up in Azure, the selected interface
(`iface`) is `None` under certain conditions. This change introduces 
a helper function `find_primary_nic()` which uses 
`net.find_candidate_nics()` to determine and select the system's primary 
network interface if one is not explicitly set.

Additional improvements:
- Log the MAC address and driver of the selected NIC for easier debugging.
- Ensure the DHCP retry loop updates `iface` to the current primary NIC before
  retrying to obtain a lease.

Fixes canonical#6558
The "has_gnu_date" function checks "date --help" output, but some
versions of "date" don't include a "--help" flag.
`time.strftime()` has platform-specific behavior when dealing with
a `gmtime()` struct.
It was removed in canonical#6356, but is still needed in some tests that
interact with `/tmp`.
Many socket attributes are OS-specific, so ensure we
have attributes that work for the tests that need them.
Also, mock socket calls where needed.
'echo -n' isn't universal
Note that this test wasn't always Linux-specific, but when the pid
stuff moved under Distro, the test was changed to test the base
class (i.e., Linux) functionality only.
Implementation differences cause different results.
In DataSourceCloudStack.py, get_newest_lease() is currently being
passed a Distro object, causing a Python type error. This PR
changes the Distro object to the interface string to fix this error.
Add VM ID to the KVP (Key-Value Pair) event key format to improve
telemetry tracking and debugging capabilities for Azure/Hyper-V
deployments.
The EC2 datasource checks all NICs one by one to see which can reach the
metadata server. This can lead to slow boot if the primary NIC is not
checked first. We use the fact that typically the primary NIC on an EC2
instance will be the lowest numbered Elastic interface (either ENA or
EFA) and order these first. Only then checking other network devices
that may be present.

Fixes canonicalGH-6618

Signed-off-by: Zachary Raines <zachary.raines@canonical.com>
blackboxsw and others added 6 commits February 2, 2026 08:46
cloud-init project now requires full SHA commits instead of tags for
all workflows to utilize a more secure policy for CI runners.

Any Github actions lacking full SHA pins in workflows/actions will
error due to repo prevention policy.

Additionally update SHA pins to latest known workflow releases.
…cal#6707)

Fixes DNS queries for IP addresses that cause 2+ minute boot delays
with systemd 259+. Moves IP detection earlier in is_resolvable() and
removes legacy DNS-dependent metadata URL.

Fixes canonicalGH-6641
Various pages in the table of contents documented things that are not
useful without some other context. Remove these from the table of
contents and link to them from pages that have that context.

Introduce new "advanced" pages under the reference and explanation
categories to link to pages which are not suitable for the average user.

Other pages contained implementation details. Remove the implementation
details or move the page to be under the new "advanced" pages.

Introduce a new "project status" page to gather project-related info.

Delete content and pages containing duplicate information.

Don't make security policy recommendations to users.

Remove page documenting the performance analysis subcommand, since there
are more accurate ways of analyzing performance.

File deletions
--------------

about-cloud-config.rst
performance_analysis.rst

File renames
------------

faq.rst -> from reference to explanation
user_files.rst -> from reference to explanation
module_run_frequency -> from how-to to reference
test_unreleased_packages -> from howto to reference
foramt.rst -> format/index.rst (and sub-pages)
@blackboxsw blackboxsw requested a review from holmanb February 7, 2026 22:32
@github-actions github-actions bot added the packaging Supplemental package review requested label Feb 7, 2026
@blackboxsw blackboxsw force-pushed the ubuntu/jammy branch 2 times, most recently from 858ac97 to a9b4ffd Compare February 7, 2026 22:37
Copy link
Collaborator Author

@blackboxsw blackboxsw left a comment

Choose a reason for hiding this comment

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

I wanted to avoid introducing extra package dependencies in debian/control for jammy or noble on python3-setuptools-scm. Instead we can "set" the right python package version (and egg info) by providing a PACKAGED_VERSION environment variable which is sourced by setup_tools.get_version


# This one is currently used only by the CloudSigma and SmartOS datasources.
--- /dev/null
+++ b/tools/read-version
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Drop tools/read-version because we have simplified setup_utils.py to only look at os.environ("PACKAGED_VERSION") which is now provided by our debian/rules file

+ cmd = [sys.executable, "tools/read-version"]
+ ver = subprocess.check_output(cmd) # B603
+ version = ver.decode("utf-8").strip()
+ ver = os.environ.get("PACKAGED_VERSION", "MISSING_ENVVAR_PACKAGE_VERSION")
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Avoid shelling out to a script we no longer need. This get_version is called by setup.py during clean, build and install stages and we don't want to have to override the value returned when those stages don't yet have a modified cloudinit/version.py file.

This version retuerned is validated by setuptools and gets a warning in jammy when it doesn't adhere to PEP440. In noble, it's a hard error for the same non-PEP440 compliance.

@blackboxsw blackboxsw force-pushed the ubuntu/jammy branch 3 times, most recently from 049e5b3 to 8a66d27 Compare February 7, 2026 22:57
+ # that should give us a valid version.
+ return version.replace("-", "+", 1)
+ # which is invalid under PEP 440. Redact it to only major.minor.patch
+ return version.strip("_").split("-")[0]
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This function is only used by setuptools during python3 setup clean, build, install etc. And generates a PEP440 warning in jammy and error in noble if we don't present simple MAJOR.MINOR.PATCH version strings. This version is exposed in the egg-info included in packaging which historically adheres to the format cloud_init-25.2.egg-info. We don't expose the downstream ubuntu version suffixes.

@holmanb
Copy link
Member

holmanb commented Feb 10, 2026

This branch has conflicts that need to be resolved.

debian/changelog Outdated
Comment on lines 5 to 6
* d/rules: update replace DOWNSTREAM_VERSION string to DEB_VERSION value and
export PACKAGED_VERSION environment variable
Copy link
Member

Choose a reason for hiding this comment

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

This comment is a bit confusing and probably adds more detail than necessary. Can we rewrite it in a way that explains what / why we made the change rather than what the change is?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

packaging Supplemental package review requested

Projects

None yet

Development

Successfully merging this pull request may close these issues.