Skip to content
This repository has been archived by the owner on Jan 22, 2025. It is now read-only.

feat(ms-inventory): Migrate ms-inventory to EdgeX v3.0 #130

Merged
Merged
Show file tree
Hide file tree
Changes from 4 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
2 changes: 1 addition & 1 deletion .github/workflows/trivyimagescan.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ jobs:
- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@7b7aa264d83dc58691451798b4d117d53d21edfe
with:
image-ref: 'automated-checkout/ms-inventory:dev'
image-ref: 'automated-vending/ms-inventory:dev'
format: 'template'
template: '@/contrib/sarif.tpl'
output: 'trivy-results-ms-inventory.sarif'
Expand Down
9 changes: 4 additions & 5 deletions docker-compose.ac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,15 @@ services:
options: { max-file: "5", max-size: 100m }
user: 2002:2001
ms-inventory:
image: "automated-checkout/ms-inventory:dev"
container_name: automated-checkout_ms-inventory
image: "automated-vending/ms-inventory:dev"
container_name: automated-vending_ms-inventory
depends_on:
data:
core-data:
condition: service_started
command:
core-command:
condition: service_started
environment:
EDGEX_SECURITY_SECRET_STORE: "false"
REGISTRY_HOST: edgex-core-consul
SERVICE_HOST: ms-inventory
hostname: ms-inventory
networks:
Expand Down
16 changes: 8 additions & 8 deletions ms-inventory/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
# Copyright © 2022 Intel Corporation. All rights reserved.
# Copyright © 2023 Intel Corporation. All rights reserved.
# SPDX-License-Identifier: BSD-3-Clause

FROM golang:1.18-alpine3.16 AS builder
FROM golang:1.20-alpine3.17 AS builder

LABEL license='SPDX-License-Identifier: BSD-3-Clause' \
copyright='Copyright (c) 2022: Intel'
copyright='Copyright (c) 2023: Intel'


# add git for go modules
RUN apk update && apk add --no-cache make git gcc libc-dev zeromq-dev linux-headers
# hadolint ignore=DL3018
RUN apk update && apk add --no-cache make git linux-headers
seanohair22 marked this conversation as resolved.
Show resolved Hide resolved

ENV GO111MODULE=on
WORKDIR /usr/local/bin/
Expand All @@ -28,13 +29,12 @@ COPY . .
RUN make gobuild

# Next image - Copy built Go binary into new workspace
FROM alpine
FROM alpine:3.17

LABEL license='SPDX-License-Identifier: BSD-3-Clause' \
copyright='Copyright (c) 2022: Intel'
copyright='Copyright (c) 2023: Intel'

RUN apk --no-cache add zeromq
COPY --from=builder /usr/local/bin/ms-inventory/res/configuration.toml /res/configuration.toml
COPY --from=builder /usr/local/bin/ms-inventory/res/configuration.yaml /res/configuration.yaml
COPY --from=builder /usr/local/bin/ms-inventory/main /ms-inventory
COPY --from=builder /usr/local/bin/ms-inventory/inventory.json /tmp/inventory.json
COPY --from=builder /usr/local/bin/ms-inventory/auditlog.json /tmp/auditlog.json
Expand Down
10 changes: 5 additions & 5 deletions ms-inventory/Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Copyright © 2022 Intel Corporation. All rights reserved.
# Copyright © 2023 Intel Corporation. All rights reserved.
# SPDX-License-Identifier: BSD-3-Clause

.PHONY: build gobuild run gorun stop test lint

MICROSERVICE=automated-checkout/ms-inventory
MICROSERVICE=automated-vending/ms-inventory

ARCH=$(shell uname -m)

Expand All @@ -19,7 +19,7 @@ docker:
.

gobuild: tidy
CGO_ENABLED=1 GOOS=linux go build -ldflags='-s -w' -a -installsuffix cgo main.go
CGO_ENABLED=0 GOOS=linux go build -ldflags='-s -w' -a main.go
lenny-goodell marked this conversation as resolved.
Show resolved Hide resolved

run:
docker run \
Expand All @@ -34,10 +34,10 @@ stop:
docker rm -f $(MICROSERVICE):dev

test:
go test -tags no_zmq -test.v -cover ./...
go test -test.v -cover ./...

testHTML:
go test -tags no_zmq -test.v -coverprofile=test_coverage.out ./... && \
go test -test.v -coverprofile=test_coverage.out ./... && \
go tool cover -html=test_coverage.out

lint:
Expand Down
89 changes: 48 additions & 41 deletions ms-inventory/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,72 +3,79 @@

module ms-inventory

go 1.18
go 1.20

require (
github.com/edgexfoundry/app-functions-sdk-go/v2 v2.2.0
github.com/edgexfoundry/go-mod-core-contracts/v2 v2.2.0
github.com/edgexfoundry/app-functions-sdk-go/v3 v3.0.1
github.com/edgexfoundry/go-mod-core-contracts/v3 v3.0.0
github.com/gorilla/mux v1.8.0
github.com/intel-iot-devkit/automated-checkout-utilities v1.0.0
github.com/stretchr/testify v1.8.0
github.com/stretchr/testify v1.8.2
)

require (
bitbucket.org/bertimus9/systemstat v0.0.0-20180207000608-0eeff89b0690 // indirect
github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da // indirect
github.com/Microsoft/go-winio v0.6.0 // indirect
github.com/armon/go-metrics v0.3.10 // indirect
github.com/cenkalti/backoff v2.2.1+incompatible // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/diegoholiveira/jsonlogic v1.0.1-0.20200220175622-ab7989be08b9 // indirect
github.com/eclipse/paho.mqtt.golang v1.3.5 // indirect
github.com/edgexfoundry/go-mod-bootstrap/v2 v2.2.0 // indirect
github.com/edgexfoundry/go-mod-configuration/v2 v2.2.0 // indirect
github.com/edgexfoundry/go-mod-messaging/v2 v2.2.0 // indirect
github.com/edgexfoundry/go-mod-registry/v2 v2.2.0 // indirect
github.com/edgexfoundry/go-mod-secrets/v2 v2.2.0 // indirect
github.com/diegoholiveira/jsonlogic/v3 v3.2.7 // indirect
github.com/eclipse/paho.mqtt.golang v1.4.2 // indirect
github.com/edgexfoundry/go-mod-bootstrap/v3 v3.0.1 // indirect
github.com/edgexfoundry/go-mod-configuration/v3 v3.0.0 // indirect
github.com/edgexfoundry/go-mod-messaging/v3 v3.0.0 // indirect
github.com/edgexfoundry/go-mod-registry/v3 v3.0.0 // indirect
github.com/edgexfoundry/go-mod-secrets/v3 v3.0.1 // indirect
github.com/fatih/color v1.9.0 // indirect
github.com/fxamacker/cbor/v2 v2.4.0 // indirect
github.com/go-kit/log v0.2.0 // indirect
github.com/go-jose/go-jose/v3 v3.0.0 // indirect
github.com/go-kit/log v0.2.1 // indirect
github.com/go-logfmt/logfmt v0.5.1 // indirect
github.com/go-playground/locales v0.14.0 // indirect
github.com/go-playground/universal-translator v0.18.0 // indirect
github.com/go-playground/validator/v10 v10.10.1 // indirect
github.com/go-playground/locales v0.14.1 // indirect
github.com/go-playground/universal-translator v0.18.1 // indirect
github.com/go-playground/validator/v10 v10.13.0 // indirect
github.com/go-redis/redis/v7 v7.3.0 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/gomodule/redigo v1.8.8 // indirect
github.com/gomodule/redigo v1.8.9 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/gorilla/websocket v1.4.2 // indirect
github.com/hashicorp/consul/api v1.9.1 // indirect
github.com/hashicorp/consul/api v1.20.0 // indirect
github.com/hashicorp/errwrap v1.0.0 // indirect
github.com/hashicorp/go-cleanhttp v0.5.1 // indirect
github.com/hashicorp/go-hclog v0.12.0 // indirect
github.com/hashicorp/go-immutable-radix v1.0.0 // indirect
github.com/hashicorp/go-hclog v0.14.1 // indirect
github.com/hashicorp/go-immutable-radix v1.3.0 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/hashicorp/go-rootcerts v1.0.2 // indirect
github.com/hashicorp/golang-lru v0.5.0 // indirect
github.com/hashicorp/serf v0.9.5 // indirect
github.com/leodido/go-urn v1.2.1 // indirect
github.com/mattn/go-colorable v0.1.6 // indirect
github.com/mattn/go-isatty v0.0.12 // indirect
github.com/hashicorp/golang-lru v0.5.4 // indirect
github.com/hashicorp/serf v0.10.1 // indirect
github.com/kr/pretty v0.3.0 // indirect
github.com/leodido/go-urn v1.2.3 // indirect
github.com/mattn/go-colorable v0.1.12 // indirect
github.com/mattn/go-isatty v0.0.14 // indirect
github.com/mitchellh/consulstructure v0.0.0-20190329231841-56fdc4d2da54 // indirect
github.com/mitchellh/copystructure v1.0.0 // indirect
github.com/mitchellh/copystructure v1.2.0 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/mitchellh/mapstructure v1.1.2 // indirect
github.com/mitchellh/reflectwalk v1.0.0 // indirect
github.com/pebbe/zmq4 v1.2.7 // indirect
github.com/pelletier/go-toml v1.9.4 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/mitchellh/reflectwalk v1.0.2 // indirect
github.com/nats-io/nats.go v1.25.0 // indirect
github.com/nats-io/nkeys v0.4.4 // indirect
github.com/nats-io/nuid v1.0.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a // indirect
github.com/spiffe/go-spiffe/v2 v2.0.0 // indirect
github.com/stretchr/objx v0.4.0 // indirect
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect
github.com/rogpeppe/go-internal v1.8.0 // indirect
github.com/spiffe/go-spiffe/v2 v2.1.4 // indirect
github.com/stretchr/objx v0.5.0 // indirect
github.com/x448/float16 v0.8.4 // indirect
github.com/zeebo/errs v1.2.2 // indirect
golang.org/x/crypto v0.1.0 // indirect
golang.org/x/net v0.7.0 // indirect
golang.org/x/sys v0.5.0 // indirect
golang.org/x/text v0.7.0 // indirect
google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f // indirect
github.com/zeebo/errs v1.3.0 // indirect
golang.org/x/crypto v0.8.0 // indirect
golang.org/x/mod v0.8.0 // indirect
golang.org/x/net v0.9.0 // indirect
golang.org/x/sync v0.1.0 // indirect
golang.org/x/sys v0.7.0 // indirect
golang.org/x/text v0.9.0 // indirect
golang.org/x/tools v0.6.0 // indirect
google.golang.org/genproto v0.0.0-20230223222841-637eb2293923 // indirect
google.golang.org/grpc v1.53.0 // indirect
google.golang.org/protobuf v1.28.1 // indirect
gopkg.in/square/go-jose.v2 v2.4.1 // indirect
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Loading