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

Make manifest releases almost atomic using draft releases #19593

Merged
merged 3 commits into from Oct 9, 2019

Conversation

@foolip
Copy link
Contributor

foolip commented Oct 9, 2019

No description provided.

foolip added 2 commits Oct 9, 2019
Per https://developer.github.com/v3/repos/releases/#create-a-release,
`target_commitish` is used to create the tag, and ignored if the tag
already exists.
This makes tagging and releasing almost atomic, at most leaving behind
a draft release if something goes wrong. Because no tag or (non-draft)
release will be created in case of error, the script can just be run
again without first removing the bad release.
@foolip

This comment has been minimized.

Copy link
Contributor Author

foolip commented Oct 9, 2019

There are two commit on this branch where the first one would make sense in isolation and for review I recommend reading each commit message:

commit 01e7914f96131270c62da701fdf3ff29bd4a1af3
Author: Philip Jägenstedt <philip@foolip.org>
Date:   Wed Oct 9 11:37:37 2019 +0200

    Let `create_release` publish only after uploading assets
    
    This makes tagging and releasing almost atomic, at most leaving behind
    a draft release if something goes wrong. Because no tag or (non-draft)
    release will be created in case of error, the script can just be run
    again without first removing the bad release.

commit 41daef76e74df1728d226d271107ccbd7e173971
Author: Philip Jägenstedt <philip@foolip.org>
Date:   Wed Oct 9 10:16:10 2019 +0200

    Let `create_release` implicitly create the merge_pr_* tag
    
    Per https://developer.github.com/v3/repos/releases/#create-a-release,
    `target_commitish` is used to create the tag, and ignored if the tag
    already exists.

To gain some confidence that this works I make some local edits to the script to release to my fork, and emulated something going wrong when the .zst file was going to be uploaded. Here's the resulting draft release and the successful release once I removed the fake error:
https://github.com/foolip/wpt/releases/tag/untagged-72e17908aa7df0de1f69
https://github.com/foolip/wpt/releases/tag/merge_pr_19588

I've confirmed that no tag is created for drafts, even though you can't tell from the state of my repo right now.

release_id = create_resp["id"]
edit_url = "https://api.github.com/repos/%s/%s/releases/%s" % (owner, repo, release_id)
edit_data = {"draft": False}
edit_resp = request(edit_url, "Release publishing", json_data=edit_data)

This comment has been minimized.

Copy link
@jgraham

jgraham Oct 9, 2019

Contributor

It looks like this will do a POST request not PATCH?

This comment has been minimized.

Copy link
@foolip

foolip Oct 9, 2019

Author Contributor

Yep, didn't spot the PATCH in https://developer.github.com/v3/repos/releases/#edit-a-release and it looks like GitHub accepts this.

The easy way to fix this is to add a method=None argument to request, but unless it's a string enum it would leak that fact that requests is being used within.

This comment has been minimized.

Copy link
@jgraham

jgraham Oct 9, 2019

Contributor

I think adding a method argument that defaults to None is fine.

This comment has been minimized.

Copy link
@foolip

foolip Oct 9, 2019

Author Contributor

I've pushed a third commit to do just that, and verified that it could produce https://github.com/foolip/wpt/releases/tag/merge_pr_19493.

@jgraham
jgraham approved these changes Oct 9, 2019
@foolip foolip merged commit f60b9f7 into master Oct 9, 2019
19 checks passed
19 checks passed
build-and-publish
Details
build-and-tag
Details
Azure Pipelines Build #20191009.83 succeeded
Details
Azure Pipelines (./wpt test-jobs) ./wpt test-jobs succeeded
Details
Azure Pipelines (affected tests without changes: Safari Technology Preview) affected tests without changes: Safari Technology Preview succeeded
Details
Azure Pipelines (affected tests: Safari Technology Preview) affected tests: Safari Technology Preview succeeded
Details
Azure Pipelines (infrastructure/ tests: macOS) infrastructure/ tests: macOS succeeded
Details
Azure Pipelines (tools/ unittests: Windows Python 3) tools/ unittests: Windows Python 3 succeeded
Details
Azure Pipelines (tools/ unittests: Windows) tools/ unittests: Windows succeeded
Details
Azure Pipelines (tools/ unittests: macOS) tools/ unittests: macOS succeeded
Details
Azure Pipelines (tools/wpt/ tests: Windows) tools/wpt/ tests: Windows succeeded
Details
Azure Pipelines (tools/wpt/ tests: macOS) tools/wpt/ tests: macOS succeeded
Details
Azure Pipelines (tools/wptrunner/ unittests: Windows) tools/wptrunner/ unittests: Windows succeeded
Details
Azure Pipelines (tools/wptrunner/ unittests: macOS) tools/wptrunner/ unittests: macOS succeeded
Details
Azure Pipelines (wpt.fyi hook: safari-preview-affected-tests) wpt.fyi hook: safari-preview-affected-tests succeeded
Details
Azure Pipelines (wpt.fyi hook: safari-preview-affected-tests-without-changes) wpt.fyi hook: safari-preview-affected-tests-without-changes succeeded
Details
Taskcluster (pull_request) TaskGroup: success
Details
staging.wpt.fyi - safari[experimental] Safari results
Details
wpt.fyi - safari[experimental] Safari results
Details
@foolip foolip deleted the foolip/manifest-draft branch Oct 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.