[Fuego] [PATCH 1/1] Remove jenkins user created during build time with host's uid/gid

Guilherme Camargo guicc at profusion.mobi
Thu Feb 1 01:02:59 UTC 2018


Hello, Tim

Sorry. I forgot to make the fix in
docker-create-usb-priviledged-container.sh as well. UID and GID should be
passed to to docker create in that case too.

Don't know if it helps, since you're changing the behavior, but this would
be the patch that would need to be applied into
docker-create-usb-priviledged-container.sh in order to fix the problem:


----------


diff --git a/fuego-host-scripts/docker-create-usb-privileged-container.sh
b/fuego-host-scripts/docker-create-usb-privileged-container.sh
index 2431214..b4c358b 100755
--- a/fuego-host-scripts/docker-create-usb-privileged-container.sh
+++ b/fuego-host-scripts/docker-create-usb-privileged-container.sh
@@ -17,6 +17,14 @@ if [ ! -d $DIR/../../fuego-core ]; then
    exit 1
 fi

+if [ "${UID}" == "0" ]; then
+       uid=$(id -u "${SUDO_USER}")
+       gid=$(id -g "${SUDO_USER}")
+else
+       uid="${UID}"
+       gid=$(id -g "${USER}")
+fi
+
 sudo docker create -it --name ${DOCKERCONTAINER} \
     --privileged \
     -v /boot:/boot:ro \
@@ -30,5 +38,7 @@ sudo docker create -it --name ${DOCKERCONTAINER} \
     -v $DIR/../../fuego-core:/fuego-core:ro \
     -e http_proxy=${http_proxy} \
     -e https_proxy=${https_proxy:-$http_proxy} \
+    -e UID=${uid} \
+    -e GID=${gid} \
     --net="host" ${DOCKERIMAGE} || \
     echo "Could not create fuego-container. See error messages."

-------------------

I can send the patch tomorrow if you wish.

Thanks

--
Guilherme


On Wed, Jan 31, 2018 at 10:50 PM, <Tim.Bird at sony.com> wrote:

>
>
> > -----Original Message-----
> > From Tim.Bird at sony.com
> >
> > OK - I tried this, using my fuego-clean-install.sh script, and got the
> following
> > result:
> >
> > %% in front of lines from my test script:
> > ...
> > Step 28/29 : COPY setup/entrypoint.sh /
> >  ---> 9afcd663976c
> > Removing intermediate container 9f4e60feccc1
> > Step 29/29 : ENTRYPOINT /entrypoint.sh
> >  ---> Running in 886672f5f6e4
> >  ---> 4a7cf228d727
> > Removing intermediate container 886672f5f6e4
> > [Warning] One or more build-args [http_proxy https_proxy] were not
> > consumed
> > Successfully built 4a7cf228d727
> > Successfully tagged fuego-131:latest
> > %%+ cd fuego-host-scripts
> > %%+ ./docker-create-usb-privileged-container.sh fuego-131 fuego-131-
> > container
> > %%b5f33ad097df02131acd8765423a7a54fd6fb553f23bc86f136bcc165091d85f
> > %%+ cd ../..
> > %%+ sudo service netperf stop
> > %% * Stopping network benchmark server
> > [fail]
> > %%+ set +x
> > %%After the container starts, run
> > %%    'fuego-finish-install.sh fuego-131-container' to finish the
> installation
> > %%and start tests.
> > %%Also, You may want to edit ~/bin/fuego-start to use the
> > %%   container name: fuego-131-container
> > Starting Fuego container (fuego-131-container)
> > Remapping Fuego's jenkins uid=107 to uid=0...
> > usermod: UID '0' already exists
> > Please create Fuego docker container via docker-create-container.sh
> script
> > 1000072457 at tlinux:~/work/fuego/next-2018-01-31$
> >
> > -------
> > I'm going to try it manually to see if there something about my test
> script
> > that is causing the UID at the time the entrypoint.sh is called to be 0.
> >
> > I'm about to start work on refactoring this script with a sed line to
> hard-code
> > the host uid of the building user (or maybe read it from a configuration
> file
> > in /fuego-ro/conf.
> >
> > Let me know if you see something obvious that wrong with my startup
> > sequence.
>
> OK -  I figured this out.  It was my use of docker-create-usb-privileged-
> container.sh
> rather than docker-create-container.sh that was the culprit.
>
> I'm working on a system the will allow modification of this via a global
> configuration
> file, any time the container starts.  Hopefully I'll finish this today.
>  -- Tim
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linuxfoundation.org/pipermail/fuego/attachments/20180131/d9a45158/attachment.html>


More information about the Fuego mailing list