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

upload-charm fails when a resource has not previously been uploaded #58

Open
ca-scribner opened this issue Aug 8, 2022 · 2 comments
Open
Labels

Comments

@ca-scribner
Copy link
Contributor

Bug Description

The upload-charm action fails when it tries to upload any new resource. For example, if you have an existing charm and add a resource to that charm, you must manually upload an instance of that resource before the action will work. It would be good if the action caught this and uploaded the resource for you as expected.

To Reproduce

Add a resource to a charm, then try to upload the charm using this action

Environment

github action run for any environment

Relevant log output

Logs from a past action run, which attempted to upload resource `myfile` for the first time: 

Error: Resource 'myfile' does not have any uploaded revisions.
Error: Error: Resource 'myfile' does not have any uploaded revisions.
    at Charmcraft.<anonymous> (/home/runner/work/_actions/canonical/charming-actions/2.0.0-rc/dist/upload-charm/index.js:21737:23)
    at Generator.next (<anonymous>)
    at fulfilled (/home/runner/work/_actions/canonical/charming-actions/2.0.0-rc/dist/upload-charm/index.js:21633:58)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)

Additional context

No response

@ca-scribner ca-scribner added Type: Bug Something isn't working Status: Triage labels Aug 8, 2022
@simskij simskij added Type: Enhancement New feature or request Priority: Medium Status: Available and removed Type: Bug Something isn't working Status: Triage labels Aug 9, 2022
@simskij
Copy link
Member

simskij commented Aug 9, 2022

Yeah, that's a reasonable ask. We intentionally left that out of upload-charm as it would add quite a bit of complexity to the workflow files, but I do think you're right.

@ca-scribner
Copy link
Contributor Author

This doesn't need to be a hard ask in a workflow file, we just need to refactor the upload-action to change the order of operations.

As is, the upload-charm action does:

  • pack charm
  • upload resources
  • upload charm

To make this work for new resources as well as existing ones, we reorder things to:

  • pack charm
  • charmcraft upload charmfile.charm <--Charmhub parses this, sees the metadata.yaml with the new resource defined, and creates a new bucket for this new resource for us
  • charmcraft upload-resource ... to now upload an image of this new resource
  • charmcraft publish ... --resource newResourceName:revX to publish to latest/edge or wherever

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants