Skip to content

Commit

Permalink
Clean up build scripts, make targets, and Dockerfile for snap. (#1570)
Browse files Browse the repository at this point in the history
* Clean up build scripts, make targets, and Dockerfile for snap.

* Update CONTRIBUTING.md
  • Loading branch information
andrewsomething authored Aug 14, 2024
1 parent 7fd3b7b commit 9282784
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 301 deletions.
36 changes: 20 additions & 16 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,7 @@
- [Build Scripts](#build-scripts)
- [Releasing](#releasing)
- [Tagging a release](#tagging-a-release)
- [Prerequisites](#prerequisites)
- [If a release fails](#if-a-release-fails)
- [Github Releases & Dockerhub](#github-releases--dockerhub)
- [Prerequisites](#prerequisites-1)
- [Snap](#snap)
- [Prerequisites](#prerequisites-2)
- [Building a new snap base image](#building-a-new-snap-base-image)
- [Snap](#snap)
- [Updating Homebrew](#updating-homebrew)

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

### Tagging a release

##### Prerequisites

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

The new tag triggers the release.

##### Building a new snap base image
### Snap

Snap packages are automatically built and uploaded as part of the GitHub Actions
release workflow.

To build a snap package locally for testing, first install `snapcraft`.

On Ubuntu, run:

sudo snap install snapcraft --classic

Or on MacOS, run:

brew install snapcraft

Finally, build the package by running:

make snap

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

### Updating Homebrew

Expand Down
40 changes: 3 additions & 37 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -122,45 +122,12 @@ gofmt_check:
check_focused:
@scripts/check_focused_test.sh

.PHONY: snap_image
snap_image:
@echo "==> build docker image for releasing snap"
@echo ""
@scripts/snap_image.sh

.PHONY: _snap_image_version
_snap_image_version:
@ORIGIN=${ORIGIN} SNAP_IMAGE=true scripts/version.sh

.PHONY: build_local_snap
build_local_snap:
@echo "==> build local snap using local image tagged doctl-snap-base"
@echo ""
@BUILD=local_snap scripts/snap_image.sh

.PHONY: prerelease_snap_image
prerelease_snap_image:
@echo "==> tag doctl-snap-base as a prerelease and push to dockerhub as latest"
@echo ""
@BUILD=pre scripts/snap_image.sh

.PHONY: finalize_snap_image
finalize_snap_image:
@echo "==> tag latest with most recent doctl version push to dockerhub"
@echo ""
@ORIGIN=${ORIGIN} BUILD=finalize scripts/snap_image.sh

CHANNEL ?= stable

.PHONY: _build_snap
_build_snap:
@CHANNEL=${CHANNEL} scripts/_build_snap.sh

.PHONY: snap
snap:
@echo "==> publish snap (normally done by travis)"
snap: clean
@echo "==> building snap"
@echo ""
@CHANNEL=${CHANNEL} scripts/snap.sh
@snapcraft

.PHONY: mocks
mocks:
Expand Down Expand Up @@ -234,7 +201,6 @@ _tag_and_release: tag
@echo "=> DEPRECATED: BUMP=${BUMP} tag and release"
@echo ""
@$(MAKE) _release
@$(MAKE) snap

.PHONY: release
release:
Expand Down
92 changes: 0 additions & 92 deletions dockerfiles/Dockerfile.snap

This file was deleted.

11 changes: 0 additions & 11 deletions scripts/_build_snap.sh

This file was deleted.

23 changes: 0 additions & 23 deletions scripts/snap.sh

This file was deleted.

122 changes: 0 additions & 122 deletions scripts/snap_image.sh

This file was deleted.

0 comments on commit 9282784

Please sign in to comment.