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

Add support for release event (Github, Gitea, Gitlab) #764

Closed
wants to merge 52 commits into from

Conversation

LamaAni
Copy link
Contributor

@LamaAni LamaAni commented Feb 8, 2022

As a github developer (both public and Enterprise) I would like to be able to catch and run CI on the release event, allowing to add artifacts for release via the github GUI.

Reasons:

  1. It is easy for all users (management/lower level devs) to release, revert, get artifacts etc from release page.
  2. It is a part of the github UI.

Changes:

  1. Added global webhook "release"
  2. Added support for parsing webhook "release" to the github vendor.
    • No release commit. We are using the /refs/tags/... Ref.
    • No branch is associated.

@LamaAni LamaAni changed the title Added support for release event (Github) Added support for release event (Github) [DRAFT] Feb 8, 2022
@6543

This comment was marked as outdated.

@6543 6543 added the feature add new functionality label Feb 8, 2022
@6543 6543 added this to the 1.0.0 milestone Feb 8, 2022
@6543

This comment was marked as outdated.

@anbraten

This comment was marked as resolved.

@anbraten anbraten marked this pull request as draft February 8, 2022 17:40
@LamaAni LamaAni changed the title Added support for release event (Github) [DRAFT] Added support for release event (Github) Feb 8, 2022
@codecov-commenter
Copy link

codecov-commenter commented Feb 8, 2022

Codecov Report

Merging #764 (05a4463) into master (e79ad00) will increase coverage by 0.66%.
The diff coverage is 84.61%.

@@            Coverage Diff             @@
##           master     #764      +/-   ##
==========================================
+ Coverage   51.58%   52.24%   +0.66%     
==========================================
  Files          79       79              
  Lines        6074     6203     +129     
==========================================
+ Hits         3133     3241     +108     
- Misses       2760     2776      +16     
- Partials      181      186       +5     
Impacted Files Coverage Δ
server/remote/gitea/parse.go 32.35% <72.22%> (+13.48%) ⬆️
server/remote/gitea/helper.go 86.27% <81.25%> (-1.71%) ⬇️
server/remote/github/parse.go 85.71% <83.01%> (-1.69%) ⬇️
server/remote/github/github.go 16.34% <87.50%> (+0.23%) ⬆️
server/remote/gitlab/convert.go 72.22% <90.62%> (+3.20%) ⬆️
server/model/const.go 66.66% <100.00%> (ø)
server/remote/gitlab/gitlab.go 29.06% <100.00%> (+1.97%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e79ad00...05a4463. Read the comment docs.

@LamaAni

This comment was marked as resolved.

@LamaAni

This comment was marked as outdated.

@6543 6543 added the forge/github github forge related label Feb 8, 2022
@anbraten

This comment was marked as outdated.

@LamaAni

This comment was marked as outdated.

@LamaAni

This comment was marked as outdated.

@LamaAni LamaAni marked this pull request as ready for review February 8, 2022 20:03
@LamaAni

This comment was marked as outdated.

@anbraten

This comment was marked as outdated.

Co-authored-by: 6543 <6543@obermui.de>
server/remote/gitea/helper.go Outdated Show resolved Hide resolved
Co-authored-by: 6543 <6543@obermui.de>
server/remote/gitea/helper.go Outdated Show resolved Hide resolved
@anbraten anbraten mentioned this pull request Apr 4, 2022
31 tasks
@@ -523,13 +524,17 @@ func (g *Gitlab) Hook(ctx context.Context, req *http.Request) (*model.Repo, *mod
return nil, nil, err
}

parsed, err := gitlab.ParseWebhook(gitlab.WebhookEventType(req), payload)
gitlabEventType := gitlab.WebhookEventType(req)
println("Received event: " + gitlabEventType)
Copy link
Member

Choose a reason for hiding this comment

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

we do use zerolog ;)

@@ -267,13 +268,19 @@ func setupGitlab(c *cli.Context) (remote.Remote, error) {

// helper function to setup the GitHub remote from the CLI arguments.
func setupGithub(c *cli.Context) (remote.Remote, error) {
releaseActions := regexp.
MustCompile(`[\s,]+`).
Split(c.String("github-release-actions"), -1)
Copy link
Member

Choose a reason for hiding this comment

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

use c.Strings

@woodpecker-bot
Copy link
Collaborator

woodpecker-bot commented May 17, 2022

Deployment of preview was successful: https://woodpecker-ci-woodpecker-pr-764.surge.sh

@LamaAni

This comment was marked as outdated.

@6543

This comment was marked as outdated.

@qwerty287
Copy link
Contributor

qwerty287 commented Aug 3, 2022

We should apply #917 here too if there's no branch associated, but actually releases can have branches that should be parsed here.

@qwerty287 qwerty287 removed the forge/github github forge related label Aug 3, 2022
@anbraten anbraten changed the title Added support for release event (Github, Gitea, Gitlab) Add support for release event (Github, Gitea, Gitlab) Sep 2, 2022
Comment on lines +274 to +279
&cli.StringFlag{
EnvVars: []string{"WOODPECKER_GITHUB_RELEASE_ACTIONS"},
Name: "github-release-actions",
Usage: "On which actions to trigger a release pipeline",
Value: "prereleased, released",
},
Copy link
Member

Choose a reason for hiding this comment

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

Instead of limiting here I would suggest to inject an environment variable to each step CI_RELEASE_TYPE=draft,pre-release,release

Copy link
Contributor

Choose a reason for hiding this comment

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

And adding some filter to the when options would be good too.

Copy link
Member

@anbraten anbraten Sep 27, 2022

Choose a reason for hiding this comment

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

I guess this could be pretty simple by introducing #312

@qwerty287 qwerty287 removed this from the 1.0.0 milestone May 31, 2023
@qwerty287 qwerty287 added this to the 3.x.x milestone Nov 4, 2023
@anbraten anbraten marked this pull request as draft December 24, 2023 08:38
@qwerty287 qwerty287 mentioned this pull request Jan 20, 2024
@qwerty287
Copy link
Contributor

-> #3226

@qwerty287 qwerty287 closed this Jan 20, 2024
@qwerty287 qwerty287 removed this from the 3.x.x milestone Jan 20, 2024
pat-s added a commit that referenced this pull request Jan 30, 2024
Supersedes #764 

Bitbucket does not support release webhooks.

---------

Co-authored-by: Patrick Schratz <patrick.schratz@gmail.com>
fernandrone pushed a commit to quintoandar/woodpecker that referenced this pull request Feb 1, 2024
Supersedes woodpecker-ci#764 

Bitbucket does not support release webhooks.

---------

Co-authored-by: Patrick Schratz <patrick.schratz@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature add new functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants