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

charmcraft publish-lib exits with 0 even if publishing fails #1981

Closed
lucabello opened this issue Oct 31, 2024 · 3 comments · Fixed by #2042
Closed

charmcraft publish-lib exits with 0 even if publishing fails #1981

lucabello opened this issue Oct 31, 2024 · 3 comments · Fixed by #2042
Assignees
Labels
Bug Something isn't working triaged

Comments

@lucabello
Copy link

lucabello commented Oct 31, 2024

Bug Description

Currently charmcraft publish-lib correctly fails the library push if something's wrong with LIBPATCH (e.g., LIBPATCH is not bumped, going back, etc). However, the exit of the command is always 0.

This is a problem especially in CI, where a "publish libraries" step will never fail (because of the 0 exit code), and thus is undetectable.

To Reproduce

  1. Take a charm library of any charm you own
  2. Modify the LIBPATCH to LIBPATCH-1
  3. Run charmcraft publish-lib on that library
  4. Read the failure message and check the exit code (it will be 0)

Environment

charmcraft 3.2.2.post72+g3a094837 (3.x/edge) (but you can reproduce this with any version)

charmcraft.yaml

-

Relevant log output

-
@lucabello lucabello added the Bug Something isn't working label Oct 31, 2024
@lengau lengau self-assigned this Dec 16, 2024
@lengau lengau added the triaged label Dec 16, 2024
Copy link

Thank you for reporting us your feedback!

The internal ticket has been created: https://warthogs.atlassian.net/browse/CRAFT-3830.

This message was autogenerated

lengau added a commit that referenced this issue Dec 16, 2024
@lengau lengau closed this as completed in f328234 Dec 17, 2024
lengau added a commit to tmihoc/charmcraft that referenced this issue Dec 19, 2024
@lucabello
Copy link
Author

Hey @lengau, if we try to publish-lib a library that's already been published we're getting failures because the return code is 1.

A few options we thought about:

  • if the library matches what is in CharmHub, return 0 (because it's not really a failure, it's more of a confirmation);
  • return a different error code, so we can differentiate between this "error" and others (actual failure to upload a lib);
  • add an arg to publish-lib --dont-fail-if-already-updated (or possibly a more reasonable name :D) to avoid returning 1 in this situation.

lucabello added a commit to canonical/observability that referenced this issue Jan 16, 2025
canonical/charmcraft#1981

Signed-off-by: Luca Bello <36242061+lucabello@users.noreply.github.com>
lucabello added a commit to canonical/observability that referenced this issue Jan 17, 2025
canonical/charmcraft#1981

Signed-off-by: Luca Bello <36242061+lucabello@users.noreply.github.com>
@lengau
Copy link
Collaborator

lengau commented Jan 17, 2025

@lucabello Ahh yes - it shouldn't be erroring out if you're trying to republish the same version with the same content. That should be considered a no-op, but successful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working triaged
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants