Dōki
A companion tool to work with versioning and keeping in sync profiles and pctl.
Features
go mod
Dōki, wraps some go mod
functionality for convenience and for usage in Makefiles.
latest
It provides a list of go get
-able urls for a list of modules, by adding the latest available tag to that module.
Example:
doki go mod latest github.com/weaveworks/pctl github.com/weaveworks/profiles
github.com/weaveworks/pctl@v0.0.3
github.com/weaveworks/profiles@v0.0.5
This output is best consumed by a make
target such as:
.PHONY: update-modules
go get \
$(shell doki mod latest \
github.com/weaveworks/profiles \
github.com/weaveworks/pctl \
<whatever> \
)
go mod tidy
Calling this make
target will result in the latest pins in go.mod
file to the list of these modules.
replace
Similar to latest
, it provides a list of replace
statements for modules.
Example:
doki go mod replace --replacements github.com/weaveworks/pctl=github.com/weaveworks/pctl@specific-version,github.com/weaveworks/profiles=github.com/weaveworks/profiles@specific-version
-replace github.com/weaveworks/pctl@<specific-version> -replace github.com/weaveworks/profiles@<specific-version>
This output is best consumed by another make target, or the same update-modules
target as above to make sure
all the modules always have the correct replacements.
.PHONY: update-modules
go mod edit \
$(shell doki mod replacements)
go get \
$(shell doki mod latest \
github.com/weaveworks/profiles \
github.com/weaveworks/pctl \
<whatever> \
)
go mod tidy
Note that we don't provide replace
argument here. The replacements could come from a global replacements map definition.
To have replacements in all products across multiple repos to the same thing using this single tool.
Convenient check to retrieve a dev tag for a branch.
Run:
➜ doki git:(my-new-branch) ✗ doki get dev tag
v0.0.1-my-new-branch
It will automatically fetch the latest released tag and append the branch to it. This is the format used by profiles
.
New commits push into existing tags, keeping them always up-to-date.
self update-check
This is a convenient function to check if your installation of Doki is up-to-date.
Optional Token
If Dōki is used to access a non-public repository, calls to determine the latest version might require a token.
For that, it provides two options:
- through
DOKI_TOKEN
- flag
--token
Development
Running tests: make tests
.
Releasing
There are some manual steps right now, should be streamlined soon.
Steps:
-
Create a new release notes file:
touch docs/release_notes/<version>.md
-
Copy-and paste the release notes from the draft on the releases page into this file.
Note: sometimes the release drafter is a bit of a pain, verify that the notes are
correct by doing something like: git log --first-parent tag1..tag2
.
-
PR the release notes into main.
-
Create and push a tag with the new version:
git tag <version>
git push origin <version>
-
The Create release
action should run. Verify that:
-
The release has been created in GitHub
- With the correct assets
- With the correct release notes
-
The image has been pushed to docker
-
The image can be pulled and used in a deployment
Note that <version>
must be in the following format: v0.0.1
.