Skip to content

Releases: canonical/operator

3.2.0: ops will log security events

27 Aug 22:58
77976ac
Compare
Choose a tag to compare

With this release, Ops will send security event logs to Juju's log; for example, when there is a permission error getting relation or secret data. This is logged at TRACE level, so should not be noticeable in most cases, and is intended to be used in later work rather than by charms themselves.

A typing-only change has been made to support Pebble's new opentelemetry log target.

On the testing front, scenario now supports setting the JUJU_MACHINE_ID variable in the mocked environment.

Over the last month, we refreshed the Ops docs landing page, moved to documentation.ubuntu.com/ops, and removed the .html suffix from pages. We expect that this will be the last big renaming for the docs for a while now.

What's Changed

Features

  • Add security event logging in #1905
  • Surface JUJU_MACHINE_ID envvar in testing env in #1961
  • Add a new log target type opentelemetry in #1937

Documentation

  • Update links and config for switch to documentation.ubuntu.com/ops in #1940
  • Update the required Python version and note the 2.x documentation site in #1946
  • Be consistent with recommending self.config in #1947
  • Use latest styles from starter pack and remove .html extensions in #1951
  • Remove .html extensions from hardcoded links in #1955
  • Fix broken URLs in sitemap in #1956
  • Add related doc links to homepage in #1959
  • Use classes from ops instead of ops. in #1968
  • Fix unstyled error pages in #1969
  • Add Google Analyics integration and cookie consent banner in #1971
  • Refresh docs homepage with more context about Ops in #1964
  • Update link to Charmlibs docs in #1985
  • Remove unnecessary pages from sitemap in #1979
  • Update the httpbin charm to jubilant in #1987
  • Update zero to hero to jubilant in #1988
  • Add model-config best practice note in #1990
  • Change some best practices to tips in #2001
  • Add integration test for invalid config in httpbin charm in #2002
  • Make a Layer instead of a LayerDict in the httpbin charm in #2003
  • Update how-to to feature Jubilant (1/2) in #2000
  • Use Charmcraft-style format and lint for example charms, not Ops-style in #2008
  • Update broken link to HookVars source code in #2006
  • Update how-to to feature Jubilant (2/2) in #2004

CI

  • Fixes for the sbom and secscan workflow, and trigger it on publishing in #1916
  • Store the charmcraft logs if packing fails in #1936
  • Install release dependencies for the TIOBE analysis in #1930
  • Add Juju 4/beta to the smoke test matrix in #1963
  • Adjust permissions block in publish workflow in #1984
  • Update actions/checkout to v5 in #1993
  • Enable doctests in #1991
  • Ignore juju/4 timeouts in #1998
  • Remove the token for SBOM and secscan on publish in #2009
  • Speed up integration test in #1978

Full Changelog: 3.1.0...3.2.0

3.1.0: app_name and unit_id available from testing.Context

30 Jul 02:21
c12daf3
Compare
Choose a tag to compare

This release exposes the app name and unit ID in the testing Context. In addition, a number of bugs are fixed, particularly ones introduced with the recent change to exposing the relation data of departed units.

What's Changed

Features

  • Release automation script in #1855
  • Add app_name and unit_id attributes to testing.context in #1920

Fixes

  • If an event ends with _Abort(0) tests should behave as if it ended successfully in #1887
  • If self.app is not actually set avoid a new crash location in #1897
  • Only add the remote unit for departed and broken relation events, fix ordering in #1918
  • Add the remote unit to Relation.data but not Relation.units in #1925

Documentation

  • Use load_config in the httpbin example charm in #1852
  • Update HACKING.md with how to bump ops version in Charmcraft profiles in #1872
  • Change title of docs site in #1890
  • Use config and action classes in the Kubernetes tutorial in #1891
  • Reference example charms from K8s tutorial and fix consistency in #1898
  • Update style guide in #1720
  • Fix issues in how-to guide for stored state in #1901
  • Link out to the 12-factor tutorials from the tutorial index page in #1902
  • Replace broken link in testing explanation in #1913
  • Expand the storage how-to with content from juju docs scheduled for removal in #1915
  • Ops tracing how to in #1853
  • Add a security explanation doc in #1904

Tests

  • Replace Python version to 3.10 for observability charm tests in #1914

CI

  • Use httpbin demo charm for the charmcraft pack test in #1895
  • Move TIOBE workflow to self-hosted runners in #1912
  • Add SBOM generation and secscan workflow in #1906
  • Build and publish in one step in #1857
  • Update the name and email when updating the charm pins in #1924
  • Drop smoke test against 20.04 in #1923

Full Changelog: 3.0.0...3.1.0

2.23.1: Add the remote unit to Relation.data, but not Relation.units

30 Jul 06:26
df1209d
Compare
Choose a tag to compare

This is a small bug-fix release for the 2.x series that addresses issues with the recent feature making relation data available in relation-departed events. Rather than inserting the remote unit into Relation.units, the data is available from Relation.data, without changing Relation.units.

What's Changed

Fixes

  • Add the remote unit to Relation.data but not Relation.units in #1928

Documentation

  • Be consistent with recommending self.app and self.unit in #1856
  • Add notice about ops 2 and ops 3 in #1867
  • Update title and edit links for ops 2.23 docs in #1885

CI

  • Hotfix, publish job for ops-tracing in #1865

Full Changelog: 2.23.0...2.23.1

Ops 3.0.0, ops-tracing 3.0.0 and ops-scenario 8.0.0 Require Python 3.10

02 Jul 10:39
5e0d22b
Compare
Choose a tag to compare

This release removes support for Python 3.8 and Ubuntu 20.04, but is otherwise compatible with Ops 2. If you have a charm that needs to support Python 3.8, you can continue to use Ops 2, which will still receive security and critical bug fixes.

What's Changed

Documentation

  • Be consistent with recommending self.app and self.unit in #1856

CI

  • Hotfix, publish job for ops-tracing in #1865

Full Changelog: 2.23.0...3.0.0

2.23.0.post1

30 Jun 08:42
af8c84a
Compare
Choose a tag to compare

CI

  • hotfix, publish job for ops-tracing in #1865

Full Changelog: 2.23.0...2.23.0.post1

Ops 2.23.0, ops-tracing 2.23.0 and ops-scenario 7.23.0 enhanced schema support and testing improvements

30 Jun 07:29
ec2dc3f
Compare
Choose a tag to compare

This release introduces enhancements focused on improving developer experience and code reliability. Key features include support for defining configuration, action, and relation data schemas using Python classes, streamlining data validation and reducing boilerplate. The release also enhanced testing and tracing capabilities, such as improved access to trace data and utilities for creating testing states, alongside several bug fixes addressing issues in relation handling, OpenTelemetry integration, and testing mocks.

This is the last feature release in the 2.x series, with only security and critical bugfixes in the future. Ops 3 will not support Python 3.8 and Ubuntu 20.04. Otherwise, Ops 3 will be backwards compatible with Ops 2.

What's Changed

Features

  • Support for config schema as Python classes in #1741
  • Support for action parameter schema as Python classes in #1756
  • Ops[tracing] compatibility with jhack in #1806
  • Support for relation data schema as Python classes in #1701
  • Add CheckInfo.successes field and .has_run property in #1819
  • Provide a method to create a testing.State from a testing.Context in #1797
  • Expose trace data in testing in #1842
  • Add a helper to generate a Layer from rockcraft.yaml in #1831

Fixes

  • Correctly load an empty Juju config options map in #1778
  • Fix type annotation of container check_infos in ops.testing in #1784
  • Restrict the version of a dependency, opentelemetry-sdk in #1794
  • Remote unit data is available in relation-departed in #1364
  • Juju allows access to the remote app databag in relation-broken, so Harness should too in #1787
  • Don't use private OpenTelemetry API in #1798
  • Do not return this unit in a mocked peer relation in #1828
  • Testing.PeerRelation properly defaults to no peers in #1832
  • In meter-status-changed JUJU_VERSION is not set in #1840
  • Only provide the units belonging to the app in Relation.units in #1837

Documentation

  • Remove two best practices, and drop two to tips in #1758
  • Update link to Charmcraft for managing app config in #1763
  • Update link to Juju documentation for setting up deployment in #1781
  • Fix external OTLP link in #1786
  • Distribute the ops-scenario README content across the ops docs in #1773
  • Improve testing.errors.UncaughtCharmError message in #1795
  • In the "manage the charm version" how-to, give an example of using override-build in #1802
  • Small adjustments to the 'how to trace charm code' doc in #1792
  • Replace Harness example and fix links in README in #1820
  • Add httpbin charm from Charmcraft as an example charm in #1743
  • Fix on_collect mistake in sample code in #1829
  • Update code in K8s tutorial, with source in repo (part 2) in #1734
  • Update Loki section on charming zero-to-hero tutorial in #1847
  • Remove expandable boxes of text in #1844
  • Improve httpbin charm by removing defer() and adding collect_status in #1833
  • Move {posargs} to the end of pytest command lines in tox.ini in #1854

CI

  • Install the ops[tracing] dependencies for the TIOBE action in #1761
  • Add ops-scenario and ops-tracing as explicit installs for TIOBE in #1764
  • Persist credentials for update-charm-pins workflow in #1766
  • Stop smoke testing Charmcraft 2 in #1782
  • Use Charmcraft 3.x for smoke testing 20.04 and 22.04 in #1821
  • Enable xdist for the 'unit' tox environments in #1830

Full Changelog: 2.22.0...2.23.0

Ops 2.22.0, ops-tracing 2.22.0 and ops-scenario 7.22.0 tracing resource attributes for Juju topology

29 May 04:18
e72e9b8
Compare
Choose a tag to compare

What's Changed

This release improves ops[tracing] by adding Juju topology resource attributes, including charm, juju_model, and juju_unit.

We've also documented how to access the Pebble metrics endpoint, which provides metrics for services and health checks in OpenMetrics format.

Features

  • Add Juju topology labels in #1744

Fixes

  • Turn on databag access validation in __init__ in #1737
  • Allow event suffixes to appear in event names in ops.testing in #1754

Documentation

  • Document how to manage metrics in #1692
  • Link to our docs from the top of our README in #1710
  • Update code in K8s tutorial, with source in repo (part 1) in #1719
  • Update links to juju.is/docs in #1725
  • Fix link in breakpoint output, remove link from Harness error message in #1726
  • Update Matrix channel name to Charm Tech in #1740
  • Rename configurations to configuration in #1746
  • Fix typos in code snippets by @MattiaSarti in #1750

CI

  • Add ops[tracing] integration tests in #1686
  • Pin workflows by hash in #1721
  • Disable alertmanager compatibility tests until upstream fix in #1745
  • Remove explicit scopes and update HACKING.md in #1748
  • Pin trusted workflows by tag in #1752
  • Re-enable alertmanager-k8s-operator in observability charm tests in #1753
  • Fix reporting to TIOBE after ops[tracing] addition in #1755

New Contributors

Full Changelog: 2.21.1...2.22.0

Ops 2.21.1, ops-tracing 2.21.1 and ops-scenario 7.21.1 reverting fresh charm instance for deferred events

01 May 03:02
8e4877f
Compare
Choose a tag to compare

What's Changed

This hot-fix release reverts the 2.21.0 change where separate charm class instances were used to run deferred events. That change was not compatible with a certain charming practice where custom upgrade code is run before event processing. We're reverting for now and will discuss with the charming teams what the way forward may be.

Reverted

  • Reverting "run deferred events with fresh charm instances" in #1711

Documentation

  • Add best practices about status in #1689

Full Changelog: 2.21.0...2.21.1

Ops 2.21.0, ops-tracing 2.21.0 and ops-scenario 7.21.0 Native tracing support in ops and support for Pebble identities

30 Apr 04:05
9ab739e
Compare
Choose a tag to compare

What's Changed

This release adds ops[tracing], the first-party tracing support for your charms, support for reading and setting Pebble identities and a change where a new instance of the charm class is used for each deferred event.

Potential gotchas

Due to canonical/charmcraft#2259, your charm may not build against 20.04 base, if you are using requirements.txt or other mechanism that enforces building all dependencies from source. Please wait for charmcraft 3.4 hot fix or migrate to the uv plugin. The issue is not unique to ops, however this release brings in a new dependency that is affected. If yours is a simple charm without complex charm libs, you may be able work around the issue by restricting your dependencies, like ops <= 2.20.0.

Each deferred event is now run in a fresh instance of your charm class. The change should be safe for most charms, however, if your charm defers events and shares data between the deferred event and the current event in the charm class, please test thoroughly. The Ops pre-commit and commit events are also now emitted after each deferred event, so if you use those and defer, please check that it's safe to have them run more than once per hook.

Features

  • Ops[tracing] (with a first-party charm lib) in #1612
  • Pebble identities in #1672
  • Run deferred events with fresh charm instances in #1631

Fixes

  • Allow TLS 1.2 in ops-tracing in #1705
  • Try to fix flaky pebble exec test in #1664

Documentation

  • Add best practice note around using tooling provided by the charmcraft profile in #1700
  • Clarify guidance about designing python modules in #1670
  • Fix a bug in the k8s tutorial doc about unit test in #1688
  • Fix broken link in readme in #1679
  • Fix links to juju docs in #1681
  • Fix tox command in hacking.md in #1661
  • Improve landing page of kubernetes charm tutorial in #1660

CI

  • Add zizmor to static check github workflows in #1656
  • Change prerelease setting used to add latest ops and the testing API in #1682
  • Don't pin release jobs to github environments in #1683
  • Don't run tests within the publish job in #1684
  • Fix smoke test in #1698
  • Post-release versioning, release process update + workflow fix in #1658
  • Rename "tox -e fmt" to "tox -e format" in #1668

Tests

  • Fix overly specific test that fails sometimes with tracing in #1695

Full Changelog: 2.20.0...2.21.0

ops 2.20.0 and ops-scenario 7.20.0 remove_revision, remote_model, config metadata, custom events in testing, pebble layer merging fixes in testing, and docs improvements

31 Mar 20:40
1500719
Compare
Choose a tag to compare

What's Changed

This release of ops features a new remove_revision() convenience method to avoid working directly with revision numbers in secret-remove and secret-expired events. A new remote_model property has been added for Relation. The efficiency of RelationData.Content.update has also been improved, and the config metadata is now exposed in CharmMeta.

This ops-scenario release features the ability to emit custom events, as well as additional data verification and stronger immutability. Additionally, Pebble layer merging has been fixed, both in this package and in Harness.

Our documentation continues to improve. We migrated best practices from the Juju docs and made the Kubernetes charm tutorial shorter and more focused. We also reorganised the testing docs into a single how-to guide about unit testing and a more accessible explanation about testing in general.

Features

  • Add a remove_revision() method to SecretRemoveEvent and SecretExpiredEvent in #1624
  • Add Relation.remote_model property in #1610
  • Efficient implementation of RelationDataContent.update in #1586
  • Expose the config metadata in CharmMeta in #1648
  • Add the ability to emit custom events in unit tests in #1589
  • Check that the check-infos in testing.Container match the plan in #1630
  • ops.testing.State components are less mutable in #1617

Fixes

  • Assorted fixes for Pebble layer merging in Harness and Scenario in #1627

Documentation

  • Add a docs link to the Harness deprecation warning in #1513
  • Add best practices and a "manage charms" how-to in #1615
  • Add section about services with long startup time in #1604
  • Clarify how to use mounts in ops.testing.Container in #1637
  • Fix code snippet indentation in #1649
  • Fix Scenario example in #1616
  • Move hooks-based charm migration guide in #1636
  • Putting test into each chapter of the tutorial in #1647
  • Refactor how-to unit test according to comments in #1642
  • Refactor test docs to 1 explanation and 2 how-tos in #1628
  • Remove the charm-tech@lists.launchpad.net email address in #1632
  • Remove tutorial chapters that are covered by the how-to guide in #1511
  • Stack args vertically for long signature lines in #1641
  • Testing explanation in #1635
  • Unify charm test docs how to in #1639

CI

  • Exclude vault-k8s-operator until the system can handle monorepos in #1650
  • Use the latest version of ops-scenario in the compatibility tests in #1608

Full Changelog: 2.19.2...2.20.0