fix homebrew and arm docker builds

This commit is contained in:
davidnewhall2 2020-06-13 21:33:01 -07:00
parent 26cfb171f7
commit 98019d0801
7 changed files with 32 additions and 18 deletions

View File

@ -17,7 +17,10 @@ LICENSE="MIT"
# This affects the homebrew formula (launchd) and linux packages (systemd).
FORMULA="service"
export BINARY HBREPO MAINT VENDOR DESC GOLANGCI_LINT_ARGS CONFIG_FILE LICENSE FORMULA
# Defines docker manifest/build types.
BUILDS="linux:armhf:arm linux:arm64:arm64 linux:amd64:amd64 linux:i386:386"
export BINARY HBREPO MAINT VENDOR DESC GOLANGCI_LINT_ARGS CONFIG_FILE LICENSE FORMULA BUILDS
# The rest is mostly automatic.
# Fix the repo if it doesn't match the binary name.

View File

@ -80,18 +80,15 @@ clean:
# This also turns the repo readme into an html file.
# md2roff is needed to build the man file and html pages from the READMEs.
man: $(BINARY).1.gz
$(BINARY).1.gz: md2roff
$(BINARY).1.gz:
# Building man page. Build dependency first: md2roff
go run $(MD2ROFF_BIN) --manual $(BINARY) --version $(VERSION) --date "$(DATE)" examples/MANUAL.md
gzip -9nc examples/MANUAL > $@
mv examples/MANUAL.html $(BINARY)_manual.html
md2roff:
go get $(MD2ROFF_BIN)
# TODO: provide a template that adds the date to the built html file.
readme: README.html
README.html: md2roff
README.html:
# This turns README.md into README.html
go run $(MD2ROFF_BIN) --manual $(BINARY) --version $(VERSION) --date "$(DATE)" README.md
@ -359,7 +356,6 @@ install: man readme $(BINARY) plugins_darwin
# Copying the binary, config file, unit file, and man page into the env.
/usr/bin/install -m 0755 -d $(PREFIX)/bin $(PREFIX)/share/man/man1 $(ETC)/$(BINARY) $(PREFIX)/share/doc/$(BINARY) $(PREFIX)/lib/$(BINARY)
/usr/bin/install -m 0755 -cp $(BINARY) $(PREFIX)/bin/$(BINARY)
/usr/bin/install -m 0755 -cp *darwin.so $(PREFIX)/lib/$(BINARY)/
/usr/bin/install -m 0644 -cp $(BINARY).1.gz $(PREFIX)/share/man/man1
/usr/bin/install -m 0644 -cp examples/$(CONFIG_FILE).example $(ETC)/$(BINARY)/
[ -f $(ETC)/$(BINARY)/$(CONFIG_FILE) ] || /usr/bin/install -m 0644 -cp examples/$(CONFIG_FILE).example $(ETC)/$(BINARY)/$(CONFIG_FILE)

8
go.mod
View File

@ -9,9 +9,9 @@ require (
github.com/mattn/go-isatty v0.0.11 // indirect
github.com/russross/blackfriday v2.0.0+incompatible // indirect
github.com/shurcooL/sanitized_anchor_name v1.0.0 // indirect
github.com/unifi-poller/influxunifi v0.0.9-0.20200614012101-da8e25b3e1c0
github.com/unifi-poller/inputunifi v0.0.7-0.20200614011400-ccef115c2def
github.com/unifi-poller/influxunifi v0.0.9-0.20200614034715-291e3c246d65
github.com/unifi-poller/inputunifi v0.0.7-0.20200614024217-51cd08a0421e
github.com/unifi-poller/poller v0.0.6
github.com/unifi-poller/promunifi v0.0.7-0.20200614032856-bb7f58485c41
github.com/unifi-poller/unifi v0.0.5-0.20200614031431-bd4934fc585b
github.com/unifi-poller/promunifi v0.0.7-0.20200614034834-a8547d57cfdc
github.com/unifi-poller/unifi v0.0.5
)

14
go.sum
View File

@ -17,6 +17,7 @@ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
github.com/github/hub v2.11.2+incompatible h1:H0wUQmNZVxF2+XyGPTsOxUVrRrFnTq133tezo6u4X4U=
github.com/github/hub v2.11.2+incompatible/go.mod h1:zQrzJEdze2hfWJDgktd/L6sROjAdCThFrzjbxw4keTs=
github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
@ -57,8 +58,10 @@ github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFB
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/mattn/go-colorable v0.1.4 h1:snbPLB8fVfU9iwbbo30TPtbLRzwWu6aJS6Xh4eaaviA=
github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=
github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
github.com/mattn/go-isatty v0.0.11 h1:FxPOTFNqGkuDUGi3H/qkUbQO4ZiBa2brKq5r0l8TGeM=
github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOAqxQCu2WE=
github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU=
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
@ -98,7 +101,9 @@ github.com/prometheus/procfs v0.0.10/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+G
github.com/prometheus/procfs v0.0.11/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU=
github.com/prometheus/procfs v0.1.1 h1:/ZKcW+ixpq2dOl4yeH4qvACNXnkiDCp5e/F5Tq07X7o=
github.com/prometheus/procfs v0.1.1/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU=
github.com/russross/blackfriday v2.0.0+incompatible h1:cBXrhZNUf9C+La9/YpS+UHpUT8YD6Td9ZMSU9APFcsk=
github.com/russross/blackfriday v2.0.0+incompatible/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g=
github.com/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5IYyJwS/kOiWx8mHo=
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
@ -119,6 +124,8 @@ github.com/unifi-poller/influxunifi v0.0.9-0.20200312080614-979ea0c9c1a0 h1:QV/w
github.com/unifi-poller/influxunifi v0.0.9-0.20200312080614-979ea0c9c1a0/go.mod h1:NbADEvfTpRfn4ycV5bh82QAEf3An7JNd/uYU8JJw4A0=
github.com/unifi-poller/influxunifi v0.0.9-0.20200614012101-da8e25b3e1c0 h1:zh0wSXyJCBV8grVTl96GvsfZMT1atstbRjLVCXgeEnI=
github.com/unifi-poller/influxunifi v0.0.9-0.20200614012101-da8e25b3e1c0/go.mod h1:ApW/E6XsiqbwDxQ1dKgDTb/7FqDI6ppYK5EMv+ziT/Y=
github.com/unifi-poller/influxunifi v0.0.9-0.20200614034715-291e3c246d65 h1:oqzjPC+4p1D0JcuSd8T8Lpyhjm72uSPEVOiQvoTvhac=
github.com/unifi-poller/influxunifi v0.0.9-0.20200614034715-291e3c246d65/go.mod h1:uFA5OXAMxxcDlIFd/LCyaA7iv1DAJR+bmPRH1IQVzco=
github.com/unifi-poller/inputunifi v0.0.5 h1:go+5j7WS1y0N/2pKKPvjzn8bkPpFXurQnoYGYajJD04=
github.com/unifi-poller/inputunifi v0.0.5/go.mod h1:X1Vd5uAtO5etZveY0WpMVMQBM/iLoMwZ/SvN1iXLxHo=
github.com/unifi-poller/inputunifi v0.0.6-0.20200203055955-411a49dea2e7 h1:CXMB+6tTJJZEoyMmH24PN/7evm3yuvily9Df4sujeT0=
@ -141,6 +148,8 @@ github.com/unifi-poller/inputunifi v0.0.6 h1:3x44qhCl3TXZ0KACQczgsxhI+oHBrcUih8Z
github.com/unifi-poller/inputunifi v0.0.6/go.mod h1:5JagfAoHnDmVYkU0Euq+8LSdansuxAf3lnCfRp43NSw=
github.com/unifi-poller/inputunifi v0.0.7-0.20200614011400-ccef115c2def h1:rInzMad38j7jVqyP4pd2u5cfCpTG5s6Ucm0GCwmPQkc=
github.com/unifi-poller/inputunifi v0.0.7-0.20200614011400-ccef115c2def/go.mod h1:ctlM3l9voxrRif2Y8obpkBr4LNSseJwZYsMSOysAHSs=
github.com/unifi-poller/inputunifi v0.0.7-0.20200614024217-51cd08a0421e h1:cF6YNgJS9bBZiaROF+UzH6ehsPH2T7w3mfDgUasv3bU=
github.com/unifi-poller/inputunifi v0.0.7-0.20200614024217-51cd08a0421e/go.mod h1:ctlM3l9voxrRif2Y8obpkBr4LNSseJwZYsMSOysAHSs=
github.com/unifi-poller/poller v0.0.3/go.mod h1:ugy3FyZEH1rFyC3panBiJpXbLf7EZ4GkjiOtydB2CwQ=
github.com/unifi-poller/poller v0.0.4 h1:TYCdQeCYwUmmFcj1H75iGKAFbAOBFwo/XIJDX2Id+cY=
github.com/unifi-poller/poller v0.0.4/go.mod h1:LbOCEdNth7invhaOTpcadW/sDlD2WsU+IE3GRXKzOCg=
@ -160,6 +169,8 @@ github.com/unifi-poller/promunifi v0.0.7-0.20200614002236-2fc578d330d8 h1:Kh76SX
github.com/unifi-poller/promunifi v0.0.7-0.20200614002236-2fc578d330d8/go.mod h1:JuKXj+feqbgEmFX1gJavuRjLcBJ35H7OTv+J20JVw0E=
github.com/unifi-poller/promunifi v0.0.7-0.20200614032856-bb7f58485c41 h1:cdqSEwbhjtjUkqTQOsXf6owpIyqm9uHzAejyjEf08dI=
github.com/unifi-poller/promunifi v0.0.7-0.20200614032856-bb7f58485c41/go.mod h1:eMjnSpCSuNvHnm4ofAgwRX/tZauGDjHPHdgflH/JATU=
github.com/unifi-poller/promunifi v0.0.7-0.20200614034834-a8547d57cfdc h1:XoSJxz3eGxH8vTKbawecdN42EMem57ydqh9F6XXuZec=
github.com/unifi-poller/promunifi v0.0.7-0.20200614034834-a8547d57cfdc/go.mod h1:gi19r6SSGIOpuYn6aKLOrlScegP/HUIaXY/1tBC7Xdw=
github.com/unifi-poller/unifi v0.0.2/go.mod h1:DagVD/I+VMnVUHmTT4Fi76lPI+DHbuMwwtMIzanwMxM=
github.com/unifi-poller/unifi v0.0.3 h1:6pmjW7MuEEDKKvYoxjL3EZlaLOgmhYyxJBAg4X7GliI=
github.com/unifi-poller/unifi v0.0.3/go.mod h1:DagVD/I+VMnVUHmTT4Fi76lPI+DHbuMwwtMIzanwMxM=
@ -174,6 +185,9 @@ github.com/unifi-poller/unifi v0.0.4 h1:NDTxHTdF0MAt1y1RU8J+MSqdYlO0CEIqlrktcj3y
github.com/unifi-poller/unifi v0.0.4/go.mod h1:bTUtctrf56aapjKH+L+98eThBaVFbQXw5iNGZI0g/+E=
github.com/unifi-poller/unifi v0.0.5-0.20200614031431-bd4934fc585b h1:g3nleMBVzn/0PVwzoNYCwioFgYjzOxMByAO66a/tTf0=
github.com/unifi-poller/unifi v0.0.5-0.20200614031431-bd4934fc585b/go.mod h1:L1kMRH2buZhB31vZnRC1im7Tk/4uD3ET4biwl2faYy8=
github.com/unifi-poller/unifi v0.0.5-0.20200614034623-f4c1d18157c2/go.mod h1:L1kMRH2buZhB31vZnRC1im7Tk/4uD3ET4biwl2faYy8=
github.com/unifi-poller/unifi v0.0.5 h1:Izeun32YxcQOeKZUXY0Sy4ltKYFuYxWGcN9JS6xkIJU=
github.com/unifi-poller/unifi v0.0.5/go.mod h1:L1kMRH2buZhB31vZnRC1im7Tk/4uD3ET4biwl2faYy8=
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=

View File

@ -12,10 +12,10 @@ follow the example provided here. All of the hooks are generic, and will work wi
any build. Two environment variables must be passed in from Docker Cloud config.
1. `BUILDS` must be set to the builds you're trying to perform. This repo is currently set to:
- `linux:armhf:arm: linux:arm64:arm64:armv8 linux:amd64:amd64: linux:i386:386:`
- The format is `os:name:arch:variant`.
- `linux:armhf:arm linux:arm64:arm64 linux:amd64:amd64 linux:i386:386`
- The format is `os:name:arch`.
- `os` and `name` are passed into the Dockerfile.
- `os`, `arch` and `variant` are passed into `docker manifest annotate`.
- `os`, `arch` are passed into `docker manifest annotate`.
- This does not yet work with an OS other than `linux`.
1. Set `DOCKER_CLI_EXPERIMENTAL` to `enabled`. Not optional.

View File

@ -13,7 +13,7 @@ source .metadata.sh
# Build each configured image from Docker Cloud.
for build in $BUILDS; do
# os:name:arch:variant
# os:name:arch
os=$(echo $build | cut -d: -f1)
name=$(echo $build | cut -d: -f2)
echo "Building Image ${IMAGE_NAME}_${os}_${name}"

View File

@ -10,10 +10,12 @@ pushd ../..
source .metadata.sh
popd
if [ "$BUILDS" != "" ]; then
if [ "$TAGS" == "" ]; then
TAGS=$DOCKER_TAG
fi
export DOCKER_CLI_EXPERIMENTAL=enabled
# Push the extra custom images that were created.
for build in $BUILDS; do
os=$(echo $build | cut -d: -f1)
@ -45,9 +47,8 @@ for tag in $TAGS; do
os=$(echo $build | cut -d: -f1)
name=$(echo $build | cut -d: -f2)
arch=$(echo $build | cut -d: -f3)
vari=$(echo $build | cut -d: -f4)
# Annotating updates the manifest to describe each images' capabilities.
docker manifest annotate ${DOCKER_REPO}:${tag} ${IMAGE_NAME}_${os}_${name} --os ${os} --arch ${arch} --variant "${vari}"
docker manifest annotate ${DOCKER_REPO}:${tag} ${IMAGE_NAME}_${os}_${name} --os ${os} --arch ${arch}
done
echo "Pushing Manifest ${DOCKER_REPO}:${tag}"
docker manifest push ${DOCKER_REPO}:${tag}