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

sequencer: only load project vars in adopting part (#509) #516

Conversation

cmatsuoka
Copy link
Collaborator

Project variables exist only in the part scope and should be ignored
in other parts' states. In the existing implementation these values
are persisted in each part, which leads to double assignment errors
when a step is executed for parts in a order that's different from
the previous execution (see example in LP #1831135).

There are different ways to address this issue, the current fix
tries to be minimally disruptive by just ignoring persisted values
when reloading the state. We can refactor this code later to have
a cleaner implementation.

Signed-off-by: Claudio Matsuoka [email protected]

  • Have you signed the CLA?

Copy link
Contributor

@tigarmo tigarmo left a comment

Choose a reason for hiding this comment

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

This is just a cherry-pick right? LGTM

Copy link
Contributor

@lengau lengau left a comment

Choose a reason for hiding this comment

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

I've made PRs to fix the lint/test failures by doing the same cherry-picks we needed for the 1.19 branch. See #519 and #520

@cmatsuoka cmatsuoka force-pushed the 1.23.1/project-vars-restricted-to-part branch from b2c7a7a to d49cc77 Compare August 14, 2023 13:39
@cmatsuoka
Copy link
Collaborator Author

Rebased on top of hotfix/1.23.1

Project variables exist only in the part scope and should be ignored
in other parts' states. In the existing implementation these values
are persisted in each part, which leads to double assignment errors
when a step is executed for parts in a order that's different from
the previous execution (see example in LP #1831135).

There are different ways to address this issue, the current fix
tries to be minimally disruptive by just ignoring persisted values
when reloading the state. We can refactor this code later to have
a cleaner implementation.

Signed-off-by: Claudio Matsuoka <[email protected]>
@cmatsuoka cmatsuoka force-pushed the 1.23.1/project-vars-restricted-to-part branch from d49cc77 to bc59225 Compare August 15, 2023 12:33
@cmatsuoka cmatsuoka merged commit e69e19c into canonical:hotfix/1.23.1 Aug 15, 2023
7 checks passed
syu-w referenced this pull request in canonical/charmcraft Sep 15, 2023
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [craft-cli](https://togithub.com/canonical/craft-cli) | `==2.0.1` ->
`==2.1.0` |
[![age](https://developer.mend.io/api/mc/badges/age/pypi/craft-cli/2.1.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/pypi/craft-cli/2.1.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/pypi/craft-cli/2.0.1/2.1.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/pypi/craft-cli/2.0.1/2.1.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
| [craft-parts](https://togithub.com/canonical/craft-parts) | `==1.23.0`
-> `==1.24.1` |
[![age](https://developer.mend.io/api/mc/badges/age/pypi/craft-parts/1.24.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/pypi/craft-parts/1.24.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/pypi/craft-parts/1.23.0/1.24.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/pypi/craft-parts/1.23.0/1.24.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
| [snap-helpers](https://togithub.com/albertodonato/snap-helpers)
([changelog](https://togithub.com/albertodonato/snap-helpers/blob/main/CHANGES.rst))
| `==0.4.0` -> `==0.4.2` |
[![age](https://developer.mend.io/api/mc/badges/age/pypi/snap-helpers/0.4.2?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/pypi/snap-helpers/0.4.2?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/pypi/snap-helpers/0.4.0/0.4.2?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/pypi/snap-helpers/0.4.0/0.4.2?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>canonical/craft-cli (craft-cli)</summary>

###
[`v2.1.0`](https://togithub.com/canonical/craft-cli/releases/tag/2.1.0)

[Compare
Source](https://togithub.com/canonical/craft-cli/compare/2.0.1...2.1.0)

Special thanks to the contributors that made this release happen:
[@&#8203;lengau](https://togithub.com/lengau) and
[@&#8203;tigarmo](https://togithub.com/tigarmo)

##### Full list of changes

- tests: move test module from unit/ to integration/
[@&#8203;tigarmo](https://togithub.com/tigarmo)
([#&#8203;167](https://togithub.com/canonical/craft-cli/issues/167))
- ci: fix renovate schedule
[@&#8203;lengau](https://togithub.com/lengau)
([#&#8203;168](https://togithub.com/canonical/craft-cli/issues/168))
- emitter: add "streaming brief" feature
[@&#8203;tigarmo](https://togithub.com/tigarmo)
([#&#8203;166](https://togithub.com/canonical/craft-cli/issues/166))

</details>

<details>
<summary>canonical/craft-parts (craft-parts)</summary>

###
[`v1.24.1`](https://togithub.com/canonical/craft-parts/compare/1.24.0...1.24.1)

[Compare
Source](https://togithub.com/canonical/craft-parts/compare/1.24.0...1.24.1)

###
[`v1.24.0`](https://togithub.com/canonical/craft-parts/releases/tag/1.24.0)

[Compare
Source](https://togithub.com/canonical/craft-parts/compare/1.23.1...1.24.0)

##### What's Changed

- Release 1.19.6 by [@&#8203;cmatsuoka](https://togithub.com/cmatsuoka)
in
[https://github.com/canonical/craft-parts/pull/473](https://togithub.com/canonical/craft-parts/pull/473)
- partitions: add feature and validation by
[@&#8203;mr-cal](https://togithub.com/mr-cal) in
[https://github.com/canonical/craft-parts/pull/489](https://togithub.com/canonical/craft-parts/pull/489)
- tests: add jammy packages to stage package apt cache by
[@&#8203;mr-cal](https://togithub.com/mr-cal) in
[https://github.com/canonical/craft-parts/pull/494](https://togithub.com/canonical/craft-parts/pull/494)
- partitions: validate usage of partitions in parts by
[@&#8203;mr-cal](https://togithub.com/mr-cal) in
[https://github.com/canonical/craft-parts/pull/493](https://togithub.com/canonical/craft-parts/pull/493)
- deps: freeze pydantic-yaml <1.0.0 by
[@&#8203;lengau](https://togithub.com/lengau) in
[https://github.com/canonical/craft-parts/pull/498](https://togithub.com/canonical/craft-parts/pull/498)
- docs: update Sphinx theme by
[@&#8203;dboddie](https://togithub.com/dboddie) in
[https://github.com/canonical/craft-parts/pull/501](https://togithub.com/canonical/craft-parts/pull/501)
- docs: fix product page URL by
[@&#8203;dboddie](https://togithub.com/dboddie) in
[https://github.com/canonical/craft-parts/pull/506](https://togithub.com/canonical/craft-parts/pull/506)
- deps: freeze pydantic version by
[@&#8203;lengau](https://togithub.com/lengau) in
[https://github.com/canonical/craft-parts/pull/511](https://togithub.com/canonical/craft-parts/pull/511)
- tests: add jammy packages to stage package apt cache
([#&#8203;494](https://togithub.com/canonical/craft-parts/issues/494))
by [@&#8203;lengau](https://togithub.com/lengau) in
[https://github.com/canonical/craft-parts/pull/512](https://togithub.com/canonical/craft-parts/pull/512)
- partitions: add utility to make partition compatible filepaths by
[@&#8203;mr-cal](https://togithub.com/mr-cal) in
[https://github.com/canonical/craft-parts/pull/497](https://togithub.com/canonical/craft-parts/pull/497)
- sequencer: only load project vars in adopting part by
[@&#8203;cmatsuoka](https://togithub.com/cmatsuoka) in
[https://github.com/canonical/craft-parts/pull/509](https://togithub.com/canonical/craft-parts/pull/509)
- Release 1.19.7 by [@&#8203;cmatsuoka](https://togithub.com/cmatsuoka)
in
[https://github.com/canonical/craft-parts/pull/515](https://togithub.com/canonical/craft-parts/pull/515)
- docs: disable pdf in .readthedocs.yml by
[@&#8203;sergiusens](https://togithub.com/sergiusens) in
[https://github.com/canonical/craft-parts/pull/510](https://togithub.com/canonical/craft-parts/pull/510)
- executor: add prologue INFO-level log messages by
[@&#8203;tigarmo](https://togithub.com/tigarmo) in
[https://github.com/canonical/craft-parts/pull/518](https://togithub.com/canonical/craft-parts/pull/518)
- feature: add partitions by
[@&#8203;lengau](https://togithub.com/lengau) in
[https://github.com/canonical/craft-parts/pull/517](https://togithub.com/canonical/craft-parts/pull/517)
- Merge/1.19.7 by [@&#8203;cmatsuoka](https://togithub.com/cmatsuoka) in
[https://github.com/canonical/craft-parts/pull/522](https://togithub.com/canonical/craft-parts/pull/522)
- docs: make Python plugin reference reusable by
[@&#8203;dboddie](https://togithub.com/dboddie) in
[https://github.com/canonical/craft-parts/pull/505](https://togithub.com/canonical/craft-parts/pull/505)
- ci: fix renovate scheduling by
[@&#8203;lengau](https://togithub.com/lengau) in
[https://github.com/canonical/craft-parts/pull/523](https://togithub.com/canonical/craft-parts/pull/523)
- Merge 1.23.1 by [@&#8203;cmatsuoka](https://togithub.com/cmatsuoka) in
[https://github.com/canonical/craft-parts/pull/527](https://togithub.com/canonical/craft-parts/pull/527)
- chore: fix doc and yaml linting by
[@&#8203;lengau](https://togithub.com/lengau) in
[https://github.com/canonical/craft-parts/pull/529](https://togithub.com/canonical/craft-parts/pull/529)
- lint: update and freeze pyright by
[@&#8203;lengau](https://togithub.com/lengau) in
[https://github.com/canonical/craft-parts/pull/531](https://togithub.com/canonical/craft-parts/pull/531)
- partitions: make partitions optional in ProjectDirs by
[@&#8203;lengau](https://togithub.com/lengau) in
[https://github.com/canonical/craft-parts/pull/528](https://togithub.com/canonical/craft-parts/pull/528)
- docs: fix tox documentation builds by
[@&#8203;dboddie](https://togithub.com/dboddie) in
[https://github.com/canonical/craft-parts/pull/502](https://togithub.com/canonical/craft-parts/pull/502)
- environment: add build-on and build-for architectures by
[@&#8203;cmatsuoka](https://togithub.com/cmatsuoka) in
[https://github.com/canonical/craft-parts/pull/532](https://togithub.com/canonical/craft-parts/pull/532)
- autotools plugin: support bootstrap parameters by
[@&#8203;sergiusens](https://togithub.com/sergiusens) in
[https://github.com/canonical/craft-parts/pull/533](https://togithub.com/canonical/craft-parts/pull/533)
- Release 1.24.0 by [@&#8203;cmatsuoka](https://togithub.com/cmatsuoka)
in
[https://github.com/canonical/craft-parts/pull/534](https://togithub.com/canonical/craft-parts/pull/534)

**Full Changelog**:
canonical/craft-parts@1.23.1...1.24.0

###
[`v1.23.1`](https://togithub.com/canonical/craft-parts/releases/tag/1.23.1)

[Compare
Source](https://togithub.com/canonical/craft-parts/compare/1.23.0...1.23.1)

##### What's Changed

- deps: freeze pydantic-yaml <1.0.0
([#&#8203;498](https://togithub.com/canonical/craft-parts/issues/498))
by [@&#8203;lengau](https://togithub.com/lengau) in
[https://github.com/canonical/craft-parts/pull/519](https://togithub.com/canonical/craft-parts/pull/519)
- tests: add jammy packages to stage package apt cache
([#&#8203;494](https://togithub.com/canonical/craft-parts/issues/494))
by [@&#8203;lengau](https://togithub.com/lengau) in
[https://github.com/canonical/craft-parts/pull/520](https://togithub.com/canonical/craft-parts/pull/520)
- sequencer: only load project vars in adopting part
([#&#8203;509](https://togithub.com/canonical/craft-parts/issues/509))
by [@&#8203;cmatsuoka](https://togithub.com/cmatsuoka) in
[https://github.com/canonical/craft-parts/pull/516](https://togithub.com/canonical/craft-parts/pull/516)
- Release 1.23.1 by [@&#8203;cmatsuoka](https://togithub.com/cmatsuoka)
in
[https://github.com/canonical/craft-parts/pull/526](https://togithub.com/canonical/craft-parts/pull/526)

**Full Changelog**:
canonical/craft-parts@1.23.0...1.23.1

</details>

<details>
<summary>albertodonato/snap-helpers (snap-helpers)</summary>

###
[`v0.4.2`](https://togithub.com/albertodonato/snap-helpers/blob/HEAD/CHANGES.rst#v042---2023-08-06)

[Compare
Source](https://togithub.com/albertodonato/snap-helpers/compare/0.4.1...0.4.2)

\===================

-   Rebuild to fix version

###
[`v0.4.1`](https://togithub.com/albertodonato/snap-helpers/blob/HEAD/CHANGES.rst#v041---2023-08-06)

[Compare
Source](https://togithub.com/albertodonato/snap-helpers/compare/0.4.0...0.4.1)

\===================

-   Add missing py.typed marker to package
-   \[docs] Fix ReadTheDocs setup

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "every weekend" in timezone Etc/UTC,
Automerge - "before 07:00" in timezone Etc/UTC.

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

👻 **Immortal**: This PR will be recreated if closed unmerged. Get
[config help](https://togithub.com/renovatebot/renovate/discussions) if
that's undesired.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/canonical/charmcraft).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNi44My4wIiwidXBkYXRlZEluVmVyIjoiMzYuODMuMCIsInRhcmdldEJyYW5jaCI6Im1haW4ifQ==-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
@cmatsuoka cmatsuoka deleted the 1.23.1/project-vars-restricted-to-part branch October 7, 2023 18:48
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.

3 participants