Skip to content
This repository has been archived by the owner on Jun 20, 2024. It is now read-only.

Support draft and pre-releases in bin/release #1372

Merged
merged 6 commits into from
Sep 3, 2015
Merged

Conversation

awh
Copy link
Contributor

@awh awh commented Aug 28, 2015

This PR refactors the bin/release script to have three steps:

bin/release build
bin/release draft [--pre-release]
bin/release publish

The second step creates the GitHub release in draft state, optionally marked as pre-release; the final step removes the draft state (making the release visible to the outside world) and updates latest in {Git,Docker}Hub only if the pre-release attribute is missing.

Caveats

  • The previous implementation used git-describe with a --match=v* to find the most recent version tag. To support non-mainline releases I've had to remove all the 'v' related logic with three consequences:
    • The version in the changelog must match the exact tag name. For mainline releases it must include the 'v' prefix, which is not currently the case
    • With no prefix to search for, the new implementation uses git tag --points-at HEAD and expects to find a single tag there which it assumes is the version tag. This is slightly less flexible that before, because it means the HEAD of your local branch must be the tagged commit that you want to build
    • The latest_release tag must point at the version tag, not directly at the commit object (e.g. you must now use git tag -af latest_release v2.0.0 whereas before you could have had v2.0.0 checked out and done git tag -af latest_release). The current release instructions describe the first method anyway, so probably not a big deal

Outstanding Issues

  • Something of a showstopper - the github-release edit command used to remove the draft status resets the description field. I can think of a several solutions to this, none of which are very appealing:
    • Read the description with github release info first and then supply it back as an argument to github-release edit. Note that the output of info isn't really amenable to reliable parsing, particularly in the face of the freeform multiline description field
    • Manipulate the GitHub API directly to remove the draft status. Not straightforward due to the need to manually search through the (potentially paginated) list of releases to find the release ID; if we are willing to do this, begs the question of why we're bothering with github-release
    • Prompt the user to publish the release manually using the Github UI. We could do this either at the end of bin/release publish, or we could require them to do it first and check at the start
  • The current release process instructions specify (in bold) that the user updates the latest_release tag in the repository cloned into releases/, not in the repository in which they created the version tag and are running bin/release. This seems odd - does anyone object to the checks being modified so that they all operate on the 'outer' repository? (Related, there's a bug in the current logic anyway - see the 'Fix latest_release hash test' commit in this PR)

@dpw @rade @squaremo particularly interested in your opionions on the caveats and issues - this PR isn't ideal at the moment. Will hold off producing updated release process instructions for the wiki until things are ironed out.

Further explanatory material is available in the individual commit messages.

Fixes #880, fixes #909.

@awh
Copy link
Contributor Author

awh commented Aug 28, 2015

I've looked at fixing github-release edit so that it only populates the PATCH JSON for those properties that have been specified, but the command line parser they use isn't up to it (it can't distinguish between not specifying a string vs specifying an empty string for example). It wouldn't be hard to add a github-release publish that just flips the bit we require though, and it does align with the GitHub UI operations so would probably be acceptable upstream as a PR.

@awh awh force-pushed the issues/880-draft-releases branch 2 times, most recently from 8e01164 to fa1e2e2 Compare September 1, 2015 15:34
When publishing pre-releases via the release script we do not want to
modify the `latest` tag in DockerHub - specifying UPDATE_LATEST=false
causes publish to push to $WEAVE_VERSION only. Omitting the flag
entirely retains the existing behaviour for backwards compatability.
To support arbitrarily named pre-releases we no longer impose any
restrictions on the format of the most recent annotated tag - instead we
expect to find a single annotated tag pointing at HEAD of the current
branch and assume this is the version to release.
Pull common checks out to top level in preparation for the introduction
of an additional process step.
The publish stage has been split into two pieces - a draft step that
creates a draft version release in Github and a publish step that
publishes the draft, updates `latest_release` and pushes images to
DockerHub.

It is also possible to specify `--pre-release` to draft. Once published
such a release will be marked with a prominent warning in GitHub;
additionally we do not update `latest_release` in GitHub nor push an
update to the `latest` tag in DockerHub.
@awh
Copy link
Contributor Author

awh commented Sep 1, 2015

I have forked github-release, implemented github-release publish and updated bin/release to use it.

go get github.com/weaveworks/github-release to test...

Obtain the version and latest_release tag commit hashes before changing
into the cloned repository so that all tagging and pushing happens on
the outer repository.
@awh
Copy link
Contributor Author

awh commented Sep 2, 2015

After discussion with @squaremo I have modified the script so that all tag checking operations happen on the outer repository. Since both currently outstanding issues are now addressed, I've included another commit which adds docs/release-process.md outlining the new release process.

@awh awh self-assigned this Sep 2, 2015
@awh awh force-pushed the issues/880-draft-releases branch 2 times, most recently from 1077f04 to 25c08db Compare September 2, 2015 15:25
@awh awh removed their assignment Sep 2, 2015
@awh
Copy link
Contributor Author

awh commented Sep 2, 2015

Have tested both mainline and pre-release paths; this PR is ready for review.

you can just run `./bin/release publish` again.
* If it turns out you released the wrong thing, you can delete the
release on GitHub and start again; it's the only thing that has to
be manually deleted.

This comment was marked as abuse.

This comment was marked as abuse.

This comment was marked as abuse.

@awh
Copy link
Contributor Author

awh commented Sep 3, 2015

Update documentation.

@rade
Copy link
Member

rade commented Sep 3, 2015

LGTM

I suggest we

rade added a commit that referenced this pull request Sep 3, 2015
Support draft and pre-releases in `bin/release`

Fixes #880. Fixes #909.
@rade rade merged commit 4c6a8f2 into master Sep 3, 2015
@awh awh deleted the issues/880-draft-releases branch September 3, 2015 15:44
@rade rade modified the milestone: 1.1.0 Sep 4, 2015
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.

make the release script support non-mainline releases Update bin/release to create releases in draft state
2 participants