Skip to content

Uploading an artificat to a draft release doesn't work (not found) #6198

Closed

Description

@ctron

Describe the bug

Uploading an artifacts to a draft release as part of a GitHub Actions workflow doesn't work. It fails with the error:

release not found

Steps to reproduce the behavior

  1. Create a release: gh release create -p -d --title "0.1.0-alpha.4" -F /tmp/changelog.md $TAG
  2. List the releases gh release list:
    0.1.0-alpha.4	Draft	v0.1.0-alpha.4	2022-09-05T11:27:03Z
    0.1.0-alpha.3	Draft	v0.1.0-alpha.3	2022-08-23T16:22:50Z
    0.1.0-alpha.2	Draft	v0.1.0-alpha.2	2022-08-23T15:18:45Z
    
  3. Try to upload an asset: gh release upload $TAG $(find server-binaries -type f):
    release not found
    

Expected vs actual behavior

I would expect the upload to work.

Logs

There is an example run here: https://github.com/drogue-iot/drogue-doppelgaenger/runs/8188152493?check_suite_focus=true
The logs archive: logs_26.zip

Additional information

I saw some other, similar, bug reports like this. However, I cannot verify the claim that this issue is closed. A difference I noticed to the existing bug reports is, that I am creating a "prerelease", which might make a difference. But should still work.

Activity

  1. added
    bugSomething isn't working
    on Sep 5, 2022
  2. mislav commented on Sep 5, 2022

    @mislav
    Contributor

    Thank you for reporting. I've managed to reproduce, and it's bizarre: it looks like although the release was properly created and visible via gh release list (backed by GitHub GraphQL API), the new release is not immediately available to gh release upload (backed by GitHub REST API) until a few seconds later. For about 2 seconds after the creation of the release, GitHub GraphQL and REST APIs are out of sync. I suspect some kind of database or ElasticSearch replication lag.

    Your workarounds are either:

    1. Since you are publishing the draft release immediately after uploading the assets, you can just switch to gh release create -p $TAG <files>... invocation, which will upload your assets and publish the release when finished.
    2. Alternatively, you can add a sleep 3 statement before gh release upload step.
  3. added
    priority-3Affects a small number of users or is largely cosmetic
    platformProblems with the GitHub platform rather than the CLI client
    and removed on Sep 5, 2022
  4. ctron commented on Sep 6, 2022

    @ctron
    Author

    Thanks for taking a look at this.

    We are using this pattern of (create draft, add assets, remove draft) in a bunch of cases. Sometimes with a more variable list of files, or multiple steps of uploading. So this ensures that the draft state only gets removed when everything is complete. But maybe we just need to rework this.

  5. added a commit that references this issue on Sep 6, 2022
  6. mislav commented on Sep 15, 2022

    @mislav
    Contributor

    Sometimes with a more variable list of files, or multiple steps of uploading.

    You can dynamically resolve a variable list of files in your script to the final set of files, and pass that final set to gh release create as arguments for a single call. You still have flexibility that way.

    But If you do need to keep your upload flow as separate commands, then just put a sleep 3 after the gh release create --draft to work around the current API issue at the cost of slowing down your workflow a bit.

    So this ensures that the draft state only gets removed when everything is complete.

    gh release create will automatically keep the release as draft until all uploads are complete.

  7. mislav commented on Oct 14, 2022

    @mislav
    Contributor

    Hi, a platform update shipped which will ensure that GraphQL and REST APIs match when listing releases, meaning that gh release list will no longer list releases which subsequently can't be found by referencing its tag name. However, due to platform internals, a small replication lag can occur between creating a draft release and having that release be selectable by its tag name. The workaround remains the same: either

    • Upload artifacts in the same gh release create call; or
    • Add a sleep statement after the gh release create operation.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingplatformProblems with the GitHub platform rather than the CLI clientpriority-3Affects a small number of users or is largely cosmetic

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions