#----------------------------------------------------------
-FROM nexus3.o-ran-sc.org:10004/bldr-ubuntu16-c-go:1-u16.04-nng1.1.1 AS appmgr-build
+FROM nexus3.o-ran-sc.org:10004/bldr-ubuntu18-c-go:2-u18.04-nng AS appmgr-build
RUN apt-get update -y && apt-get install -y jq
ENV PATH="/usr/local/go/bin:${PATH}"
ARG HELMVERSION=v2.12.3
-ARG PACKAGEURL=gerrit.o-ran-sc.org/r/ric-plt/appmgr
# Install helm
RUN wget -nv https://storage.googleapis.com/kubernetes-helm/helm-${HELMVERSION}-linux-amd64.tar.gz \
# Install kubectl from Docker Hub
COPY --from=lachlanevenson/k8s-kubectl:v1.10.3 /usr/local/bin/kubectl /usr/local/bin/kubectl
-RUN mkdir -p /go/src/${PACKAGEURL}
-WORKDIR "/go/src/${PACKAGEURL}"
+RUN mkdir -p /ws
+WORKDIR "/ws"
ENV GOPATH="/go"
# Module prepare (if go.mod/go.sum updated)
-COPY go.mod /go/src/${PACKAGEURL}
-COPY go.sum /go/src/${PACKAGEURL}
+COPY go.mod /ws
+COPY go.sum /ws
RUN GO111MODULE=on go mod download
-# build
-COPY . /go/src/${PACKAGEURL}
-RUN make -C /go/src/${PACKAGEURL} build
+# build and test
+COPY . /ws
+
+RUN make -C /ws go-build
+
+RUN make -C /ws go-test-fmt
+
+#RUN make -C /ws go-test
CMD ["/bin/bash"]
#----------------------------------------------------------
-FROM ubuntu:16.04 as appmgr
-ARG PACKAGEURL=gerrit.o-ran-sc.org/r/ric-plt/appmgr
+FROM ubuntu:18.04 as appmgr
RUN apt-get update -y \
&& apt-get install -y sudo openssl ca-certificates ca-cacert \
RUN mkdir -p /opt/xAppManager \
&& chmod -R 755 /opt/xAppManager
-COPY --from=appmgr-build /go/src/${PACKAGEURL}/cache/go/cmd/appmgr /opt/xAppManager/appmgr
-#COPY --from=appmgr-build /go/src/${PACKAGEURL}/config/appmgr.yaml /opt/etc/xAppManager/config-file.yaml
+COPY --from=appmgr-build /ws/cache/go/cmd/appmgr /opt/xAppManager/appmgr
WORKDIR /opt/xAppManager
+++ /dev/null
-# Copyright (c) 2019 AT&T Intellectual Property.
-# Copyright (c) 2019 Nokia.
-#
-# 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.
-
-#----------------------------------------------------------
-FROM nexus3.o-ran-sc.org:10004/bldr-ubuntu-c-go-nng:3-u16.04-nng1.1.1 AS appmgr-build
-
-RUN apt-get update -y && apt-get install -y jq
-
-ENV PATH="/usr/local/go/bin:${PATH}"
-ARG HELMVERSION=v2.13.0-rc.1
-ARG PACKAGEURL=gerrit.o-ran-sc.org/r/ric-plt/appmgr
-
-#
-# helm
-#
-RUN wget https://storage.googleapis.com/kubernetes-helm/helm-${HELMVERSION}-linux-amd64.tar.gz \
- && tar -zxvf helm-${HELMVERSION}-linux-amd64.tar.gz \
- && cp linux-amd64/helm /usr/local/bin/helm \
- && rm -rf helm-${HELMVERSION}-linux-amd64.tar.gz \
- && rm -rf linux-amd64
-
-# Install kubectl from Docker Hub.
-COPY --from=lachlanevenson/k8s-kubectl:v1.10.3 /usr/local/bin/kubectl /usr/local/bin/kubectl
-
-RUN mkdir -p /go/src/${PACKAGEURL}
-WORKDIR "/go/src/${PACKAGEURL}"
-ENV GOPATH="/go"
-
-# Module prepare (if go.mod/go.sum updated)
-COPY go.mod /go/src/${PACKAGEURL}
-COPY go.sum /go/src/${PACKAGEURL}
-RUN GO111MODULE=on go mod download
-
-# build
-COPY . /go/src/${PACKAGEURL}
-RUN make -C /go/src/${PACKAGEURL} build
-
-CMD ["/bin/bash"]
-
-#----------------------------------------------------------
-FROM appmgr-build as appmgr-test_unit
-ARG PACKAGEURL=gerrit.o-ran-sc.org/r/ric-plt/appmgr
-WORKDIR "/go/src/${PACKAGEURL}"
-CMD ["make","go-test"]
-
-#----------------------------------------------------------
-FROM appmgr-build as appmgr-test_fmt
-ARG PACKAGEURL=gerrit.o-ran-sc.org/r/ric-plt/appmgr
-WORKDIR "/go/src/${PACKAGEURL}"
-CMD ["make","go-test-fmt"]
-
-#----------------------------------------------------------
-FROM appmgr-build as appmgr-test_sanity
-ARG PACKAGEURL=gerrit.o-ran-sc.org/r/ric-plt/appmgr
-WORKDIR "/go/src/${PACKAGEURL}"
-CMD ["jq","-s",".", "api/appmgr_rest_api.json"]
XAPP_TESTENV:="RMR_SEED_RT=config/uta_rtg.rt CFG_FILE=$(ROOT_DIR)helm_chart/uemgr/descriptors/config-file.json"
include build/make.go.mk
-#------------------------------------------------------------------------------
-#
-# DOCKER TARGETS
-#
-#------------------------------------------------------------------------------
-
-HELMVERSION:=v2.13.0-rc.1
-DCKR_B_OPTS:=${DCKR_B_OPTS} --build-arg HELMVERSION=${HELMVERSION}
-
-PACKAGEURL:="gerrit.oran-osc.org/r/ric-plt/appmgr"
-
-DCKR_NAME:=appmgr-xapp-base
-include build/make.docker.mk
-
-DCKR_NAME:=appmgr-test_unit
-include build/make.docker.mk
-
-DCKR_NAME:=appmgr-test_fmt
-include build/make.docker.mk
-
-DCKR_NAME:=appmgr-test_sanity
-include build/make.docker.mk
-
-DCKR_NAME:=appmgr
-include build/make.docker.mk
-
-
-docker-test: docker-run-stop_appmgr-test_fmt docker-run-stop_appmgr-test_sanity docker-run-stop_appmgr-test_unit
-
# See the License for the specific language governing permissions and
# limitations under the License.
-cp /opt/ric/config/appmgr.yaml /opt/xAppManager/config-file.yaml
-
# Copy all certificates from mounted folder to root system
cp /opt/ric/certificates/* /etc/ssl/certs
# Start services, etc.
-/opt/xAppManager/appmgr -f /opt/xAppManager/config-file.yaml
+/opt/xAppManager/appmgr -f /opt/ric/config/appmgr.yaml
+++ /dev/null
-#!/bin/bash
-# Copyright (c) 2019 AT&T Intellectual Property.
-# Copyright (c) 2019 Nokia.
-#
-# 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.
-#
-
-#
-# SSH
-#
-if [ -n "${SSH_PRIVATE_KEY}" ] && [ -n "${PACKAGEREPO}" ] ; then
-
- # ssh configs (no private key)
- mkdir -p ${HOME}/.ssh
- test -n "${PACKAGEREPO}" && ssh-keyscan -H ${PACKAGEREPO} >> ${HOME}/.ssh/known_hosts
- echo -e "IdentityFile ~/.ssh/id_rsa\n" > ${HOME}/.ssh/config
- echo -e "Host *\n\tStrictHostKeyChecking no\n\n" >> ${HOME}/.ssh/config
- chmod -R go= ${HOME}/.ssh/
- chmod -R u+rw ${HOME}/.ssh/
-
- # gitconfig
- test -n "${PACKAGEREPO}" && echo -e "[url \"ssh://git@${PACKAGEREPO}/\"]\n\tinsteadOf = https://${PACKAGEREPO}/" > ${HOME}/.gitconfig
-
- # ssh agent
- TEMPFILE=/dev/shm/deployment.key
- echo "$SSH_PRIVATE_KEY" > $TEMPFILE
- chmod 0600 $TEMPFILE
- eval $(ssh-agent)
- ssh-add $TEMPFILE
- rm $TEMPFILE
-fi
-
-if [ -n "${NETRC_CONFIG}" ] ; then
- echo "${NETRC_CONFIG}" > /root/.netrc
-fi
-
-
-exec $*
+++ /dev/null
-# Copyright (c) 2019 AT&T Intellectual Property.
-# Copyright (c) 2019 Nokia.
-#
-# 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.
-
-#------------------------------------------------------------------------------
-#
-#------------------------------------------------------------------------------
-ifndef MAKE_DOCKER_TARGETS
-MAKE_DOCKER_TARGETS:=1
-
-.PHONY: docker-build docker-clean docker-stop FORCE
-
-FORCE:
-
-
-docker-name_%:
- @echo $($*_DCKR_FULLNAME)
-
-
-docker-build_%:
- docker build --target $* $($*_DCKR_B_OPTS) -t $($*_DCKR_FULLNAME) -f $($*_DCKR_FILE) .
-
-.docker-services-drun_%:
- docker network create --driver bridge $($*_DCKR_FULLNAME)-running_network
- docker run $($*_DCKR_R_OPTS) -d --name $($*_DCKR_FULLNAME)-running_redis --network $($*_DCKR_FULLNAME)-running_network redis
-
-docker-irun_%: .docker-services-drun_%
- docker run $($*_DCKR_R_OPTS) --name $($*_DCKR_FULLNAME)-running_xapp --network $($*_DCKR_FULLNAME)-running_network -e DBAAS_SERVICE_HOST=$($*_DCKR_FULLNAME)-running_redis $($*_DCKR_FULLNAME) /bin/bash
-
-docker-irun-mounted_%: .docker-services-drun_%
- docker run $($*_DCKR_R_OPTS) -v $(shell pwd):/ws/go/src/${PACKAGEURL} --workdir "/ws/go/src/${PACKAGEURL}" --name $($*_DCKR_FULLNAME)-running_xapp --network $($*_DCKR_FULLNAME)-running_network -e DBAAS_SERVICE_HOST=$($*_DCKR_FULLNAME)-running_redis $($*_DCKR_FULLNAME) /bin/bash
-
-docker-run_%: .docker-services-drun_%
- docker run $($*_DCKR_R_OPTS) --name $($*_DCKR_FULLNAME)-running_xapp --network $($*_DCKR_FULLNAME)-running_network -e DBAAS_SERVICE_HOST=$($*_DCKR_FULLNAME)-running_redis $($*_DCKR_FULLNAME)
-
-docker-stop_%:
- docker rm -f $($*_DCKR_FULLNAME)-running_xapp &> /dev/null || true
- docker rm -f $($*_DCKR_FULLNAME)-running_redis &> /dev/null || true
- docker network rm $($*_DCKR_FULLNAME)-running_network &> /dev/null || true
-
-docker-irun-stop_%: docker-irun_%
- docker rm -f $($*_DCKR_FULLNAME)-running_xapp &> /dev/null || true
- docker rm -f $($*_DCKR_FULLNAME)-running_redis &> /dev/null || true
- docker network rm $($*_DCKR_FULLNAME)-running_network &> /dev/null || true
-
-docker-irun-mounted-stop_%: docker-irun-mounted_%
- docker rm -f $($*_DCKR_FULLNAME)-running_xapp &> /dev/null || true
- docker rm -f $($*_DCKR_FULLNAME)-running_redis &> /dev/null || true
- docker network rm $($*_DCKR_FULLNAME)-running_network &> /dev/null || true
-
-docker-run-stop_%: docker-run_%
- docker rm -f $($*_DCKR_FULLNAME)-running_xapp &> /dev/null || true
- docker rm -f $($*_DCKR_FULLNAME)-running_redis &> /dev/null || true
- docker network rm $($*_DCKR_FULLNAME)-running_network &> /dev/null || true
-
-docker-clean_%: docker-stop_%
- docker rmi $($*_DCKR_FULLNAME) || true
-
-
-.SECONDEXPANSION:
-docker-build: DCKR_TARGETS:=
-docker-build: $$(DCKR_TARGETS)
-
-.SECONDEXPANSION:
-docker-clean: DCKR_TARGETS:=
-docker-clean: $$(DCKR_TARGETS)
-
-.SECONDEXPANSION:
-docker-stop: DCKR_TARGETS:=
-docker-stop: $$(DCKR_TARGETS)
-
-endif
-
-#------------------------------------------------------------------------------
-#
-#------------------------------------------------------------------------------
-
-ifndef DCKR_FILE
-DCKR_FILE:="Dockerfile"
-endif
-
-ifndef BUILD_PREFIX
-BUILD_PREFIX:="${USER}-"
-endif
-
-
-#------------------------------------------------------------------------------
-#
-#------------------------------------------------------------------------------
-
-ifndef $(DCKR_NAME)_DCKR_B_PREFIX
-$(DCKR_NAME)_DCKR_B_PREFIX:=$(BUILD_PREFIX)
-endif
-
-ifndef $(DCKR_NAME)_DCKR_FILE
-$(DCKR_NAME)_DCKR_FILE:=$(DCKR_FILE)
-endif
-
-$(DCKR_NAME)_DCKR_B_PREFIX:=$(subst /,_,$(shell echo $($(DCKR_NAME)_DCKR_B_PREFIX) | tr '[:upper:]' '[:lower:]'))
-
-$(DCKR_NAME)_DCKR_FULLNAME:=$($(DCKR_NAME)_DCKR_B_PREFIX)$(DCKR_NAME)
-
-$(DCKR_NAME)_DCKR_B_OPTS:=${DCKR_B_OPTS}
-$(DCKR_NAME)_DCKR_B_OPTS:=$($(DCKR_NAME)_DCKR_B_OPTS) --network=host
-
-ifdef PACKAGEURL
-$(DCKR_NAME)_DCKR_B_OPTS:=$($(DCKR_NAME)_DCKR_B_OPTS) --build-arg PACKAGEURL=${PACKAGEURL}
-endif
-
-ifdef BUILD_PREFIX
-$(DCKR_NAME)_DCKR_B_OPTS:=$($(DCKR_NAME)_DCKR_B_OPTS) --build-arg BUILD_PREFIX=${BUILD_PREFIX}
-endif
-
-
-$(DCKR_NAME)_DCKR_R_OPTS:=${DCKR_R_OPTS}
-$(DCKR_NAME)_DCKR_R_OPTS:=$($(DCKR_NAME)_DCKR_R_OPTS) --rm -i --net=host
-$(DCKR_NAME)_DCKR_R_OPTS:=$($(DCKR_NAME)_DCKR_R_OPTS)$(shell test -t 0 && echo ' -t')
-$(DCKR_NAME)_DCKR_R_OPTS:=$($(DCKR_NAME)_DCKR_R_OPTS)$(shell test -e /etc/localtime && echo ' -v /etc/localtime:/etc/localtime:ro')
-$(DCKR_NAME)_DCKR_R_OPTS:=$($(DCKR_NAME)_DCKR_R_OPTS)$(shell test -e /var/run/docker.sock && echo ' -v /var/run/docker.sock:/var/run/docker.sock')
-$(DCKR_NAME)_DCKR_R_OPTS:=$($(DCKR_NAME)_DCKR_R_OPTS)$(shell test -e ${HOME}/.docker && echo ' -v ${HOME}/.docker:/ws/.docker:ro')
-$(DCKR_NAME)_DCKR_R_OPTS:=$($(DCKR_NAME)_DCKR_R_OPTS)$(shell test -e ${HOME}/.netrc && echo ' -v ${HOME}/.netrc:/ws/.netrc:ro')
-$(DCKR_NAME)_DCKR_R_OPTS:=$($(DCKR_NAME)_DCKR_R_OPTS)$(shell test -e ${HOME}/.ssh && echo ' -v ${HOME}/.ssh:/ws/.ssh:ro')
-$(DCKR_NAME)_DCKR_R_OPTS:=$($(DCKR_NAME)_DCKR_R_OPTS)$(shell test -e ${HOME}/.gitconfig && echo ' -v ${HOME}/.gitconfig:/ws/.gitconfig:ro')
-
-
-docker-build: DCKR_TARGETS+=docker-build_$(DCKR_NAME)
-
-docker-clean: DCKR_TARGETS+=docker-clean_$(DCKR_NAME)
-
-docker-stop: DCKR_TARGETS+=docker-stop_$(DCKR_NAME)
-
+++ /dev/null
-#!/bin/bash
-# Copyright (c) 2019 AT&T Intellectual Property.
-# Copyright (c) 2019 Nokia.
-#
-# 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.
-#
-
-source /etc/os-release
-
-if [ -z ${CONT_USER} ]; then CONT_USER=builder ; fi
-if [ -z ${CONT_UID} ]; then CONT_UID=$(stat -c "%u" $(readlink -f .) ); fi
-if [ -z ${CONT_GROUP} ]; then CONT_GROUP=builder; fi
-if [ -z ${CONT_GID} ]; then CONT_GID=$(stat -c "%g" $(readlink -f .) ); fi
-
-if [ $(id -u) -eq $CONT_UID ] || [ $(id -u) -ne 0 ] ; then
- exec "$@"
-fi
-
-if [ $(getent group ${CONT_GROUP}) ] || [ $(getent group ${CONT_GID}) ] ; then
- echo "group conflict"
- exit 0
-fi
-if [ $(getent passwd ${CONT_USER}) ] || [ $(getent passwd ${CONT_UID}) ] ; then
- echo "passwd conflict"
- exit 0
-fi
-
-if [[ $ID == "ubuntu" ]] ; then
- groupadd --gid ${CONT_GID} ${CONT_GROUP} || exit 10
- useradd --shell /bin/bash --uid ${CONT_UID} --gid ${CONT_GID} -o -d /ws $(test -d /ws && echo "-M" || echo "-m") --groups $CONT_GID ${CONT_USER}|| exit 11
-fi
-if [[ $ID == "alpine" ]] ; then
- addgroup -g ${CONT_GID} ${CONT_GROUP} || exit 10
- adduser -s /bin/bash -u ${CONT_UID} -G ${CONT_GROUP} -h /ws $(test -d /ws && echo "-H") -D ${CONT_USER} || exit 11
-fi
-
-chown ${CONT_UID}.${CONT_GID} /ws
-
-echo "${CONT_USER} ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
-
-DOCKER_SOCKET=/var/run/docker.sock
-if [ -S ${DOCKER_SOCKET} ]; then
- DOCKER_GID=$(stat -c '%g' ${DOCKER_SOCKET})
- if [ $(getent group ${DOCKER_GID}) ]; then
- if [[ $ID == "ubuntu" ]] ; then
- usermod -aG $(getent group ${DOCKER_GID} | cut -d: -f1) ${CONT_USER} || exit 12
- fi
- if [[ $ID == "alpine" ]] ; then
- addgroup ${CONT_USER} $(getent group ${DOCKER_GID} | cut -d: -f1) || exit 12
- fi
- else
- if [[ $ID == "ubuntu" ]] ; then
- groupadd -for -g ${DOCKER_GID} docker_${CONT_USER} || exit 13
- usermod -aG docker_${CONT_USER} ${CONT_USER} || exit 14
- fi
- if [[ $ID == "alpine" ]] ; then
- addgroup -g ${DOCKER_GID} docker_${CONT_USER} || exit 13
- addgroup ${CONT_USER} docker_${CONT_USER} || exit 14
- fi
- fi
-fi
-
-export USER=${CONT_USER}
-export HOME=/ws
-
-mkdir -p /ws/go
-chown -R ${CONT_UID}.${CONT_GID} /ws/go
-export GOPATH="/ws/go"
-
-sudo -E -s -u ${CONT_USER} env "PATH=$PATH" "$@"
for i := 0; i < 3; i++ {
if xapp, err = m.helm.Status(xapp.Name); xapp.Instances != nil {
- break;
+ break
}
time.Sleep(time.Duration(5) * time.Second)
}
return
}
-func (cm *ConfigMap) GetConfigMapName(xappName, namespace string) (string) {
+func (cm *ConfigMap) GetConfigMapName(xappName, namespace string) string {
return " configmap-" + namespace + "-" + xappName + "-appconfig"
}
# The Jenkins job uses this string for the tag in the image name
# for example nexus3.o-ran-sc.org:10004/my-image-name:my-tag
---
-tag: '0.1.9'
+tag: '0.1.10'