Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: Remove ZeroMQ MessageBus capability #210

Merged
merged 2 commits into from
Jan 10, 2023
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
3 changes: 0 additions & 3 deletions Attribution.txt
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,6 @@ https://github.com/leodido/go-urn
edgexfoundry/go-mod-messaging (Apache 2.0) https://github.com/edgexfoundry/go-mod-messaging/v3
https://github.com/edgexfoundry/go-mod-messaging/blob/master/LICENSE

pebbe/zmq4 (BSD-2) https://github.com/pebbe/zmq4
https://github.com/pebbe/zmq4/blob/master/LICENSE.txt

golang.org/x/net (Unspecified) https://github.com/golang/net
https://github.com/golang/net/blob/master/LICENSE

Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ FROM ${BASE} AS builder
ARG ADD_BUILD_TAGS=""
ARG MAKE="make -e ADD_BUILD_TAGS=$ADD_BUILD_TAGS build"

ARG ALPINE_PKG_BASE="make git openssh-client gcc libc-dev zeromq-dev libsodium-dev"
ARG ALPINE_PKG_BASE="make git openssh-client"
ARG ALPINE_PKG_EXTRA=""

RUN apk add --update --no-cache ${ALPINE_PKG_BASE} ${ALPINE_PKG_EXTRA}
Expand All @@ -36,7 +36,7 @@ RUN ${MAKE}
FROM alpine:3.16

# dumb-init needed for injected secure bootstrapping entrypoint script when run in secure mode.
RUN apk add --update --no-cache zeromq dumb-init
RUN apk add --update --no-cache dumb-init

COPY --from=builder /device-snmp-go/cmd /
COPY --from=builder /device-snmp-go/Attribution.txt /
Expand Down
24 changes: 6 additions & 18 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
.PHONY: build test unittest lint clean prepare update docker

GO=CGO_ENABLED=0 GO111MODULE=on go
GOCGO=CGO_ENABLED=1 GO111MODULE=on go

# see https://shibumi.dev/posts/hardening-executables
CGO_CPPFLAGS="-D_FORTIFY_SOURCE=2"
CGO_CFLAGS="-O2 -pipe -fno-plt"
CGO_CXXFLAGS="-O2 -pipe -fno-plt"
CGO_LDFLAGS="-Wl,-O1,–sort-common,–as-needed,-z,relro,-z,now"

MICROSERVICES=cmd/device-snmp

.PHONY: $(MICROSERVICES)
Expand All @@ -27,10 +18,7 @@ VERSION=$(shell cat ./VERSION 2>/dev/null || echo 0.0.0)

GIT_SHA=$(shell git rev-parse HEAD)

CGOFLAGS=-ldflags "-linkmode=external \
-X github.com/edgexfoundry/device-sdk-go/v3/internal/common.SDKVersion=$(SDKVERSION) \
-X github.com/edgexfoundry/device-snmp-go.Version=$(VERSION)" \
-trimpath -mod=readonly -buildmode=pie
GOFLAGS=-ldflags "-X github.com/edgexfoundry/device-snmp-go.Version=$(VERSION)" -trimpath -mod=readonly

build: $(MICROSERVICES)

Expand All @@ -41,17 +29,17 @@ tidy:
go mod tidy

cmd/device-snmp:
$(GOCGO) build -tags "$(ADD_BUILD_TAGS)" $(CGOFLAGS) -o $@ ./cmd
CGO_ENABLED=0 go build -tags "$(ADD_BUILD_TAGS)" $(GOFLAGS) -o $@ ./cmd

unittest:
$(GOCGO) test ./... -coverprofile=coverage.out
go test ./... -coverprofile=coverage.out

lint:
@which golangci-lint >/dev/null || echo "WARNING: go linter not installed. To install, run\n curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b \$$(go env GOPATH)/bin v1.46.2"
@if [ "z${ARCH}" = "zx86_64" ] && which golangci-lint >/dev/null ; then golangci-lint run --config .golangci.yml ; else echo "WARNING: Linting skipped (not on x86_64 or linter not installed)"; fi

test: unittest lint
$(GOCGO) vet ./...
go vet ./...
gofmt -l $$(find . -type f -name '*.go'| grep -v "/vendor/")
[ "`gofmt -l $$(find . -type f -name '*.go'| grep -v "/vendor/")`" = "" ]
./bin/test-attribution-txt.sh
Expand All @@ -60,7 +48,7 @@ clean:
rm -f $(MICROSERVICES)

update:
$(GO) mod download
go mod download

run:
cd bin && ./edgex-launch.sh
Expand All @@ -79,4 +67,4 @@ docker-nats:
make -e ADD_BUILD_TAGS=include_nats_messaging docker

vendor:
$(GO) mod vendor
CGO_ENABLED=0 go mod vendor
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/edgexfoundry/device-snmp-go
go 1.18

require (
github.com/edgexfoundry/device-sdk-go/v3 v3.0.0-dev.5
github.com/edgexfoundry/device-sdk-go/v3 v3.0.0-dev.6
github.com/edgexfoundry/go-mod-core-contracts/v3 v3.0.0-dev.2
github.com/soniah/gosnmp v1.21.0
)
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/eclipse/paho.mqtt.golang v1.4.2 h1:66wOzfUHSSI1zamx7jR6yMEI5EuHnT1G6rNA5PM12m4=
github.com/eclipse/paho.mqtt.golang v1.4.2/go.mod h1:JGt0RsEwEX+Xa/agj90YJ9d9DH2b7upDZMK9HRbFvCA=
github.com/edgexfoundry/device-sdk-go/v3 v3.0.0-dev.5 h1:8jvPXdI06yGOH3qw3BgN/xutHVoAgUU+Q946rc89C9w=
github.com/edgexfoundry/device-sdk-go/v3 v3.0.0-dev.5/go.mod h1:9tfeovR5aXyNb4/kB6ymWvwFUYABvjt9vy3UPyEN6qg=
github.com/edgexfoundry/device-sdk-go/v3 v3.0.0-dev.6 h1:4hvEOdtLUjWBqvc9ZpdYLqLhrXzZRwW86RsgWJBmSkQ=
github.com/edgexfoundry/device-sdk-go/v3 v3.0.0-dev.6/go.mod h1:9tfeovR5aXyNb4/kB6ymWvwFUYABvjt9vy3UPyEN6qg=
github.com/edgexfoundry/go-mod-bootstrap/v3 v3.0.0-dev.5 h1:3WMWQ0oi++KFrau/e8BOTqgzORCa3G7bLG0w/wO72Io=
github.com/edgexfoundry/go-mod-bootstrap/v3 v3.0.0-dev.5/go.mod h1:cGXMUtbbzw+npJpMcFHPlXIN+ZPF71aiimhJ6v8kaSc=
github.com/edgexfoundry/go-mod-configuration/v3 v3.0.0-dev.2 h1:xp5MsP+qf/fuJxy8fT7k1N+c4j4C6w04qMCBXm6id7o=
Expand Down
3 changes: 1 addition & 2 deletions snap/snapcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,7 @@ parts:
after: [metadata]
source: .
plugin: make
build-packages: [git, libzmq3-dev, zip, pkg-config]
stage-packages: [libzmq5]
build-packages: [git, zip, pkg-config]
build-snaps:
- go/1.18/stable
override-build: |
Expand Down