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

[feature] support creating a draft release #1476

Open
ianlewis opened this issue Jan 6, 2023 · 12 comments · Fixed by #1882
Open

[feature] support creating a draft release #1476

ianlewis opened this issue Jan 6, 2023 · 12 comments · Fixed by #1882
Labels
area:generic Issue with the generic generator area:go Issue related to the Go ecosystem good first issue Good issue for first time contributors. status:help wanted Extra attention is needed type:feature New feature or request

Comments

@ianlewis
Copy link
Member

ianlewis commented Jan 6, 2023

The Go builder and generic generator use softprops/action-gh-release to create releases. We should support setting the draft flag so that users can create draft releases.

Related: sigstore/helm-sigstore#111

@ianlewis ianlewis added type:feature New feature or request area:go Issue related to the Go ecosystem area:generic Issue with the generic generator good first issue Good issue for first time contributors. status:help wanted Extra attention is needed labels Jan 6, 2023
@haydentherapper
Copy link
Contributor

We ran into this in https://github.com/sigstore/timestamp-authority.

See the release GHA - https://github.com/sigstore/timestamp-authority/blob/main/.github/workflows/release.yaml

The GHA first creates a draft release with the binary assets, and then runs the provenance generator. The generator will create a release (not a draft) using the tag. The issues are:

  1. This doesn't detect the existing draft release, instead creating a new release
  2. This creates a new release that we have to delete after manually moving the intoto attestation to the draft release

Ideally the GHA generator would either detect an existing draft release and append the attestation or I could provide flags to the generator to control this behavior.

cc @asraa @laurentsimon

@asraa
Copy link
Collaborator

asraa commented Jan 10, 2023

I think as a mitigation (suggested by Hayden!) users could use upload-assets: false, and manually upload the asset (which will be named according to the inputs: https://github.com/slsa-framework/slsa-github-generator/blob/main/internal/builders/generic/README.md#workflow-inputs)

@ianlewis
Copy link
Member Author

I think as a mitigation (suggested by Hayden!) users could use upload-assets: false, and manually upload the asset (which will be named according to the inputs: https://github.com/slsa-framework/slsa-github-generator/blob/main/internal/builders/generic/README.md#workflow-inputs)

Yes, setting upload-assets: false and uploading them yourself (and downloading/uploading the provenance) is the workaround.
Example: https://github.com/sigstore/helm-sigstore/pull/111/files#diff-87db21a973eed4fef5f32b267aa60fcee5cbdf03c67fafdc2a9b553bb0b15f34R61-R90

@haydentherapper
Copy link
Contributor

Thanks, doing that here! sigstore/timestamp-authority#215

@haydentherapper
Copy link
Contributor

Thank you @ianlewis for the code pointer, a test release worked as expected!

@ianlewis
Copy link
Member Author

ianlewis commented Mar 22, 2023

/cc @developer-guy BTW would love PR(s) for this if you have some time to take a look.

@developer-guy
Copy link
Contributor

developer-guy commented Mar 23, 2023

While working on the osv-scanner project, I realized that they mark their release as a draft for some reason. In that case, if we set the upload-assets parameter of the Generic SLSA 3 Generator as true, we see two different releases with the same tag, one is marked as draft the other is marked as latest. Then I dag into the problem a bit, and noticed that the Generic SLSA 3 Generator uses soft-props/action-gh-release to upload the provenance file, here and here. There is a draft option available in the parameters of the action-gh-release GitHub Action.

So, maybe we can add a new parameter to these generators for people who might want to mark their release as a draft, if so, they can pass that parameter to the action-gh-release to avoid having duplicate releases as said by @ianlewis up above.

@developer-guy
Copy link
Contributor

developer-guy commented Mar 23, 2023

What I have thought is that;

  • Add a draft option to the workflow inputs
  • Use the draft option to fulfill the draft option of soft-props/action-gh-release that we used to upload provenance

does that sound good @ianlewis, if so, please assign it to me. PTAL @ianlewis

@ianlewis
Copy link
Member Author

What I have thought is that;

  • Add a draft option to the workflow inputs
  • Use the draft option to fulfill the draft option of soft-props/action-gh-release that we used to upload provenance

does that sound good @ianlewis, if so, please assign it to me. PTAL @ianlewis

Yep, that's the gist of it I think.

@laurentsimon
Copy link
Collaborator

laurentsimon commented Apr 3, 2023

We need end-to-end test before closing this issue. Test for prerelease flags are in https://github.com/search?q=repo%3Aslsa-framework%2Fexample-package%20prerelease&type=code

ianlewis pushed a commit that referenced this issue Apr 3, 2023
I started with the generic builder and will continue with the others as
well if you accept the solution:

Fixes #1476 

I tried that in osv-scanner project and it worked: 
* Job:
_https://github.com/developer-guy/osv-scanner/actions/runs/4536204956/jobs/7992687991_
* Release:
_https://github.com/developer-guy/osv-scanner/releases/tag/untagged-5bf09e3accd2794d0d10_

PTAL @laurentsimon @asraa @ianlewis

---------

Signed-off-by: Batuhan Apaydın <batuhan.apaydin@trendyol.com>
Signed-off-by: Ian Lewis <ianlewis@google.com>
Co-authored-by: Ian Lewis <ianlewis@google.com>
@ianlewis
Copy link
Member Author

ianlewis commented Apr 4, 2023

Reopen for e2e test.

@developer-guy
Copy link
Contributor

Here is the PR for e2e tests: slsa-framework/example-package#167

@ianlewis ianlewis removed their assignment Jun 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:generic Issue with the generic generator area:go Issue related to the Go ecosystem good first issue Good issue for first time contributors. status:help wanted Extra attention is needed type:feature New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants