Prepare dmaapmediatorproducer for CI 88/6688/2
authorelinuxhenrik <henrik.b.andersson@est.tech>
Mon, 6 Sep 2021 04:36:31 +0000 (06:36 +0200)
committerHenrik Andersson <henrik.b.andersson@est.tech>
Tue, 14 Sep 2021 13:29:50 +0000 (13:29 +0000)
Issue-ID: NONRTRIC-593
Signed-off-by: elinuxhenrik <henrik.b.andersson@est.tech>
Change-Id: I2911b2680c2ccd69887f0a3c4e930b2859769eb1

dmaap-mediator-producer/.gitignore
dmaap-mediator-producer/Dockerfile [new file with mode: 0644]
dmaap-mediator-producer/build-dmaapmediatorproducer-ubuntu.sh [new file with mode: 0755]
dmaap-mediator-producer/container-tag.yaml [new file with mode: 0644]
dmaap-mediator-producer/go.mod
dmaap-mediator-producer/go.sum

index 998dab9..567963e 100644 (file)
@@ -2,3 +2,4 @@
 .vscode
 coverage.*
 main
+dmaapmediatorproducer
diff --git a/dmaap-mediator-producer/Dockerfile b/dmaap-mediator-producer/Dockerfile
new file mode 100644 (file)
index 0000000..95bcbae
--- /dev/null
@@ -0,0 +1,39 @@
+#==================================================================================
+#   Copyright (C) 2021: Nordix Foundation
+#
+#   Licensed under the Apache License, Version 2.0 (the "License");
+#   you may not use this file except in compliance with the License.
+#   You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+#   Unless required by applicable law or agreed to in writing, software
+#   distributed under the License is distributed on an "AS IS" BASIS,
+#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#   See the License for the specific language governing permissions and
+#   limitations under the License.
+#
+#   This source code is part of the near-RT RIC (RAN Intelligent Controller)
+#   platform project (RICP).
+#==================================================================================
+
+##
+## Build
+##
+FROM golang:1.17-bullseye AS build
+WORKDIR /app
+COPY go.mod ./
+COPY go.sum ./
+RUN go mod download
+COPY . ./
+RUN go build -o /dmaapmediatorproducer
+##
+## Deploy
+##
+FROM gcr.io/distroless/base-debian10
+WORKDIR /
+## Copy from "build" stage
+COPY --from=build /dmaapmediatorproducer .
+COPY --from=build /app/configs/ configs
+USER nonroot:nonroot
+ENTRYPOINT ["/dmaapmediatorproducer"]
diff --git a/dmaap-mediator-producer/build-dmaapmediatorproducer-ubuntu.sh b/dmaap-mediator-producer/build-dmaapmediatorproducer-ubuntu.sh
new file mode 100755 (executable)
index 0000000..ad8b8bb
--- /dev/null
@@ -0,0 +1,35 @@
+#!/bin/bash
+##############################################################################
+#
+#   Copyright (C) 2021: Nordix Foundation
+#
+#   Licensed under the Apache License, Version 2.0 (the "License");
+#   you may not use this file except in compliance with the License.
+#   You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+#   Unless required by applicable law or agreed to in writing, software
+#   distributed under the License is distributed on an "AS IS" BASIS,
+#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#   See the License for the specific language governing permissions and
+#   limitations under the License.
+#
+##############################################################################
+set -eux
+
+echo "--> build-dmaapmediatorproducer-ubuntu.sh"
+curdir=`pwd`
+# go installs tools like go-acc to $HOME/go/bin
+# ubuntu minion path lacks go
+export PATH=$PATH:/usr/local/go/bin:$HOME/go/bin
+
+# install the go coverage tool helper
+go get -v github.com/ory/go-acc
+
+export GO111MODULE=on
+go get github.com/stretchr/testify/mock@v1.7.0
+
+go-acc ./... --ignore mocks
+
+echo "--> build-dmaapmediatorproducer-ubuntu.sh ends"
diff --git a/dmaap-mediator-producer/container-tag.yaml b/dmaap-mediator-producer/container-tag.yaml
new file mode 100644 (file)
index 0000000..230e590
--- /dev/null
@@ -0,0 +1,2 @@
+---
+tag: 1.0.0
index f5bcb33..7e0d96e 100644 (file)
@@ -2,13 +2,15 @@ module oransc.org/nonrtric/dmaapmediatorproducer
 
 go 1.17
 
-require github.com/sirupsen/logrus v1.8.1
+require (
+       github.com/sirupsen/logrus v1.8.1
+       github.com/stretchr/testify v1.7.0
+)
 
 require (
        github.com/davecgh/go-spew v1.1.1 // indirect
        github.com/pmezard/go-difflib v1.0.0 // indirect
        github.com/stretchr/objx v0.1.0 // indirect
-       github.com/stretchr/testify v1.7.0 // indirect
        golang.org/x/sys v0.0.0-20191026070338-33540a1f6037 // indirect
        gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect
 )
index e4bbbae..2cf67a6 100644 (file)
@@ -12,6 +12,7 @@ github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5Cc
 github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
 golang.org/x/sys v0.0.0-20191026070338-33540a1f6037 h1:YyJpGZS1sBuBCzLAR1VEpK193GlqGZbnPFnPV/5Rsb4=
 golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
 gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
 gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
 gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=