Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 87 additions & 0 deletions MAINTAINERS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
**This guide is intended for scaleway-cli maintainers. If you are not a
maintainer, you probably want to check out the [documentation](README.md)
instead.**

## Package release HOWTO

Ready to deploy a new version to users? Let's make a checklist of what you need
to do.

For the sake of the example, we assume you want to release the version `42.8`.

### Commit release

* Edit the Changelog in [README.md](README.md), ensure it is up to date and
fill the current date. Also update the link in the line "View full commits
list": replace *master* with *v42.8*.
* Edit [pkg/scwversion/version.go](pkg/scwversion/version.go) and update the
*VERSION* to *v42.8*.
* Make the commit release: `git commit -m 'Release v42.8'`.
* Tag the commit: `git tag v42.8`.
* Push: `git push && git push --tags`.

### Make a github release

* [Draft a new release](https://github.com/scaleway/scaleway-cli/releases) on
Github.
* Build release files: `make prepare-release`.
* Upload the generated files in *dist/42.8/* to github.
* Publish the release.

### Docker image

The image *scaleway/cli* has been created by `make prepare-release` called
during the previous step.

* Push the local Docker image to the Docker hub: `docker push scaleway/cli`.

### Homebrew (OSX) package

* Get the released archive's sha256sum: `curl -sL
https://github.com/scaleway/scaleway-cli/archive/v42.8.tar.gz | shasum -a
256`.
* Clone the homebrew Github repository: `git clone
git@github.com:Homebrew/brew.git` to you personal account.
* Edit *Formula/scw.rb* and fix the *url* and the *sha256* on top of the file.
* Make a pull request from your repository to
[homebrew](https://github.com/Homebrew/homebrew-core) to make your new
version official.

### Archlinux package

**This section is incomplete. Edit this part if you have additional
informations.**

There is a Archlinux community package (aka. "AUR" — Archlinux User Repository)
for scaleway-cli: https://aur.archlinux.org/packages/scaleway-cli/ maintained
by "moscar". We should probably ping him when we make a new release.

### Update VERSION file

From time to time, scaleway-cli makes a HTTP query to
https://fr-1.storage.online.net/scaleway/scaleway-cli/VERSION to check if it is
at the latest version available. This file needs to be updated.

```
$> echo '42.8' > VERSION
$> s3cmd put VERSION s3://scaleway/scaleway-cli/VERSION --acl-public
# Ensure it's at the latest version
$> curl https://fr-1.storage.online.net/scaleway/scaleway-cli/VERSION
# Should display "42.8".
```

### Post release commit

* Edit [README.md](README.md) and create a new *(unreleased)* entry:

```
### v42.8+dev (unreleased)

This is the current development version. Update below with your changes. Remove
this line when releasing the package.

View full [commits list](https://github.com/scaleway/scaleway-cli/compare/v42.8...master)
```

* Edit [pkg/scwversion/version.go](pkg/scwversion/version.go) and set *VERSION*
to *v42.8+dev*.
93 changes: 42 additions & 51 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,19 @@ GOTEST ?= $(GO) test $(GOTESTFLAGS)
GOFMT ?= gofmt -w -s
GODIR ?= github.com/scaleway/scaleway-cli
GOCOVER ?= $(GOTEST) -covermode=count -v
FPM_VERSION ?= $(shell ./dist/scw-Darwin-i386 --version | sed 's/.*v\([0-9.]*\),.*/\1/g')
FPM_DOCKER ?= \

# FPM is a simple way to create debian/rpm/... packages.
FPM_DOCKER = \
-it --rm \
-v $(PWD)/dist:/output \
-v $(PWD)/dist/latest:/output \
-w /output \
tenzer/fpm fpm
FPM_ARGS ?= \
tenzer/fpm

FPM_ARGS = \
-C /input/ \
-s dir \
--name=scw \
--no-depends \
--version=$(FPM_VERSION) \
--license=mit \
-m "Scaleway <opensource@scaleway.com>"

Expand All @@ -32,9 +33,7 @@ COMMANDS := $(shell go list ./... | grep -v /vendor/ | grep /cmd/)
PACKAGES := $(shell go list ./... | grep -v /vendor/ | grep -v /cmd/)
REL_COMMANDS := $(subst $(GODIR),.,$(COMMANDS))
REL_PACKAGES := $(subst $(GODIR),.,$(PACKAGES))
VERSION = $(shell cat .goxc.json | grep "PackageVersion" | egrep -o "([0-9]{1,}\.)+[0-9]{1,}")
REV = $(shell git rev-parse --short HEAD || echo "nogit")
TAG = $(shell git describe --tags --always || echo $(VERSION) || echo "nogit")
LDFLAGS = "-X `go list ./pkg/scwversion`.GITCOMMIT=$(REV) -s"
BUILDER = scaleway-cli-builder

Expand Down Expand Up @@ -65,71 +64,63 @@ test: $(TEST_LIST)
fmt: $(FMT_LIST)


.git:
touch $@


$(BUILD_LIST): %_build: %_fmt
@go tool vet --all=true $(SOURCES)
$(GOBUILD) -ldflags $(LDFLAGS) -o $(NAME) $(subst $(GODIR),.,$*)

$(CLEAN_LIST): %_clean:
$(GOCLEAN) $(subst $(GODIR),./,$*)

$(INSTALL_LIST): %_install:
$(GOINSTALL) $(subst $(GODIR),./,$*)

$(TEST_LIST): %_test:
$(GOTEST) -ldflags $(LDFLAGS) -v $(subst $(GODIR),.,$*)

$(FMT_LIST): %_fmt:
@$(GOFMT) $(SOURCES)

prepare-release: build
### Prepare dist/ directory ###
$(eval VERSION := $(shell ./scw version | sed -n 's/Client version: v\(.*\)/\1/p'))
rm -rf dist/$(VERSION)
rm -rf dist/latest
mkdir -p dist/$(VERSION)
ln -s -f $(VERSION) dist/latest

### Cross compile scaleway-cli ###
GOOS=linux GOARCH=386 go build -o dist/latest/scw-linux-i386 github.com/scaleway/scaleway-cli/cmd/scw
GOOS=linux GOARCH=amd64 go build -o dist/latest/scw-linux-amd64 github.com/scaleway/scaleway-cli/cmd/scw
GOOS=linux GOARCH=arm go build -o dist/latest/scw-linux-arm github.com/scaleway/scaleway-cli/cmd/scw

release-docker:
docker push scaleway/cli


goxc:
rm -rf dist/$(shell cat .goxc.json| jq -r .PackageVersion)
rm -f dist/latest
mkdir -p dist/$(shell cat .goxc.json| jq -r .PackageVersion)
ln -s -f $(shell cat .goxc.json| jq -r .PackageVersion) dist/latest

$(GOENV) goxc -build-ldflags $(LDFLAGS)
GOOS=darwin GOARCH=386 go build -o dist/latest/scw-darwin-i386 github.com/scaleway/scaleway-cli/cmd/scw
GOOS=darwin GOARCH=amd64 go build -o dist/latest/scw-darwin-amd64 github.com/scaleway/scaleway-cli/cmd/scw

-mv dist/latest/darwin_386/scw dist/latest/scw-Darwin-i386
-mv dist/latest/darwin_amd64/scw dist/latest/scw-Darwin-amd64
-mv dist/latest/freebsd_386/scw dist/latest/scw-Freebsd-i386
-mv dist/latest/freebsd_amd64/scw dist/latest/scw-Freebsd-x86_64
-mv dist/latest/freebsd_arm/scw dist/latest/scw-Freebsd-arm
-mv dist/latest/linux_386/scw dist/latest/scw-Linux-i386
-mv dist/latest/linux_amd64/scw dist/latest/scw-Linux-x86_64
-mv dist/latest/linux_arm/scw dist/latest/scw-Linux-arm
-mv dist/latest/netbsd_386/scw dist/latest/scw-Netbsd-i386
-mv dist/latest/netbsd_amd64/scw dist/latest/scw-Netbsd-x86_64
-mv dist/latest/netbsd_arm/scw dist/latest/scw-Netbsd-arm
-mv dist/latest/windows_386/scw.exe dist/latest/scw-Windows-i386.exe
-mv dist/latest/windows_amd64/scw.exe dist/latest/scw-Windows-x86_64.exe
GOOS=freebsd GOARCH=386 go build -o dist/latest/scw-freebsd-i386 github.com/scaleway/scaleway-cli/cmd/scw
GOOS=freebsd GOARCH=amd64 go build -o dist/latest/scw-freebsd-amd64 github.com/scaleway/scaleway-cli/cmd/scw
GOOS=freebsd GOARCH=arm go build -o dist/latest/scw-freebsd-arm github.com/scaleway/scaleway-cli/cmd/scw

-cp dist/latest/scw-Linux-arm dist/latest/scw-Linux-armv7l
GOOS=netbsd GOARCH=386 go build -o dist/latest/scw-netbsd-i386 github.com/scaleway/scaleway-cli/cmd/scw
GOOS=netbsd GOARCH=amd64 go build -o dist/latest/scw-netbsd-amd64 github.com/scaleway/scaleway-cli/cmd/scw
GOOS=netbsd GOARCH=arm go build -o dist/latest/scw-netbsd-arm github.com/scaleway/scaleway-cli/cmd/scw

@rmdir dist/latest/* || true
GOOS=windows GOARCH=386 go build -o dist/latest/scw-windows-i386.exe github.com/scaleway/scaleway-cli/cmd/scw
GOOS=windows GOARCH=amd64 go build -o dist/latest/scw-windows-amd64.exe github.com/scaleway/scaleway-cli/cmd/scw

docker run --rm golang tar -cf - /etc/ssl > dist/latest/ssl.tar
### Prepare scaleway-cli Docker image ###
docker run --rm golang tar -cf - /etc/ssl > dist/ssl.tar
docker build -t scaleway/cli dist
docker run scaleway/cli version
docker tag -f scaleway/cli:latest scaleway/cli:$(TAG)

@echo "Now you can run 'goxc publish-github', 'goxc bintray' and 'make release-docker'"


packages:
rm -f dist/*.deb
docker run -v $(PWD)/dist/scw-Linux-x86_64:/input/scw $(FPM_DOCKER) $(FPM_ARGS) -t deb -a x86_64 ./
docker run -v $(PWD)/dist/scw-Linux-i386:/input/scw $(FPM_DOCKER) $(FPM_ARGS) -t deb -a i386 ./
docker run -v $(PWD)/dist/scw-Linux-arm:/input/scw $(FPM_DOCKER) $(FPM_ARGS) -t deb -a arm ./
docker tag scaleway/cli:latest scaleway/cli:$(TAG)

### Build debian packages ###
docker run -v $(PWD)/dist/latest/scw-linux-amd64:/input/usr/bin/scw $(FPM_DOCKER) $(FPM_ARGS) --version $(VERSION) -t deb -a x86_64 ./
docker run -v $(PWD)/dist/latest/scw-linux-i386:/input/usr/bin/scw $(FPM_DOCKER) $(FPM_ARGS) --version $(VERSION) -t deb -a i386 ./
docker run -v $(PWD)/dist/latest/scw-linux-arm:/input/usr/bin/scw $(FPM_DOCKER) $(FPM_ARGS) --version $(VERSION) -t deb -a arm ./

#publish_packages:
# docker run -v $(PWD)/dist moul/dput ppa:moul/scw dist/scw_$(FPM_VERSION)_arm.changes
### DONE ###
@echo "Release files have been created into dist/latest. See MAINTAINERS.md."
@echo "The scaleway-cli Docker image has been created. See MAINTAINERS.md."


.PHONY: golint
Expand Down
37 changes: 0 additions & 37 deletions contrib/homebrew/scw.rb

This file was deleted.

10 changes: 7 additions & 3 deletions dist/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
FROM scratch
MAINTAINER Scaleway <opensource@scaleway.com> (@scaleway)
ADD latest/ssl.tar /
COPY latest/scw-Linux-i386 /bin/scw
VOLUME /root/

# ssl.tar is created by `make prepare-release`. It is an extract of the
# /etc/ssl directory of a golang image.
ADD ssl.tar /

COPY latest/scw-linux-i386 /bin/scw

ENTRYPOINT ["/bin/scw"]