[Fuego] [PATCH] docker-container: allow user to override JENKINS_PORT

Tim.Bird at sony.com Tim.Bird at sony.com
Wed Feb 27 22:57:09 UTC 2019


Applied.  See comments below.

Thanks,
 -- Tim

> -----Original Message-----
> From: Daniel Sangorrin
> 
> Install.sh already supports specifying the port for Jenkins.
> That is useful when you want to install Fuego on a machine
> that is already using 8080.
> 
> Another use case is to install multiple instances of Fuego
> on the same machine. Creating one image per jenkins port
> is quite inefficient. Instead, we want to create a container
> for each port and override the Jenkins port.
> 
> This patch allows overriding the environment variable
> JENKINS_PORT, used by ftc or common.sh for example. However,
> it requires an extra step (modify jenkins configuration
> file) which needs to be done manually (see the script).
> 
> It would be nice to automatize that step with the parameter
> --entrypoint but I haven't been succesful yet.

This is where we had problems trying to get a pre-built image
for Fuego in the 1.3 release.  We ended up trying to do a whole bunch
of container customization in the --entrypoint routine, but things
kept breaking.  Maybe we'll figure it out this time around.

One idea I had is to have 'ftc' check for customizations, and do them
when it is run.  This is a bit tricky, as Jenkins might start before the
first invocation of 'ftc'.  Probably we'll need a separate customization
script to handle the port and other customized items.  It would be nice to read
the customizations from conf/fuego.conf, though, even if it's a different
script than 'ftc' that reads and applies them.

> 
> Signed-off-by: Daniel Sangorrin <daniel.sangorrin at toshiba.co.jp>
> ---
>  fuego-host-scripts/docker-create-container.sh | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/fuego-host-scripts/docker-create-container.sh b/fuego-host-
> scripts/docker-create-container.sh
> index b223861..97917c8 100755
> --- a/fuego-host-scripts/docker-create-container.sh
> +++ b/fuego-host-scripts/docker-create-container.sh
> @@ -1,12 +1,22 @@
>  #!/bin/bash
>  # $1 - name for the docker image (default: fuego)
>  # $2 - name for the docker container (default: fuego-container)
> +# $3 - overrides JENKINS_PORT env variable
> +#      Additionally you need to change the port on the config manually
> +#      docker# sed -i -e 's#8080#8082#g' /etc/default/jenkins
> +#      docker# service jenkins restart
> 
>  DIR=$(dirname $(realpath "${BASH_SOURCE[0]}"))
> 
>  DOCKERIMAGE=${1:-fuego}
>  DOCKERCONTAINER=${2:-fuego-container}
> 
> +if [ -z "${3}" ]; then
> +    JENKINS_PORT_ENV=""
> +else
> +    JENKINS_PORT_ENV="--env JENKINS_PORT=${3}"
> +fi
> +
>  if [ ! -d $DIR/../fuego-core ]; then
>     echo "You need to clone fuego-core at $DIR/../fuego-core"
>     exit 1
> @@ -19,5 +29,6 @@ sudo docker create -it --name ${DOCKERCONTAINER} \
>      -v $DIR/../fuego-ro:/fuego-ro:ro \
>      -v $DIR/../fuego-core:/fuego-core:ro \
>      --env no_proxy="$no_proxy" \
> +    $JENKINS_PORT_ENV \
>      --net="host" ${DOCKERIMAGE} || \
>      echo "Could not create fuego-container. See error messages."
> --
> 2.7.4
> 
> _______________________________________________
> Fuego mailing list
> Fuego at lists.linuxfoundation.org
> https://lists.linuxfoundation.org/mailman/listinfo/fuego


More information about the Fuego mailing list