dnscontrol/docs/release-engineering.md

220 lines
5.9 KiB
Markdown
Raw Normal View History

---
layout: default
title: How to build and ship a release
---
# How to build and ship a release
2017-11-03 05:51:52 +08:00
These are the instructions for producing a release.
Please change the version number as appropriate.
2020-10-13 00:11:54 +08:00
## Step 1. Tools check
Make sure you are using the latest version of `go`
(listed on [https://golang.org/dl/](https://golang.org/dl/))
```
go version
```
2020-02-13 02:51:00 +08:00
2020-12-26 23:05:46 +08:00
## Step 2. Create a new release branch
2017-11-03 05:51:52 +08:00
From the "master" branch, run `bin/make-release.sh v3.xx.y` where
"v3.xx.y" should be the new release version.
2021-07-22 01:40:25 +08:00
NOTE: This warning can be ignored: `error: failed to push some refs to 'github.com:StackExchange/dnscontrol.git'`
The `make-release.sh` script will do the following:
2017-11-03 05:51:52 +08:00
2020-12-26 23:05:46 +08:00
1. Tag the current branch locally and remotely.
2. Update main.go with the new version string.
3. Create a file called draft-notes.txt which you will edit into the
release notes.
4. Print instructions on how to create the release PR.
NOTE: If you bump the major version, you need to change all the source
files. The last time this was done (v2 -> v3) these two commands
automated all that:
```
# Make all the changes:
sed -i.bak -e 's@github.com.StackExchange.dnscontrol.v2@github.com/StackExchange/dnscontrol/v3@g' go.* $(fgrep -lri --include '*.go' github.com/StackExchange/dnscontrol/v2 *)
# Delete the backup files:
find * -name \*.bak -delete
```
2020-02-13 02:51:00 +08:00
2021-10-04 03:41:46 +08:00
## Step 3. Verify the version string
Verify the version string was updated:
```
$ grep Version main.go
```
(Make sure that it lists the new version number.)
2021-10-04 03:41:46 +08:00
## Step 4. Make the PR
The output of "make-release.sh" will mention a URL that will create the PR ("1. Create a PR:")
Load the URL and make the PR.
## Step 5. Write the release notes.
2020-02-13 02:51:00 +08:00
2020-12-26 23:05:46 +08:00
draft-notes.txt is just a draft and needs considerable editing.
2020-02-13 02:51:00 +08:00
2021-01-30 23:18:21 +08:00
Once complete, the contents of this file will be used in multiple
places (release notes, email announcements, etc.)
2020-02-13 02:51:00 +08:00
Entries in the bullet list should be phrased in the positive: "Feature
FOO now does BAR". This is often the opposite of the related issue,
which was probably phrased, "Feature FOO is broken because of BAR".
Every item should include the ID of the issue related to the change.
If there was no issue, create one and close it.
Sort the list most important/exciting changes earlier in the list.
Items related to a specific provier should begin with the all-caps
name of the provider, such as "ROUTE53: Added support for sandwiches (#100)"
See [https://github.com/StackExchange/dnscontrol/releases for examples](https://github.com/StackExchange/dnscontrol/releases) for recent release notes and copy that style.
Example/template:
```
This release includes many new providers (JoeDNS and MaryDNS), dozens
of bug fixes, and a new testing framework that makes it easier to add
big features without fear of breaking old ones.
Major features:
* NEW PROVIDER: Providername (#issueid)
* Add FOO DNS record support (#issueid)
* Add SIP/JABBER labels to underscore exception list (#453)
Provider-specific changes:
* PROVIDER: New feature or thing (#issueid)
* PROVIDER: Another feature or bug fixed (#issueid)
* CLOUDFLARE: Fix CF trying to update non-changeable TTL (#issueid)
```
2021-10-04 03:41:46 +08:00
## Step 6. Make the draft release.
2017-11-03 05:51:52 +08:00
[On github.com, click on "Draft a new release"](https://github.com/StackExchange/dnscontrol/releases/new)
2018-12-20 04:08:56 +08:00
Fill in the `Tag version` @ `Target` with:
* Tag version: v$VERSION (this should be the first tag listed)
* Target: master (this should be the default; and disappears when
you enter the tag)
Release title: Release v$VERSION
2020-02-13 02:51:00 +08:00
Fill in the text box with the release notes written above.
(DON'T click SAVE until the next step is complete!)
(DO use the "preview" tab to proofread the text.)
2021-10-04 03:41:46 +08:00
## Step 7. Verify tests completed.
By now the tests should have started running.
2020-12-26 23:05:46 +08:00
2021-01-30 23:18:21 +08:00
Verify that the automated tests passed. If not, fix the problems
before you continue.
2021-10-04 03:41:46 +08:00
## Step 8. Merge
Merge the PR.
The tests will run again.
Once they pass, you are ready to create and promote the release (see next step).
2021-10-04 03:41:46 +08:00
## Step 9. Publish the release
a. Publish the release.
2021-10-04 03:41:46 +08:00
* Make sure the "This is a pre-release" checkbox is NOT checked.
2021-01-30 23:18:21 +08:00
* Click "Publish Release".
2018-12-20 04:08:56 +08:00
2020-12-26 23:05:46 +08:00
b. Wait for workflow to complete
2018-12-20 04:08:56 +08:00
There's a GitHub Actions [workflow](https://github.com/StackExchange/dnscontrol/actions?query=workflow%3Arelease) which automatically builds and attaches
all 3 binaries to the release. Refresh the page after a few minutes and you'll
see dnscontrol-Darwin, dnscontrol-Linux, and dnscontrol.exe attached as assets.
2021-10-04 03:41:46 +08:00
## Step 10. Announce it via email
2017-11-03 05:51:52 +08:00
2020-02-13 02:51:00 +08:00
Email the release notes to the mailing list: (note the format of the Subject line and that the first line of the email is the URL of the release)
```
To: dnscontrol-discuss@googlegroups.com
Subject: New release: dnscontrol v$VERSION
https://github.com/StackExchange/dnscontrol/releases/tag/v$VERSION
2020-02-13 02:51:00 +08:00
[insert the release notes here]
```
2020-02-13 02:51:00 +08:00
NOTE: You won't be able to post to the mailing list unless you are on
it. [Click here to join](https://groups.google.com/forum/#!forum/dnscontrol-discuss).
2021-10-04 03:41:46 +08:00
## Step 11. Announce it via chat
Mention on [https://gitter.im/dnscontrol/Lobby](https://gitter.im/dnscontrol/Lobby) that the new release has shipped.
```
2021-01-30 23:18:21 +08:00
ANNOUNCEMENT: dnscontrol v$VERSION has been released! https://github.com/StackExchange/dnscontrol/releases/tag/v$VERSION
```
2021-10-04 03:41:46 +08:00
## Step 12. Get credit!
2017-11-03 05:51:52 +08:00
Mention the fact that you did this release in your weekly accomplishments.
If you are at Stack Overflow:
* Add the release to your weekly snippets
* Run this build: `dnscontrol_embed - Promote most recent artifact into ExternalDNS repo`
2020-02-13 02:51:00 +08:00
# Tip: How to update modules
List out-of-date modules and update any that seem worth updating:
2020-02-13 02:51:00 +08:00
```
go install github.com/oligot/go-mod-upgrade
go-mod-upgrade
go mod tidy
2020-02-13 02:51:00 +08:00
```
OLD WAY:
2020-02-13 02:51:00 +08:00
```
go install github.com/psampaz/go-mod-outdated
go list -mod=mod -u -m -json all | go-mod-outdated -update -direct
# If any are out of date, update via:
2020-02-13 02:51:00 +08:00
go get -u module/path
# Once the updates are complete, tidy up:
2020-02-13 02:51:00 +08:00
go mod tidy
```