Skip to content

Conversation

JonasSchubert
Copy link
Contributor

This should fix #490 (WIP). Working on it I found some issues which were not recognized yet:

  • wrong README example
  • missing proxy
  • invalid URL if gitlapApiUrl is set

@JonasSchubert
Copy link
Contributor Author

Now I am experiencing issues with got stream handling. When trying to upload more then one file as asset, I receive this error: An error occurred while running semantic-release: HTTPError: Cannot retry with consumed body stream

The first file is successfully uploaded, after this everything fails.

@fgreinacher I am not sure how to handle this using got and would appreciate your input (or anybodys input regarding this :))

Config:

{
  "branches": ["feat/text-semantic-release-gitlab-assets"],
  "plugins": [
    "@semantic-release/commit-analyzer",
    "@semantic-release/release-notes-generator",
    [
      "@semantic-release/gitlab",
      {
        "gitlabUrl": "https://code.siemens.com",
        "assets": [
          { "path": "generic-package.tar", "label": "tar-example.tar", "target": "generic_package", "status": "default" },
          { "path": "generic-package.7z", "label": "7z-example.7z", "target": "generic_package" },
          { "path": "generic-package.txt", "label": "txt-example.txt", "target": "generic_package", "status": "hidden" }
        ]
      }
    ]
  ]
}

The file is put into a tar and 7z using 7zip:
generic-package.txt

@JonasSchubert
Copy link
Contributor Author

I will try to figure it out tomorrow. Maybe using the stream API got provides.

@JonasSchubert JonasSchubert marked this pull request as ready for review February 2, 2023 06:39
@JonasSchubert
Copy link
Contributor Author

I am using readFileSync for the generic package. This resolved the issue with got streams. Or has there been a reason to use file streams?

@fgreinacher
Copy link
Contributor

I am using readFileSync for the generic package. This resolved the issue with got streams. Or has there been a reason to use file streams?

I don't know the history of this, but generally streams/async operations are considered best practice, especially for bigger payloads, because they don't block the application. In the case of semantic-release it does not really matter though, because we're anyway executed exclusively in CI.

@fgreinacher
Copy link
Contributor

The changes look good to me. Do you want to make additional changes @JonasSchubert?

@fgreinacher fgreinacher changed the title Fix/assets as generic packages #490 fix(generic-package): fix issues when uploading multiple assets Feb 2, 2023
@JonasSchubert
Copy link
Contributor Author

Thanks for the feedback @fgreinacher.
I would say let's merge it. If there will be a issue considering big files I would come back and help there, but in my opinion git LFS could be a better solution then - depending on the use case.

Copy link
Contributor

@fgreinacher fgreinacher left a comment

Choose a reason for hiding this comment

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

Thanks for taking care!

@fgreinacher fgreinacher merged commit cd9e33b into semantic-release:master Feb 2, 2023
@github-actions
Copy link

github-actions bot commented Feb 2, 2023

🎉 This PR is included in version 10.1.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Generic package from registry can't be extracted

2 participants