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: Adding GitLab support for releasing, homebrew, and scoop #809

Closed
wants to merge 1 commit into from

Conversation

wburningham
Copy link

If applied, this commit will add support for GitLab see #110.

This change is being made to support talking to GitLab for releases, homebrew and scoop. It has several key changes to the internal design of goreleaser. Below is a list/summary of some of the changes you'll see in code:

  • Artifacts now have an internal id and an artifacts.SetExtra function. This is so GitHub and GitLab clients can upload an artifact and then store the returned download URL on the artifact. The previous behavior was to build the download URL using a default template that uses the artifact name. Because GitLab's uploads API generates a download URL rather than accepting a URL from the consumer (like GitHub's release asset API) we cannot use the existing a template to build the URL, but have to store the returned download URL so we can use it later (used later in the brew and scoop pipelines).
  • The client.CreateRelease method now returns a string for a release ID rather than an int64 since GitLab uses the tag string as the release ID when uploading a file to a project.
  • Default API and Download URLs were previously set in defaults.go as the first default set, but at that point environment variables have not been set so it is unknown if a GitHub or GitLab token is set which determines which client to instantiate. The default API and Download URLs were deferred to when a client is instantiated.
  • The config pkg now has custom YAML unmarshalers that will read in github* or gitlab* keys and store them in a agnostic Repo key on the config so code accessing the repo and URL information later doesn't need extra logic to determine whether or not to use GitLab or GitHub values. The config package will error if a gorelease.yaml file has both GitLab and GitHub options defined.
  • A new client.gitlabClient exists for interacting with GitLab. Rather than importing another package (like github.com/xanzy/go-gitlab) the client uses the stdlib http package.
  • The client.Upload method returns a string in addition to an error where the string is the path to download the file. This is so homebrew and scoop pipelines can use that as a default URL.

This PR is large and I've tested my changes with a few use cases, but I'm not confident that it will work with other configurations.

Major updates: 1) changing the internal loading of configs, 2) changing
the client.Client interface 3) adding a gitlabClient struct 4) adding
internal id to artifacts

See goreleaser#110
@wburningham
Copy link
Author

@caarlos0 As pointed out in the summary of my changes

Because GitLab's uploads API generates a download URL rather than accepting a URL from the consumer (like GitHub's release asset API) we cannot use the existing a template to build the URL, but have to store the returned download URL so we can use it later (used later in the brew and scoop pipelines).

In the case where a release is disabled, but the brew or scoop pipes are still enabled (the exact case that exists with the TravisCI build for this repo), the code currently fails. What are your thoughts on the following options:

If the release is disabled, but brew or scoop is enabled:

  1. throw an error at the time the config is parse indicating that a URLTemplate is required.
  2. Default to a URL template that is a local path to the artifact in the dist folder
  3. Change the code to be something else (not sure what this would look like)

I'm not sure if ^ make sense so please let me know. Thanks.

@caarlos0
Copy link
Member

Hi, this is indeed a big PR hehe

I'll take a look in the weekend :)

Thanks!

@wburningham
Copy link
Author

@caarlos0 were you able to look at this PR over the weekend?

@tylerchr
Copy link

It would be great if goreleaser had GitLab support. I'd like to use it to make some internal CLI tools installable via Homebrew but since we don't use GitHub I would need to host the custom taps in our self-hosted GitLab instance. Right now there's not really a viable way to achieve that, at least not one that includes goreleaser. But that could change with a MR like this so I'd be glad to see this merged.

@caarlos0
Copy link
Member

Sorry, I was prepping for gophercon br, and now I'm here... hopefully next week I can take a look.

What I can say for now is that the PR is very big, probably I'll be cherry-picking stuff into goreleaser master branch... but, for sure, this is a good addition!

Many thanks again for the PR :)

@wburningham
Copy link
Author

@caarlos0 you mentioned that you would be cherry-picking stuff. Would be breaking my PR into smaller sections or coding up the PR differently be helpful? Wondering how I can be helpful.

@caarlos0
Copy link
Member

@caarlos0 you mentioned that you would be cherry-picking stuff. Would be breaking my PR into smaller sections or coding up the PR differently be helpful? Wondering how I can be helpful.

yes, I think so, I plan to finish the other things on #807 first, as I think they would help to make this more robust... unfortunately I have not had much time to work on those things the last few days :/

@stale
Copy link

stale bot commented Oct 31, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix This will not be worked on label Oct 31, 2018
@stale stale bot removed the wontfix This will not be worked on label Oct 31, 2018
@alexggordon
Copy link

@caarlos0 @wburningham so recently, GitLab added their releases API, which allows for arbitrary artifact URL's in the release creation process. Is this something you've considered revisiting since this now seems like a significantly smaller change?

@caarlos0
Copy link
Member

@caarlos0 @wburningham so recently, GitLab added their releases API, which allows for arbitrary artifact URL's in the release creation process. Is this something you've considered revisiting since this now seems like a significantly smaller change?

it sure seems a simpler change than this one... interested in working on a PR for that?

@alexggordon
Copy link

Yeah--assuming this is something you don't mind supporting, I'm more than happy to do the initial work.

You have any thoughts on things I need to be aware of?

@caarlos0
Copy link
Member

Since now they have the releases support, I think we just need to add gitlab client and that should be enough to do the release part...

brew and etc will require extra work, but could be done afterwards IMHO 🤔

@mavogel
Copy link
Member

mavogel commented May 6, 2019

@caarlos0 I'd also like to contribute, especially to add gitlab support. But one question first would it make sense to help with #807 first or to rewrite this PR with regards to

Since now they have the releases support, I think we just need to add gitlab client and that should be enough to do the release part...

As mentioned in #807 (comment) we'd need some clarification on which issue to help first :)

@caarlos0
Copy link
Member

caarlos0 commented May 6, 2019

hey @mavogel

I think that using the new gitlab releases makes more sense and would probably be easier, hopefully also less changes than this one... 🤔

I failed to try to merge this in, sorry about that @wburningham :/

@mavogel mavogel mentioned this pull request Jun 4, 2019
11 tasks
@caarlos0
Copy link
Member

will close this in favor of #1038

thanks for the work, sorry it didn't get merge in :(

@caarlos0 caarlos0 closed this Jun 28, 2019
@github-actions
Copy link
Contributor

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 19, 2020
caarlos0 added a commit that referenced this pull request Aug 19, 2022
…7a826628 to 3.0.7 (#3324)

Bumps actions/cache from 661fd3eb7f2f20d8c7c84bc2b0509efd7a826628 to 3.0.7. This release includes the previously tagged commit.

Release notes
Sourced from actions/cache's releases.

v3.0.7
What's Changed

Fix for the download stuck problem has been added in actions/cache for users who were intermittently facing the issue. As part of this fix, new timeout has been introduced in the download step to stop the download if it doesn't complete within an hour and run the rest of the workflow without erroring out.




Changelog
Sourced from actions/cache's changelog.

Releases
3.0.0

Updated minimum runner version support from node 12 -> node 16

3.0.1

Added support for caching from GHES 3.5.
Fixed download issue for files > 2GB during restore.

3.0.2

Added support for dynamic cache size cap on GHES.

3.0.3

Fixed avoiding empty cache save when no files are available for caching. (issue)

3.0.4

Fixed tar creation error while trying to create tar with path as ~/ home folder on ubuntu-latest. (issue)

3.0.5

Removed error handling by consuming actions/cache 3.0 toolkit, Now cache server error handling will be done by toolkit. (PR)

3.0.6

Fixed #809 - zstd -d: no such file or directory error
Fixed #833 - cache doesn't work with github workspace directory

3.0.7

Fixed #810 - download stuck issue. A new timeout is introduced in the download process to abort the download if it gets stuck and doesn't finish within an hour.




Commits

a7c34ad Merge pull request #894 from actions/kotewar/update-toolkit-version
83394c9 Updated cache version in license file
e839c25 Updated actions/cache version to 3.0.3
33a923d Added release information
a404368 Updated actions/cache version to 3.0.2
f427802 Merge pull request #887 from actions/pdotl-version-patch
9916fe1 Update cache version in licences
318935e Update README and RELEASES
85efbb5 Update cache npm module to latest
4387dbc Merge pull request #835 from shivamarora1/clojure-lein-example
Additional commits viewable in compare view



Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

@dependabot rebase will rebase this PR
@dependabot recreate will recreate this PR, overwriting any edits that have been made to it
@dependabot merge will merge this PR after your CI passes on it
@dependabot squash and merge will squash and merge this PR after your CI passes on it
@dependabot cancel merge will cancel a previously requested merge and block automerging
@dependabot reopen will reopen this PR if it is closed
@dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
@dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
@dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
@dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
caarlos0 pushed a commit that referenced this pull request Aug 22, 2022
Bumps actions/cache from 3.0.7 to 3.0.8.

Release notes
Sourced from actions/cache's releases.

v3.0.8
What's Changed

Fix zstd not working for windows on gnu tar in issues.
Allow users to provide a custom timeout as input for aborting cache segment download using the environment variable SEGMENT_DOWNLOAD_TIMEOUT_MIN. Default is 60 minutes.




Changelog
Sourced from actions/cache's changelog.

Releases
3.0.0

Updated minimum runner version support from node 12 -> node 16

3.0.1

Added support for caching from GHES 3.5.
Fixed download issue for files > 2GB during restore.

3.0.2

Added support for dynamic cache size cap on GHES.

3.0.3

Fixed avoiding empty cache save when no files are available for caching. (issue)

3.0.4

Fixed tar creation error while trying to create tar with path as ~/ home folder on ubuntu-latest. (issue)

3.0.5

Removed error handling by consuming actions/cache 3.0 toolkit, Now cache server error handling will be done by toolkit. (PR)

3.0.6

Fixed #809 - zstd -d: no such file or directory error
Fixed #833 - cache doesn't work with github workspace directory

3.0.7

Fixed #810 - download stuck issue. A new timeout is introduced in the download process to abort the download if it gets stuck and doesn't finish within an hour.

3.0.8

Fix zstd not working for windows on gnu tar in issues #888 and #891.
Allowing users to provide a custom timeout as input for aborting download of a cache segment using an environment variable SEGMENT_DOWNLOAD_TIMEOUT_MIN. Default is 60 minutes.




Commits

fd5de65 Merge pull request #899 from actions/kotewar/download-and-compression-fix
d49b6bb Updated actions/cache toolkit dep to v3.0.4
See full diff in compare view




Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

@dependabot rebase will rebase this PR
@dependabot recreate will recreate this PR, overwriting any edits that have been made to it
@dependabot merge will merge this PR after your CI passes on it
@dependabot squash and merge will squash and merge this PR after your CI passes on it
@dependabot cancel merge will cancel a previously requested merge and block automerging
@dependabot reopen will reopen this PR if it is closed
@dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
@dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
@dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
@dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants