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

feat: create-track command #2024

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

feat: create-track command #2024

wants to merge 6 commits into from

Conversation

lengau
Copy link
Collaborator

@lengau lengau commented Dec 11, 2024

Adds a create-track command right in time for Christmas for @addyess

Requires canonical/craft-store#240

CRAFT-3424

@lengau lengau force-pushed the work/1901/CRAFT-3387 branch from 2c7c1e4 to f0f3545 Compare December 11, 2024 01:30
@lengau lengau requested review from mr-cal and bepri December 11, 2024 01:33
@lengau lengau linked an issue Dec 11, 2024 that may be closed by this pull request
@addyess
Copy link
Contributor

addyess commented Dec 11, 2024

🎄

@lengau lengau requested review from dariuszd21 and removed request for mr-cal December 11, 2024 15:57
@lengau lengau force-pushed the work/1901/CRAFT-3387 branch from f0f3545 to f049aa9 Compare December 11, 2024 17:51
@lengau
Copy link
Collaborator Author

lengau commented Dec 11, 2024

(Rebased on main to fix conflicts)

@addyess
Copy link
Contributor

addyess commented Dec 11, 2024

thanks for working on this @lengau ... dumb question. I'm hoping this is an "easy" port to snapcraft too?

@lengau
Copy link
Collaborator Author

lengau commented Dec 11, 2024

@addyess I'm not actually sure, as I don't know how snapcraft currently generates its store macaroon. If it does it in a way that's easily compatible with the publisher gateway, it should be fairly easy.

Do you have an open feature request on the snapcraft side where I could pop this PR so we don't reinvent the wheel when we do it?

@addyess
Copy link
Contributor

addyess commented Dec 11, 2024

Do you have an open feature request on the snapcraft side where I could pop this PR so we don't reinvent the wheel when we do it?

oof -- nope i don't have anything like that open. I suppose i can always go write one :D

@lengau lengau marked this pull request as ready for review December 11, 2024 21:47
@@ -15,7 +15,7 @@ craft-grammar==2.0.1
craft-parts==2.1.3
craft-platforms==0.4.0
craft-providers==2.0.4
craft-store==3.0.2
craft-store @ git+https://github.com/canonical/craft-store@work/charmcraft-1901
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Suggested change
craft-store @ git+https://github.com/canonical/craft-store@work/charmcraft-1901
craft-store==3.1.0

Comment on lines +14 to +15
# "craft-store>=3.0.0",
"craft-store @ git+https://github.com/canonical/craft-store@work/charmcraft-1901",
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Suggested change
# "craft-store>=3.0.0",
"craft-store @ git+https://github.com/canonical/craft-store@work/charmcraft-1901",
"craft-store>=3.1.0",

Comment on lines 2389 to 2396
For example:
$ charmcraft create-track my-charm track-1 track-2
Name Created at Automatic phasing percentage
--------- -------------------- ------------------------------
track-1 2024-12-10T23:48:40Z
track-2 2024-12-11T00:14:24Z
latest 2023-04-17T23:55:07Z
Copy link
Contributor

@dariuszd21 dariuszd21 Dec 12, 2024

Choose a reason for hiding this comment

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

If you want to satisfy RST.
However, from what I know general suggestion is not to put examples in the overview

Suggested change
For example:
$ charmcraft create-track my-charm track-1 track-2
Name Created at Automatic phasing percentage
--------- -------------------- ------------------------------
track-1 2024-12-10T23:48:40Z
track-2 2024-12-11T00:14:24Z
latest 2023-04-17T23:55:07Z
For example::
$ charmcraft create-track my-charm track-1 track-2
Name Created at Automatic phasing percentage
--------- -------------------- ------------------------------
track-1 2024-12-10T23:48:40Z
track-2 2024-12-11T00:14:24Z
latest 2023-04-17T23:55:07Z

Copy link
Contributor

Choose a reason for hiding this comment

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

I believe doing this will subsequently mess up command-line help messages and we'll have another task à la canonical/craft-cli#306. So maybe it would be easier to remove this altogether and move the example into docs if it's wanted

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good point. I've adjusted instead to tell people how to request a track guardrail.

charmcraft/application/commands/store.py Outdated Show resolved Hide resolved
@@ -2374,3 +2374,73 @@ def _get_architectures_from_bases(
for architecture in base.architectures:
architectures.add(architecture)
return sorted(architectures)


class CreateTrack(CharmcraftCommand):
Copy link
Contributor

Choose a reason for hiding this comment

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

What about adding any tests for this Command and/or new Service API 😄 ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The initial version didn't really have enough logic in it to write tests against, but I realised I probably shouldn't be pushing all tracks back, so I've filtered it and that was sufficient excuse to write tests.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Oh, and I just realised I didn't include my spread test changes originally. Oops!

@lengau lengau force-pushed the work/1901/CRAFT-3387 branch from 4d64ae4 to c42741d Compare December 12, 2024 23:11
@lengau lengau requested review from dariuszd21 and bepri December 12, 2024 23:12
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.

create-track command
4 participants