From: Ravi Pendurty Date: Mon, 3 Oct 2022 07:13:50 +0000 (+0530) Subject: Remove the need to use sudo during build X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=commitdiff_plain;ds=sidebyside;h=623251a70da40b8e4829f00b138e963caad5d261;p=it%2Fdep.git Remove the need to use sudo during build scripts modified to include new user and sudo Issue-ID: OAM-294 Signed-off-by: Ravi Pendurty Change-Id: I4a250c6b2d7809a034c4a1e0f1599f7f091f8298 Signed-off-by: Ravi Pendurty --- diff --git a/ci/Dockerfile-smo-install b/ci/Dockerfile-smo-install index 58d82958..99872f62 100644 --- a/ci/Dockerfile-smo-install +++ b/ci/Dockerfile-smo-install @@ -16,11 +16,22 @@ # ############################################################################## FROM ubuntu:18.04 -RUN apt-get update && apt-get -y install curl ca-certificates wget +RUN apt-get update && apt-get -y install ca-certificates wget # often times out during LF jenkins build +ARG USERNAME=ubuntu +ARG USER_UID=1000 +ARG USER_GID=$USER_UID +# Create the user +RUN groupadd --gid $USER_GID $USERNAME \ + && useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \ + && apt-get install -y sudo \ + && echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \ + && chmod 0440 /etc/sudoers.d/$USERNAME + +USER $USERNAME ARG TGT=/tmp/it-dep -COPY . $TGT +COPY --chown=$USERNAME:$USERNAME . $TGT RUN ls -latr /tmp/it-dep # Remove the smo-install as this one will be verified in another verify job RUN $TGT/bin/verify-smo-install diff --git a/smo-install/README.md b/smo-install/README.md index a3a19229..e52ef1b7 100644 --- a/smo-install/README.md +++ b/smo-install/README.md @@ -37,7 +37,6 @@ It has been created out of the ONAP vfirewall use case. ## Quick Installation on existing kubernetes * Ensure you have at least 20GB Memory, 6VCPU, 60GB of disk space. -* Execute the following commands being logged as root: ```git clone --recursive "https://gerrit.o-ran-sc.org/r/it/dep"``` diff --git a/smo-install/scripts/layer-0/0-setup-charts-museum.sh b/smo-install/scripts/layer-0/0-setup-charts-museum.sh index 8a9fda15..5689693e 100755 --- a/smo-install/scripts/layer-0/0-setup-charts-museum.sh +++ b/smo-install/scripts/layer-0/0-setup-charts-museum.sh @@ -30,6 +30,6 @@ cd $SCRIPT_PATH cd /tmp wget https://get.helm.sh/chartmuseum-v0.13.1-linux-amd64.tar.gz tar xvfz chartmuseum-v0.13.1-linux-amd64.tar.gz -mv /tmp/linux-amd64/chartmuseum /usr/local/bin/chartmuseum +sudo mv /tmp/linux-amd64/chartmuseum /usr/local/bin/chartmuseum chartmuseum --port=18080 --storage="local" --storage-local-rootdir=$SCRIPT_PATH"/../../../chartstorage" & diff --git a/smo-install/scripts/layer-0/0-setup-helm3.sh b/smo-install/scripts/layer-0/0-setup-helm3.sh index c9d03b63..b8b8508b 100755 --- a/smo-install/scripts/layer-0/0-setup-helm3.sh +++ b/smo-install/scripts/layer-0/0-setup-helm3.sh @@ -22,14 +22,12 @@ # =================================================================== # ### - #Helm package +cd /tmp wget https://get.helm.sh/helm-v3.5.4-linux-amd64.tar.gz -mv helm-v3.5.4-linux-amd64.tar.gz /tmp/helm-v3.5.4-linux-amd64.tar.gz -cd /tmp/ tar xvfz /tmp/helm-v3.5.4-linux-amd64.tar.gz -mv linux-amd64/helm /usr/local/bin/helm -apt-get install git -y +sudo mv linux-amd64/helm /usr/local/bin/helm +sudo apt-get install git -y echo "Checking HELM ..." diff --git a/smo-install/scripts/sub-scripts/build-onap.sh b/smo-install/scripts/sub-scripts/build-onap.sh index 2033ef09..23753b43 100755 --- a/smo-install/scripts/sub-scripts/build-onap.sh +++ b/smo-install/scripts/sub-scripts/build-onap.sh @@ -27,7 +27,7 @@ SCRIPT=$(readlink -f "$0") SCRIPT_PATH=$(dirname "$SCRIPT") cd $SCRIPT_PATH -apt-get install make -y +sudo apt-get install make -y helm plugin install ../../onap_oom/kubernetes/helm/plugins/undeploy/ helm plugin install ../../onap_oom/kubernetes/helm/plugins/deploy/ diff --git a/smo-install/scripts/sub-scripts/build-oran.sh b/smo-install/scripts/sub-scripts/build-oran.sh index 9e3f1646..8e325733 100755 --- a/smo-install/scripts/sub-scripts/build-oran.sh +++ b/smo-install/scripts/sub-scripts/build-oran.sh @@ -27,7 +27,7 @@ SCRIPT=$(readlink -f "$0") SCRIPT_PATH=$(dirname "$SCRIPT") cd $SCRIPT_PATH -apt-get install make -y +sudo apt-get install make -y echo '### Building ORAN part ###' (cd ../../oran_oom && make all) diff --git a/smo-install/scripts/sub-scripts/build-tests.sh b/smo-install/scripts/sub-scripts/build-tests.sh index d5267b49..545dc48c 100755 --- a/smo-install/scripts/sub-scripts/build-tests.sh +++ b/smo-install/scripts/sub-scripts/build-tests.sh @@ -27,7 +27,7 @@ SCRIPT=$(readlink -f "$0") SCRIPT_PATH=$(dirname "$SCRIPT") cd $SCRIPT_PATH -apt-get install make -y +sudo apt-get install make -y echo '### Building ORAN tests part ###' (cd ../../tests_oom && make all)