From 3dafc46749602f8223e8ec27ea385ea4db91426a Mon Sep 17 00:00:00 2001 From: Michael Nikitochkin Date: Mon, 4 Oct 2021 21:20:46 +0200 Subject: [PATCH] Keep linux binaries short 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 ``` --- .goreleaser.yml | 22 ++++++++++++++++++++++ CHANGELOG.md | 8 ++++++++ Makefile | 19 +++++++++++++++++-- 3 files changed, 47 insertions(+), 2 deletions(-) diff --git a/.goreleaser.yml b/.goreleaser.yml index 29f62902..f12fe71b 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -42,6 +42,18 @@ builds: main: ./cli binary: toxiproxy-cli-{{.Os}}-{{.Arch}} + + - <<: *build_default + id: pkg-server + no_unique_dist_dir: false + binary: toxiproxy-server + + - <<: *build_default + id: pkg-client + no_unique_dist_dir: false + main: ./cli + binary: toxiproxy-cli + checksum: name_template: checksums.txt @@ -56,6 +68,10 @@ nfpms: maintainer: Shopify Opensource description: TCP proxy to simulate network and system conditions. license: MIT + bindir: /usr/bin + builds: + - pkg-server + - pkg-client formats: - apk - deb @@ -132,6 +148,12 @@ archives: id: archive_binaries format: binary name_template: "{{ .Binary }}" + builds: + - server + - client - id: archive_default format: tar.gz + builds: + - pkg-server + - pkg-client diff --git a/CHANGELOG.md b/CHANGELOG.md index 05dd6565..e5a784b5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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. diff --git a/Makefile b/Makefile index e02f6b7e..f1e943f2 100644 --- a/Makefile +++ b/Makefile @@ -35,10 +35,25 @@ release: .PHONY: release-dry release-dry: + goreleaser release --rm-dist --skip-publish --skip-validate + +.PHONY: release-test +release-test: test bench e2e release-dry version="$(shell git describe --abbrev=0 --tags)" - goreleaser build --rm-dist --single-target --skip-validate + + 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)\"" + + tar -ztvf dist/toxiproxy_*_linux_amd64.tar.gz | grep toxiproxy-server + tar -ztvf dist/toxiproxy_*_linux_amd64.tar.gz | grep toxiproxy-cli + + 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: setup setup: