Skip to content

Commit 9282784

Browse files
Clean up build scripts, make targets, and Dockerfile for snap. (#1570)
* Clean up build scripts, make targets, and Dockerfile for snap. * Update CONTRIBUTING.md
1 parent 7fd3b7b commit 9282784

File tree

6 files changed

+23
-301
lines changed

6 files changed

+23
-301
lines changed

CONTRIBUTING.md

+20-16
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,7 @@
2121
- [Build Scripts](#build-scripts)
2222
- [Releasing](#releasing)
2323
- [Tagging a release](#tagging-a-release)
24-
- [Prerequisites](#prerequisites)
25-
- [If a release fails](#if-a-release-fails)
26-
- [Github Releases & Dockerhub](#github-releases--dockerhub)
27-
- [Prerequisites](#prerequisites-1)
28-
- [Snap](#snap)
29-
- [Prerequisites](#prerequisites-2)
30-
- [Building a new snap base image](#building-a-new-snap-base-image)
24+
- [Snap](#snap)
3125
- [Updating Homebrew](#updating-homebrew)
3226

3327
<!-- markdown-toc end -->
@@ -204,8 +198,6 @@ To cut a release, push a new tag (versioning discussed below).
204198

205199
### Tagging a release
206200

207-
##### Prerequisites
208-
209201
1. Run `make changes` to review the changes since the last
210202
release. Based on the changes, decide what kind of release you are
211203
doing (bugfix, feature or breaking).
@@ -220,14 +212,26 @@ To cut a release, push a new tag (versioning discussed below).
220212

221213
The new tag triggers the release.
222214

223-
##### Building a new snap base image
215+
### Snap
216+
217+
Snap packages are automatically built and uploaded as part of the GitHub Actions
218+
release workflow.
219+
220+
To build a snap package locally for testing, first install `snapcraft`.
221+
222+
On Ubuntu, run:
223+
224+
sudo snap install snapcraft --classic
225+
226+
Or on MacOS, run:
227+
228+
brew install snapcraft
229+
230+
Finally, build the package by running:
231+
232+
make snap
224233

225-
Occasionally, the snap build will break. When it does, it usually means that you need to update
226-
the custom base image we use to build the snap. The Dockerfile for that image lives in
227-
[dockerfiles/Dockerfile.snap](https://github.com/digitalocean/doctl/blob/main/dockerfiles/Dockerfile.snap).
228-
The header of the Dockerfile has hints for updating the image, as well as instructions for building
229-
the image using `make snap_image`. Once you've built the image, the snap_image target will provide
230-
instructions for next steps.
234+
More details about the snap package can be found in the `snap/snapcraft.yaml` file.
231235

232236
### Updating Homebrew
233237

Makefile

+3-37
Original file line numberDiff line numberDiff line change
@@ -122,45 +122,12 @@ gofmt_check:
122122
check_focused:
123123
@scripts/check_focused_test.sh
124124

125-
.PHONY: snap_image
126-
snap_image:
127-
@echo "==> build docker image for releasing snap"
128-
@echo ""
129-
@scripts/snap_image.sh
130-
131-
.PHONY: _snap_image_version
132-
_snap_image_version:
133-
@ORIGIN=${ORIGIN} SNAP_IMAGE=true scripts/version.sh
134-
135-
.PHONY: build_local_snap
136-
build_local_snap:
137-
@echo "==> build local snap using local image tagged doctl-snap-base"
138-
@echo ""
139-
@BUILD=local_snap scripts/snap_image.sh
140-
141-
.PHONY: prerelease_snap_image
142-
prerelease_snap_image:
143-
@echo "==> tag doctl-snap-base as a prerelease and push to dockerhub as latest"
144-
@echo ""
145-
@BUILD=pre scripts/snap_image.sh
146-
147-
.PHONY: finalize_snap_image
148-
finalize_snap_image:
149-
@echo "==> tag latest with most recent doctl version push to dockerhub"
150-
@echo ""
151-
@ORIGIN=${ORIGIN} BUILD=finalize scripts/snap_image.sh
152-
153-
CHANNEL ?= stable
154-
155-
.PHONY: _build_snap
156-
_build_snap:
157-
@CHANNEL=${CHANNEL} scripts/_build_snap.sh
158125

159126
.PHONY: snap
160-
snap:
161-
@echo "==> publish snap (normally done by travis)"
127+
snap: clean
128+
@echo "==> building snap"
162129
@echo ""
163-
@CHANNEL=${CHANNEL} scripts/snap.sh
130+
@snapcraft
164131

165132
.PHONY: mocks
166133
mocks:
@@ -234,7 +201,6 @@ _tag_and_release: tag
234201
@echo "=> DEPRECATED: BUMP=${BUMP} tag and release"
235202
@echo ""
236203
@$(MAKE) _release
237-
@$(MAKE) snap
238204

239205
.PHONY: release
240206
release:

dockerfiles/Dockerfile.snap

-92
This file was deleted.

scripts/_build_snap.sh

-11
This file was deleted.

scripts/snap.sh

-23
This file was deleted.

scripts/snap_image.sh

-122
This file was deleted.

0 commit comments

Comments
 (0)