enable profile and race detection builds
Change-Id: I7177ea7ad2ea55c400ebb9ca9b3f7e7e1f82ae33
diff --git a/Makefile b/Makefile
index 210fd0e..ad3a4ca 100644
--- a/Makefile
+++ b/Makefile
@@ -94,9 +94,12 @@
## Docker targets
docker-build: local-protos local-voltha local-lib-go ## Build docker image (set BUILD_PROFILED=true to also build the profiled image)
- docker build $(DOCKER_BUILD_ARGS) --target=${DOCKER_TARGET} -t ${ADAPTER_IMAGENAME}:${DOCKER_TAG} -f docker/Dockerfile.ofagent-go .
+ docker build $(DOCKER_BUILD_ARGS) --build-arg CGO_PARAMETER=0 --target=${DOCKER_TARGET} -t ${ADAPTER_IMAGENAME}:${DOCKER_TAG} -f docker/Dockerfile.ofagent-go .
ifdef BUILD_PROFILED
- docker build $(DOCKER_BUILD_ARGS) --target=${DOCKER_TARGET} --build-arg EXTRA_GO_BUILD_TAGS="-tags profile" -t ${ADAPTER_IMAGENAME}:${DOCKER_TAG}-profile -f docker/Dockerfile.ofagent-go .
+ docker build $(DOCKER_BUILD_ARGS) --build-arg CGO_PARAMETER=1 --target=dev --build-arg EXTRA_GO_BUILD_TAGS="-tags profile" -t ${ADAPTER_IMAGENAME}:${DOCKER_TAG}-profile -f docker/Dockerfile.ofagent-go .
+endif
+ifdef BUILD_RACE
+ docker build $(DOCKER_BUILD_ARGS) --build-arg CGO_PARAMETER=1 --target=dev --build-arg EXTRA_GO_BUILD_TAGS="--race" -t ${ADAPTER_IMAGENAME}:${DOCKER_TAG}-rd -f docker/Dockerfile.ofagent-go .
endif
docker-push: ## Push the docker images to an external repository
@@ -104,6 +107,9 @@
ifdef BUILD_PROFILED
docker push ${ADAPTER_IMAGENAME}:${DOCKER_TAG}-profile
endif
+ifdef BUILD_RACE
+ docker push ${ADAPTER_IMAGENAME}:${DOCKER_TAG}-rd
+endif
## lint and unit tests
diff --git a/VERSION b/VERSION
index dc1e644..9c6d629 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-1.6.0
+1.6.1
diff --git a/docker/Dockerfile.ofagent-go b/docker/Dockerfile.ofagent-go
index 09bbf4c..d4002bd 100644
--- a/docker/Dockerfile.ofagent-go
+++ b/docker/Dockerfile.ofagent-go
@@ -17,11 +17,16 @@
FROM --platform=linux/amd64 golang:1.16.3-alpine3.13 AS dev
+# Install required packages
+RUN apk add --no-cache build-base=0.5-r2
+
WORKDIR /go/src
COPY . .
ARG EXTRA_GO_BUILD_TAGS=""
+ARG CGO_PARAMETER="0"
+
ARG org_label_schema_version=unknown
ARG org_label_schema_vcs_url=unknown
ARG org_label_schema_vcs_ref=unknown
@@ -32,7 +37,7 @@
# Build
SHELL ["/bin/ash", "-o", "pipefail", "-c"]
RUN \
-CGO_ENABLED=0 go build $EXTRA_GO_BUILD_TAGS -mod=vendor -o /app/ofagent \
+CGO_ENABLED=$CGO_PARAMETER go build $EXTRA_GO_BUILD_TAGS -mod=vendor -o /app/ofagent \
-ldflags \
"-X github.com/opencord/voltha-lib-go/v2/pkg/version.version=$org_label_schema_version \
-X github.com/opencord/voltha-lib-go/v2/pkg/version.vcsRef=$org_label_schema_vcs_ref \