···11+---
22+title: "Palisade: Version Bumping at Scale in CI"
33+date: 2020-09-14
44+---
55+66+<XeblogConv name="Cadey" mood="enby">
77+This post was originally available on the LightspeedHQ Tech blog. That
88+blog has since been discontinued. Should you want to read the post in
99+its original form, it is available on
1010+[archive.org](https://web.archive.org/web/20210318102148/https://tech.lightspeedhq.com/palisade-version-bumping-at-scale-in-ci/).
1111+This version of the post is archived here for posterity.
1212+</XeblogConv>
1313+1414+Traditionally, software release processes are done manually and can be
1515+difficult to integrate into review processes. At Lightspeed, we
1616+created [Palisade](https://github.com/lightspeed/palisade) to solve
1717+this problem. Palisade moves version and release information from
1818+repository metadata into the repository itself so that is easier to
1919+review and approve. Palisade is open-source software released under
2020+the MIT license and can be used by anyone that wants to do version
2121+bumping as a part of their CI processes.
2222+2323+## CHANGELOG.md and VERSION Files
2424+2525+Palisade works by reading two files in the root of your repository:
2626+2727+* A [`CHANGELOG.md`](https://keepachangelog.com/en/1.0.0/) file that
2828+ describes the changes made to the program
2929+* A `VERSION` file that contains the current version of the program
3030+ (ideally following [semantic versioning](https://semver.org/))
3131+3232+Every time Palisade is run, it will check the git repository for
3333+version tags based on the contents of the `VERSION` file. If it finds
3434+that the current version has already been tagged, Palisade will do
3535+nothing and exit with the exit code 0. If Palisade finds that there is
3636+a new release, the software will then read the changelog file, scrape
3737+it for release notes, then use those release notes when creating a new
3838+release on GitHub.
3939+4040+As an example, here is a fragment of [Palisade’s
4141+changelog](https://github.com/lightspeed/palisade/blob/master/CHANGELOG.md)
4242+and the release that was created on GitHub:
4343+4444+```markdown
4545+## 0.4.0
4646+4747+Tag names were incorrectly generated. Before they were the version
4848+numbers, but now they are `v${VERSION}`. This should fix compatibility
4949+issues with Go modules.
5050+5151+An end-to-end test has been fixed as well.
5252+```
5353+5454+This changelog fragment was scraped out and used as the release notes
5555+for [this
5656+release](https://github.com/lightspeed/palisade/releases/tag/v0.4.0).
5757+5858+## Setup
5959+6060+There is more up-to-date detail here, but at a high level you need to
6161+do the following things:
6262+6363+* Set up a CHANGELOG.md file
6464+* Set up a VERSION file
6565+* Commit these files to your repository
6666+* Create a GitHub token with the `repo` permission
6767+* Be sure the user associated with that GitHub token has Maintain
6868+ permissions on the repository
6969+* Add this token to your CI configuration (use secrets when possible)
7070+* Add CI configuration
7171+* Push this all to your repository
7272+* Test a version bump
7373+* Sit back and relax
7474+7575+### Version Bump Flow
7676+7777+To release a new version of a program, first update the version file
7878+to the desired version. Open the `VERSION` file with your favorite
7979+text editor and replace:
8080+8181+```
8282+0.1.0
8383+```
8484+8585+with:
8686+8787+```
8888+0.2.0
8989+```
9090+9191+Then, update the changelog file with the changes in that version. For
9292+example if version `0.2.0` added the ability to interface with clients
9393+using GraphQL, you could add this to your `CHANGELOG.md`:
9494+9595+```markdown
9696+## 0.2.0
9797+9898+### ADDED
9999+100100+- Exposed GraphQL API for customers and internal integrators
101101+102102+### FIXED
103103+104104+- Solved WAT-2392 which previously prevented users from being able to
105105+ refrobnicate already frobnicated strings when using the secret
106106+ management API.
107107+```
108108+109109+When Palisade runs, it will load the contents of the `VERSION` file
110110+and compare it to the list of git tags in the repo. If that version
111111+tag is not found, then it will create a new GitHub release with the
112112+changelog entry for the new version. Palisade will never re-tag
113113+releases, so it will do nothing if you make a commit without changing
114114+the current version number.
115115+116116+When Palisade processes the above changelog, it would create a release
117117+for tag `v0.2.0` with the following notes:
118118+119119+```markdown
120120+### ADDED
121121+122122+- Exposed GraphQL API for customers and internal integrators
123123+124124+### FIXED
125125+126126+- Solved WAT-2392 which previously prevented users from being able to
127127+ refrobnicate already frobnicated strings when using the secret
128128+ management API.
129129+```
130130+131131+## Architecture
132132+133133+Palisade is written in Rust and uses Nix to build Docker images. Rust
134134+allowed this project to be developed incredibly quickly and Nix makes
135135+the built Docker image as small as possible (16 megabytes or so when
136136+gzipped).
137137+138138+One of the biggest problems that came up during development was the
139139+fact that the existing GitHub API clients were outdated and
140140+insufficient for our needs. Thanks to the hard work done by the team
141141+behind reqwest, it was easy for us to create a minimal wrapper around
142142+the parts of the GitHub API that Palisade requires, and we’ve exposed
143143+it for reuse. If you want to use this library in your Rust projects,
144144+add the following to your `Cargo.toml` file:
145145+146146+```ini
147147+[dependencies.github]
148148+git = "https://github.com/lightspeed/palisade"
149149+```
150150+151151+---
152152+153153+To find out more about Palisade, check out its repo at
154154+[github.com/lightspeed/palisade](https://github.com/lightspeed/palisade).
155155+We welcome feedback and contributions. If you run into any problems,
156156+please be sure to let us know and we can help resolve them and correct
157157+any documentation that leads you down the wrong path.