Screwdriver: Trigger Pipeline on GitHub Release

Created on 14 Dec 2017  路  25Comments  路  Source: screwdriver-cd/screwdriver

User wants to start jobs triggered release event same like ~pr or ~commit.
This feature image is like following:
image
If a user wants to trigger another pipeline's jobs, the user should set ~sd@1234:release in this case.

I could not think about the cases of Bitbucket and Gitlab...

(updated) concourse has this feature: https://github.com/concourse/github-release-resource

feature workflow

Most helpful comment

I took a quick look at the webhooks on github. IMO there are a number of things that would make for nice triggers/entry points, not just _release_, but also _issues_, _pull request_, _label_, _delete_, etc. If the specificity is an issue perhaps the entrypoint could be given some sort of namespace; e.g. github-_release_, github-_delete_, etc to make it clear that the feature is not going to work on bitbucket.

All 25 comments

a work around can be ~sd@1234:job_that_does_release and we support that already. But you guys actually want it to check against github release instead of a screwdriver job?

Maybe yes. This feature request was mentioned our coworker.
Anyway, I'll tell him about the work around. Thanks!

I asked the requester. Actually, he wants to trigger same pipeline's jobs (e.g., production deployment job) by creating "Release" manually on GitHub UI or any other systems.

This feels like an overly specific tie in to Github features. I do not think that Bitbucket or Gitlab have a "release" entity or event.

I took a quick look at the webhooks on github. IMO there are a number of things that would make for nice triggers/entry points, not just _release_, but also _issues_, _pull request_, _label_, _delete_, etc. If the specificity is an issue perhaps the entrypoint could be given some sort of namespace; e.g. github-_release_, github-_delete_, etc to make it clear that the feature is not going to work on bitbucket.

I see value in supporting releases and tags. We just need to document supported scms for ~tags, ~releases in requires

@minz1027 @jithin1987
Many users want to use this feature in my working place. Is this feature in progress?
Thank you.

@minz1027 @jithin1987
Many users want to use this feature in my working place. Is this feature in progress?
Thank you.

We haven't prioritized this yet.

~tag:branch feature has a bug. This code watches master_branch as branch but it doesn't work when master_branch is different from a tagged branch.

In addition, ~tag:/<tag_name> feature will be supported for more use case instead of ~tag:branch.
So we should think about ~tag:<something> feature in the second pass.

@catto awaiting an example pipeline https://github.com/screwdriver-cd-test

@jithin1987 We are going to create an example pipeline soon 馃殌

@jithin1987 The examples are available.
https://github.com/screwdriver-cd-test/tag-trigger-example
https://github.com/screwdriver-cd-test/release-trigger-example

There is a case of an empty event is created with release and tag event without a ~release or ~tag node like: https://cd.screwdriver.cd/pipelines/2538/events
We should fix this behavior to show these nodes when events are sent.

@tk3fftk so whenever there is a tag it's creating 2 events ? Could you please work on a fix ?

I created a new tag/release here https://github.com/screwdriver-cd-test/tag-trigger-example/tags and 2 new events showed up on UI

https://cd.screwdriver.cd/pipelines/2538/events

@jithin1987
GitHub always sends webhooks with release and create tag when create release or tag on GitHub so two SD events are posted. It's a GitHub's specification.

These events are shown as an empty event same as ~commit event without triggered jobs.
But ~release and ~tag nodes are not shown in a workflow graph so we look completely empty events. (ref. https://github.com/screwdriver-cd/workflow-parser/pull/18#issuecomment-470328721 )

We'll fix to show ~release and ~tag nodes when release or create tag webhooks are sent even if these is no requires.

@tk3fftk

I don't quite get the reason for the empty event. If you see the events list https://cd.screwdriver.cd/pipelines/2538/events (2nd one) it did process a webhook for ~tag.

I think the reason for the empty event is the tag was created as part of a release. So it seems to me that webhook for release was processed and created the empty event, even though ~release was not part of the requires.

https://github.com/screwdriver-cd/screwdriver/issues/823#issuecomment-478814234 had missing sentence so it's updated馃檹 I think your hypothesis is same as mine.

Now we may have many empty events so I created the issue https://github.com/screwdriver-cd/screwdriver/issues/1577

@tk3fftk any updates on this ? Also we need to make sure that if github sends both release & create tag webhook we process only one, so that the empty events won't be created at all.

@jithin1987 It's reproduced in my pipeline, it will be fixed by https://github.com/screwdriver-cd/models/pull/364. Could you review it?

@jithin1987 I think the empty event will be created when a user creates a github release and doesn't have ~release in his/her screwdriver.yaml even if we send only one webhook.
We should improve UI, so @s-yoshika opened the PR ( https://github.com/screwdriver-cd/models/pull/364 ).

@tk3fftk @s-yoshika If user does not have ~release and has only ~tag why even process release event ? I think we should just ignore it. This should be similar to commit or pr, if user makes a pr and does not have any jobs with requires pr, we do not show empty events. So why different behavior for tag or release

My concern is not so much about the empty event with no trigger per se, but more about the empty event itself. It should not have been created I think.

@jithin1987 I think both ~tag and ~release event are necessary.

  • ~release has internal control benefits. ~release can only be executed by a specific person and the person who executes it is recorded.
  • Setting both tag/release in screwdriver.yaml is not a big problem
    (You want to do something different with ~tag and ~release. I don't think it will be a production release for both ~tag and ~release.)

If screwdriver.yaml doesn't have a ~tag or ~release, we should not create an event. Also, I want to provide tag filter function (ex. [~tag:/.*snapshot.*/]) as a second pass.

SD user want to get tag/release info. How about providing release id, release name, release author, and tag name on ~release job and tag name on ~tag job by metadata?
For example, the key names are sd.release.id,sd.release.name,sd.release.author and sd.tag.name

@catto @sakka2 @kkokufud is there any work left for this feature ?

I am looking to add this to our docs. What are the valid values for https://github.com/screwdriver-cd/data-schema/pull/338/files#diff-77dea1a61b658aff6ad9cd0d2528d2daR57 ? I am trying to understand ~release:abc what does abc represent ?

@jithin1987 We have verified it works and looks good to ship this feature.
abc (after colon) is for branch/release name filter. Though it isn't implemented yet, we will do it near future so that the feature will be more useful.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tk3fftk picture tk3fftk  路  7Comments

jeffreytolar picture jeffreytolar  路  3Comments

stjohnjohnson picture stjohnjohnson  路  5Comments

catto picture catto  路  4Comments

jithine picture jithine  路  7Comments