github.com/teknogeek/dnscontrol/v2@v2.10.1-0.20200227202244-ae299b55ba42/docs/release-engineering.md (about)

     1  ---
     2  layout: default
     3  title: How to build and ship a release
     4  ---
     5  
     6  # How to build and ship a release
     7  
     8  Here are my notes from producing the v2.8 release.  Change the version number as appropriate.
     9  
    10  
    11  ## Step 1. Vendor the modules
    12  
    13  Vendor the modules. The vendored files are not used (unless you change
    14  the builds to use `-mod=vendor`). They are maintained simply to make
    15  sure that we have a backup in the unlikely event of a disaster.
    16  
    17  ```
    18  go mod vendor
    19  git add vendor
    20  git commit -m'vendor modules' vendor
    21  ```
    22  
    23  TODO(Tom): build.go should verify that this was done, similar to
    24  how it tests that gofmt was run.
    25  
    26  
    27  ## Step 2. Run the integration tests
    28  
    29  * If you are at StackOverflow, this is in TC as "DNS > Integration Tests".
    30  * Otherwise:
    31    * Run "go test" (documented in [Creating new DNS Resource Types](adding-new-rtypes))
    32    * Run the integration tests (documented in [Writing new DNS providers](writing-providers)
    33  
    34  
    35  ## Step 3. Bump the version number
    36  
    37  Edit the "Version" variable in `main.go` and commit.
    38  
    39  ```
    40  export PREVVERSION=2.10.0       <<< Change to the previous version
    41  export VERSION=2.11.0           <<< Change to the new release version
    42  git checkout master
    43  vi main.go
    44  git commit -m'Release v'"$VERSION" main.go
    45  git tag v"$VERSION"
    46  git push origin tag v"$VERSION"
    47  ```
    48  
    49  
    50  ## Step 4. Write the release notes.
    51  
    52  The release notes that you write will be used in a few places.
    53  
    54  To find items to write about, review the git log using this command:
    55  
    56      git log v"$VERSION"...v"$PREVVERSION"
    57  
    58  Entries in the bullet list should be phrased in the positive: "Feature
    59  FOO now does BAR".  This is often the opposite of the related issue,
    60  which was probably phrased, "Feature FOO is broken because of BAR".
    61  
    62  Every item should include the ID of the issue related to the change.
    63  If there was no issue, create one and close it.
    64  
    65  Sort the list most important/exciting changes earlier in the list.
    66  
    67  Put the "[BREAKING CHANGE]" on any breaking change.
    68  
    69  Items related to a specific provier should begin with the all-caps
    70  name of the provider, such as "ROUTE53: Added support for sandwiches (#100)"
    71  
    72  
    73  See [https://github.com/StackExchange/dnscontrol/releases for examples](https://github.com/StackExchange/dnscontrol/releases) for recent release notes and copy that style.
    74  
    75  Example/template:
    76  
    77  ```
    78  This release includes many new providers (JoeDNS and MaryDNS), dozens
    79  of bug fixes, and a new testing framework that makes it easier to add
    80  big features without fear of breaking old ones.
    81  
    82  Major features:
    83  
    84  * NEW PROVIDER: Providername (#issueid)
    85  * Add FOO DNS record support (#issueid)
    86  * Add SIP/JABBER labels to underscore exception list (#453)
    87  
    88  Provider-specific changes:
    89  
    90  * PROVIDER: New feature or thing (#issueid)
    91  * PROVIDER: Another feature or bug fixed (#issueid)
    92  * CLOUDFLARE: Fix CF trying to update non-changeable TTL (#issueid)
    93  ```
    94  
    95  ## Step 5. Make the draft release.
    96  
    97  [On github.com, click on "Draft a new release"](https://github.com/StackExchange/dnscontrol/releases/new)
    98  
    99  Fill in the `Tag version` @ `Target` with:
   100  
   101    * Tag version: v$VERSION (this should be the first tag listed)
   102    * Target: master (this should be the default)
   103  
   104  Release title: Release v$VERSION
   105  
   106  Fill in the text box with the release notes written above.
   107  
   108  (Don't click SAVE until the next step is complete!)
   109  
   110  Create the binaries and attach them to the release:
   111  
   112      go run build/build.go
   113  
   114  NOTE: This command creates binaries with the version number and git hash embedded. It also builds the releases for all supported platforms (i.e. creates a .exe for Windows even if you are running on Linux.  Isn't Go amazing?)
   115  
   116  WARNING: if there are files that haven't been checked in, the version string will have "dirty" appended.
   117  
   118  This is what it looks like when you did it right:
   119  
   120  ```
   121  $ ./dnscontrol-Darwin version
   122  dnscontrol 2.8 ("ee5208bd5f19b9e5dd0bdba8d0e13403c43a469a") built 19 Dec 18 11:16 EST
   123  ```
   124  
   125  This is what it looks like when there was a file that wasn't checked in:
   126  
   127  ```
   128  $ ./dnscontrol-Darwin version
   129  dnscontrol 2.8 ("ee5208bd5f19b9e5dd0bdba8d0e13403c43a469a[dirty]") built 19 Dec 18 11:14 EST
   130                                                            ^^^^^
   131                                                            ^^^^^
   132                                                            ^^^^^
   133  ```
   134  
   135  
   136  ## Step 6. Attach the binaries and release.
   137  
   138  a. Drag and drop binaries into the web form.
   139  
   140  There is a box labeled "Attach binaries by dropping them here or
   141  selecting them".  Drag dnscontrol-Darwin, dnscontrol-Linux, and
   142  dnscontrol.exe onto that box (one at a time or all at once). This
   143  will upload the binaries.
   144  
   145  b. Submit the release.
   146  
   147  Make sure the "This is a pre-release" checkbox is UNchecked. Then click "Publish Release".
   148  
   149  
   150  ## Step 7. Announce it via email
   151  
   152  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)
   153  
   154  ```
   155  To: dnscontrol-discuss@googlegroups.com
   156  Subject: New release: dnscontrol v$VERSION
   157  
   158  https://github.com/StackExchange/dnscontrol/releases/tag/v$VERSION
   159  
   160  [insert the release notes here]
   161  ```
   162  
   163  NOTE: You won't be able to post to the mailing list unless you are on
   164  it.  [Click here to join](https://groups.google.com/forum/#!forum/dnscontrol-discuss).
   165  
   166  
   167  ## Step 8. Announce it via chat
   168  
   169  Mention on [https://gitter.im/dnscontrol/Lobby](https://gitter.im/dnscontrol/Lobby) that the new release has shipped.
   170  
   171  ```
   172  dnscontrol $VERSION has been released! https://github.com/StackExchange/dnscontrol/releases/tag/v$VERSION
   173  ```
   174  
   175  
   176  ## Step 9. Get credit!
   177  
   178  Mention the fact that you did this release in your weekly accomplishments.
   179  
   180  If you are at Stack Overflow:
   181  
   182    * Add the release to your weekly snippets
   183    * Run this build: `dnscontrol_embed - Promote most recent artifact into ExternalDNS repo`
   184  
   185  
   186  # Tip: How to update modules
   187  
   188  List out-of-date modules and update any that 
   189  
   190  ```
   191  go get -u github.com/psampaz/go-mod-outdated
   192  go list -u -m -json all | go-mod-outdated -update -direct 
   193  ```
   194  
   195  To update a module, `get` it, then re-run the unit and integration tests.
   196  
   197  ```
   198  go get -u
   199      or
   200  go get -u module/path
   201  ```
   202  
   203  Once the updates are complete, tidy up:
   204  
   205  ```
   206  go mod tidy
   207  ```
   208  
   209  When done, vendor the modules (see Step 1 above).