2017-08-24 23:32:51 +08:00
# How to build and ship a release
2017-11-03 05:51:52 +08:00
2020-03-23 03:36:35 +08:00
These are the instructions for producing a release.
2017-08-24 23:32:51 +08:00
2022-08-15 22:41:45 +08:00
CircleCI will do most of the work for you. You will need to edit the draft release notes.
2020-01-28 23:44:07 +08:00
2022-08-15 22:41:45 +08:00
Please change the version number as appropriate. Substitute (for example)
2023-03-22 13:10:08 +08:00
`v3.28.0` any place you see `$VERSION` in this doc.
2020-03-23 03:36:35 +08:00
2023-01-13 05:59:42 +08:00
## Step 1. Rebuild generated files
2020-03-23 03:36:35 +08:00
2022-08-15 22:41:45 +08:00
```shell
2023-03-22 13:10:08 +08:00
export VERSION=v3.28.0
2022-08-31 20:34:24 +08:00
git checkout master
2023-01-13 05:59:42 +08:00
git pull
2023-03-22 13:10:08 +08:00
go fmt ./...
go generate ./...
2023-01-13 06:19:12 +08:00
go mod tidy
2023-03-22 13:10:08 +08:00
git commit -a -m "Update generated files for $VERSION"
2023-01-13 05:59:42 +08:00
```
## Step 2. Tag the commit in master that you want to release
```shell
2023-03-22 13:10:08 +08:00
export VERSION=v3.28.0
git tag -m "Release $VERSION" -a $VERSION
2022-08-15 22:41:45 +08:00
git push origin --tags
2020-03-23 03:36:35 +08:00
```
2022-08-15 22:41:45 +08:00
See [Git Docs ](https://git-scm.com/book/en/v2/Git-Basics-Tagging ) for more examples.
2020-02-13 02:51:00 +08:00
2022-08-15 22:41:45 +08:00
Soon after
2022-08-31 20:34:24 +08:00
CircleCI will start a [build ](https://app.circleci.com/pipelines/github/StackExchange/dnscontrol ) Workflow and produce all of the artifacts for the release.
2021-10-04 03:41:46 +08:00
2023-01-22 06:25:01 +08:00
![CircleCI Release Screenshot ](assets/release-engineering/circleci_release.png )
2021-07-01 22:17:43 +08:00
2023-01-13 05:59:42 +08:00
## Step 3. Create the release notes
2021-07-01 22:17:43 +08:00
2022-08-15 22:41:45 +08:00
The draft release notes are created for you. In this step you'll edit them.
2021-07-01 22:17:43 +08:00
2022-08-15 22:41:45 +08:00
The CircleCI build uses [GoReleaser ](https://goreleaser.com/ ) which produces the [GitHub Release ](https://github.com/StackExchange/dnscontrol/releases ) with Release Notes derived from the commit history between now and the last tag.
These notes are just a draft and needs considerable editing.
You can also find a copy of the release notes in the CircleCI `release` job Artifacts.
These release notes will be used in multiple places (release notes, email announcements, etc.)
2021-07-01 22:17:43 +08:00
2022-08-15 22:41:45 +08:00
Release notes style guide:
2021-10-04 03:41:46 +08:00
2022-08-15 22:41:45 +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.
2022-11-03 21:12:08 +08:00
* Items related to a specific provider should begin with the all-caps name of the provider, such as "ROUTE53: Added support for sandwiches (#100)"
2022-09-06 20:21:57 +08:00
* The `Deprecation warnings` section should just copy from `README.md` . If you change one, change it in the README too (you can make that change in this PR).
2020-02-13 02:51:00 +08:00
2023-01-20 20:56:20 +08:00
See [https://github.com/StackExchange/dnscontrol/releases ](https://github.com/StackExchange/dnscontrol/releases ) for examples for recent release notes and copy that style.
2020-02-13 02:51:00 +08:00
2022-08-31 20:34:24 +08:00
Template:
2020-02-13 02:51:00 +08:00
2022-02-18 01:22:31 +08:00
```text
2022-08-31 20:34:24 +08:00
## Changelog
2020-02-13 02:51:00 +08:00
2022-08-31 20:34:24 +08:00
This release includes many new providers (FILL IN), dozens
of bug fixes, and FILL IN.
2020-02-13 02:51:00 +08:00
2022-08-31 20:34:24 +08:00
### Breaking changes:
2020-02-13 02:51:00 +08:00
2022-08-31 20:34:24 +08:00
* FILL IN
2020-02-13 02:51:00 +08:00
2022-08-31 20:34:24 +08:00
### Major features:
* FILL IN
### Provider-specific changes:
* FILL IN
### Other changes and improvements:
* FILL IN
2023-01-20 20:56:20 +08:00
### Deprecation warnings:
2020-02-13 02:51:00 +08:00
```
2023-01-13 05:59:42 +08:00
## Step 4. 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)
2017-08-24 23:32:51 +08:00
2022-02-18 01:22:31 +08:00
```text
2017-08-24 23:32:51 +08:00
To: dnscontrol-discuss@googlegroups.com
2020-01-29 05:59:09 +08:00
Subject: New release: dnscontrol v$VERSION
2017-08-24 23:32:51 +08:00
2020-01-29 05:59:09 +08:00
https://github.com/StackExchange/dnscontrol/releases/tag/v$VERSION
2017-08-24 23:32:51 +08:00
2020-02-13 02:51:00 +08:00
[insert the release notes here]
2017-08-24 23:32:51 +08:00
```
2023-01-20 20:56:20 +08:00
{% hint style="info" %}
**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/g/dnscontrol-discuss ).
{% endhint %}
2020-02-13 02:51:00 +08:00
2023-01-13 05:59:42 +08:00
## Step 5. Announce it via chat
2017-11-03 07:35:08 +08:00
Mention on [https://gitter.im/dnscontrol/Lobby ](https://gitter.im/dnscontrol/Lobby ) that the new release has shipped.
2022-02-18 01:22:31 +08:00
```text
2021-01-30 23:18:21 +08:00
ANNOUNCEMENT: dnscontrol v$VERSION has been released! https://github.com/StackExchange/dnscontrol/releases/tag/v$VERSION
2017-11-03 07:35:08 +08:00
```
2023-01-13 05:59:42 +08:00
## Step 6. Get credit
2017-11-03 05:51:52 +08:00
Mention the fact that you did this release in your weekly accomplishments.
2018-03-17 01:07:42 +08:00
If you are at Stack Overflow:
2022-08-15 22:41:45 +08:00
* 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
2022-08-15 22:41:45 +08:00
## Tip: How to bump the major version
2020-02-13 02:51:00 +08:00
2022-08-15 22:41:45 +08:00
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
were used. They're included her for reference.
2023-01-20 20:56:20 +08:00
```shell
2022-08-15 22:41:45 +08:00
# 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
```
2023-01-20 20:56:20 +08:00
## Tip: Configuring CircleCI integration tests
2023-01-13 03:09:54 +08:00
2023-01-20 20:56:20 +08:00
### Overview
2023-01-13 03:09:54 +08:00
2023-01-20 20:56:20 +08:00
CircleCI is configured to run an integration test for any provider listed in the "provider" list. However the test is skipped if the `*_DOMAIN` variable is not set. For example, the GCLOUD provider integration test is only run if `GCLOUD_DOMAIN` is set.
2023-01-13 03:09:54 +08:00
* Q: Where is the list of providers to run integration tests on?
* A: In `.circleci/config.yml` look for the "provider" list:
Example:
2023-01-20 20:56:20 +08:00
```yaml
2023-01-13 03:09:54 +08:00
workflows:
build:
jobs:
- integration-tests:
matrix:
parameters:
provider:
- GCLOUD
```
* Q: Where are non-secret environment variables stored?
* A: In `.circleci/config.yml` look for:
2023-01-20 20:56:20 +08:00
```yaml
2023-01-13 03:09:54 +08:00
jobs:
integration-tests:
environment: # environment variables for the build itself
GCLOUD_EMAIL: dnscontrol@dnscontrol-dev.iam.gserviceaccount.com
GCLOUD_PROJECT: dnscontrol-dev
```
* Q: Where are SECRET environment variables stored?
2023-01-20 20:56:20 +08:00
* A: In the project: [project settings / environment variables ](https://app.circleci.com/settings/project/github/StackExchange/dnscontrol/environment-variables )
2023-01-13 03:09:54 +08:00
### How do I add a single new integration test?
1. Edit `.circleci/config.yml`
2. Add the name of the provider (ALL CAPS) to the "provider" list.
3. Any non-secret env variables needed? Add them to the "environment" section.
4. Any secrets? Add them to the [project settings / environment variables ](https://app.circleci.com/settings/project/github/StackExchange/dnscontrol/environment-variables )
2023-01-20 20:56:20 +08:00
5. Add the `_DOMAIN` environment variable to [project settings / environment variables ](https://app.circleci.com/settings/project/github/StackExchange/dnscontrol/environment-variables ). It is not secret, but must be set as part of the project.
2023-01-13 03:09:54 +08:00
### How do I add a "bring your own keys" integration test?
Overview: You will fork the repo and add any secrets to your fork. For security reasons you won't have access to the secrets from the main repository.
2023-01-20 20:56:20 +08:00
1. [Fork StackExchange/dnscontrol ](https://github.com/StackExchange/dnscontrol/fork ) in GitHub.
2023-01-13 03:09:54 +08:00
2023-01-20 20:56:20 +08:00
If you already have a fork, be sure to use the "sync fork" button on the main page to sync with master.
2023-01-13 03:09:54 +08:00
2023-01-20 20:56:20 +08:00
2. Create a CircleCI account
2023-01-13 03:09:54 +08:00
2023-01-20 20:56:20 +08:00
Go to [circleci.com ](https://circleci.com/signup/ ) and follow the instructions.
2023-01-13 03:09:54 +08:00
2023-01-20 20:56:20 +08:00
3. Set up a CircleCI project
2023-01-13 03:09:54 +08:00
2023-01-20 20:56:20 +08:00
On the projects page, find "dnscontrol". Click "Set Up Project". Use the "Fastest" method (use the existing `.circleci/config.yml` file).
2023-01-13 03:09:54 +08:00
2023-01-20 20:56:20 +08:00
If you get the error message below, go to the "Organization Settings" (left nav). Then "Security" (left nav) and set "Allow Uncertified Orbs" under "Orb Security Settings" to "Yes".
2023-01-13 03:09:54 +08:00
2023-01-20 20:56:20 +08:00
>"Orb cloudsmith/cloudsmith@1.0.5 not loaded. To use this orb, an organization admin must opt-in to using third party orbs in Organization Security settings."
2023-01-13 03:09:54 +08:00
4. Add the secret env variables:
2023-01-20 20:56:20 +08:00
Go to Project Settings (for this project), and "Environment Variables".
2023-01-13 03:09:54 +08:00
2023-01-20 20:56:20 +08:00
* Add env variable `provider_DOMAIN` where "provider" is the all caps name of the provider. For example add `BIND_DOMAIN` with the value "example.com"
2023-01-13 03:09:54 +08:00
5. Start a build
2023-01-20 20:56:20 +08:00
From the pipelines page, you can trigger a build by setting the branch to "master" then click "trigger".
2023-01-13 03:09:54 +08:00
2023-01-20 20:56:20 +08:00
Merges to "master" result in the software being built. Merges to any other branch causes integration tests to run.
2023-01-13 03:09:54 +08:00
2023-01-20 20:56:20 +08:00
Verify that your tests are working properly by making a branch. You'll see on the `Run integration tests for _____ provider` step the results of the test.
2023-01-13 03:09:54 +08:00
2023-01-20 20:56:20 +08:00
Some notes:
2023-01-13 03:09:54 +08:00
2023-01-20 20:56:20 +08:00
* Tests that are skipped take about 3 seconds to complete. In other words, if you look at a list of tests, you can tell which ones were skipped by looking at the completion time.
* Free accounts don't have access to `2xlarge` instanace. You'll either need to upgrade your CircleCI account or change `2xlarge` to `large` in `.circleci/config.yml` in your fork. Please be careful to not include that file when you send a PR. See [#1935 ](https://github.com/StackExchange/dnscontrol/issues/1935 ) (Anyone have tips on how to make that easier?)
2023-01-13 03:09:54 +08:00
2022-08-15 22:41:45 +08:00
## Tip: How to rebuild flattener
2022-07-20 22:47:06 +08:00
2023-01-20 20:56:20 +08:00
Rebuilding flatter requires go1.17.1 and the gopherjs compiler.
2022-07-20 22:47:06 +08:00
Install go1.17.1:
2022-08-15 22:41:45 +08:00
```shell
2022-07-20 22:47:06 +08:00
go install golang.org/dl/go1.17.1@latest
go1.17.1 download
```
2023-01-20 20:56:20 +08:00
Install [GopherJS ](https://github.com/gopherjs/gopherjs ):
2022-07-20 22:47:06 +08:00
2022-08-15 22:41:45 +08:00
```shell
2022-07-20 22:47:06 +08:00
go install github.com/gopherjs/gopherjs@latest
```
Build the software:
2023-01-20 20:56:20 +08:00
{% hint style="info" %}
**NOTE**: GOOS can't be Darwin because GOPHERJS doesn't support it.
{% endhint %}
2022-07-20 22:47:06 +08:00
2022-08-15 22:41:45 +08:00
```shell
2022-07-21 21:25:10 +08:00
cd docs/flattener
2022-07-20 22:47:06 +08:00
export GOPHERJS_GOROOT="$(go1.17.1 env GOROOT)"
export GOOS=linux
gopherjs build
```
2022-08-15 22:41:45 +08:00
## Tip: How to update modules
2020-02-13 02:51:00 +08:00
2021-04-23 04:07:53 +08:00
List out-of-date modules and update any that seem worth updating:
2020-02-13 02:51:00 +08:00
2023-01-20 20:56:20 +08:00
```shell
2022-01-03 23:02:21 +08:00
go install github.com/oligot/go-mod-upgrade@latest
2021-04-23 04:07:53 +08:00
go-mod-upgrade
go mod tidy
2020-02-13 02:51:00 +08:00
```
2021-04-23 04:07:53 +08:00
OLD WAY:
2020-02-13 02:51:00 +08:00
2023-01-20 20:56:20 +08:00
```shell
2022-01-03 23:02:21 +08:00
go install github.com/psampaz/go-mod-outdated@latest
2021-04-23 04:07:53 +08:00
go list -mod=mod -u -m -json all | go-mod-outdated -update -direct
# If any are out of date, update via:
2022-02-02 03:47:27 +08:00
go get module/path
2020-02-13 02:51:00 +08:00
2021-04-23 04:07:53 +08:00
# Once the updates are complete, tidy up:
2020-02-13 02:51:00 +08:00
go mod tidy
```