Skip to content

Commit

Permalink
Keep linux binaries short
Browse files Browse the repository at this point in the history
Closes #330

Linux packages installs binaries to `/usr/local/bin`
and has names:

```
toxiproxy-server-linux-amd64
toxiproxy-cli-linux-amd64
```

It is not common way and different from previous releases.

Changes the binary destination path to `/usr/bin` and has short binary
names:

```
toxiproxy-server
toxiproxy-cli
```
  • Loading branch information
miry committed Oct 4, 2021
1 parent a26226e commit 3040cd6
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 1 deletion.
33 changes: 33 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,29 @@ builds:
main: ./cli
binary: toxiproxy-cli-{{.Os}}-{{.Arch}}


- &build_pkg
id: pkg-server
binary: toxiproxy-server
main: ./cmd
env:
- CGO_ENABLED=0

goos:
- linux

goarch:
- amd64
- arm64

ldflags:
- -s -w -X github.com/Shopify/toxiproxy/v2.Version={{.Version}}

- <<: *build_pkg
id: pkg-client
main: ./cli
binary: toxiproxy-cli

checksum:
name_template: checksums.txt

Expand All @@ -56,6 +79,10 @@ nfpms:
maintainer: Shopify Opensource <opensource@shopify.com>
description: TCP proxy to simulate network and system conditions.
license: MIT
bindir: /usr/bin
builds:
- pkg-server
- pkg-client
formats:
- apk
- deb
Expand Down Expand Up @@ -132,6 +159,12 @@ archives:
id: archive_binaries
format: binary
name_template: "{{ .Binary }}"
builds:
- server
- client
-
id: archive_default
format: tar.gz
builds:
- server
- client
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# [Unreleased]

* Update linux packages to use `/usr/bin` folder as binary destination and change the executable names to
exclude ARCH and OS names. New pathes:
```
/usr/bin/toxiproxy-cli
/usr/bin/toxiproxy-server
```
(#331, @miry)

# [2.1.7]

* Set the valid version during the build process.
Expand Down
10 changes: 9 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,18 @@ release:
.PHONY: release-dry
release-dry:
version="$(shell git describe --abbrev=0 --tags)"
goreleaser build --rm-dist --single-target --skip-validate
goreleaser build --rm-dist --single-target --skip-validate --id server
./dist/toxiproxy-server-* --help 2>&1 | grep "Usage of ./dist/toxiproxy-server"
goreleaser build --rm-dist --single-target --skip-validate --id client
./dist/toxiproxy-cli-* --version | grep "toxiproxy-cli version $(version)"
goreleaser release --rm-dist --skip-publish --skip-validate

.PHONY: validate-pkgs
validate-pkgs: release-dry
docker run -v $(PWD)/dist:/dist --pull always --rm -it ubuntu bash -c "dpkg -i /dist/toxiproxy_*_linux_amd64.deb; ls -1 /usr/bin/toxiproxy-*; /usr/bin/toxiproxy-cli --version | grep \"toxiproxy-cli version $(version)\""
docker run -v $(PWD)/dist:/dist --pull always --rm -it centos bash -c "yum install -y /dist/toxiproxy_*_linux_amd64.rpm; ls -1 /usr/bin/toxiproxy-*; /usr/bin/toxiproxy-cli --version | grep \"toxiproxy-cli version $(version)\""
docker run -v $(PWD)/dist:/dist --pull always --rm -it alpine sh -c "apk add --allow-untrusted --no-cache /dist/toxiproxy_*_linux_amd64.apk; ls -1 /usr/bin/toxiproxy-*; /usr/bin/toxiproxy-cli --version | grep \"toxiproxy-cli version $(version)\""

.PHONY: setup
setup:
go mod download
Expand Down

0 comments on commit 3040cd6

Please sign in to comment.