Nicholas Pesa
Nicholas Pesa

Reputation: 2196

jenkinsci docker install-plugins.sh fails build

I am trying to package the vanilla Jenkins image into Docker using this tutorial: https://github.com/jenkinsci/jenkinsfile-runner/blob/master/DOCKER.md Everything works until one of the last steps where the Dockerfile tries to run install-plugins.sh from a plugins.txt file that was just copeid into its own directory. This is the error I am getting when running docker build:

/usr/local/bin/install-plugins.sh: line 148: TEMP_ALREADY_INSTALLED: unbound variable
The command '/bin/sh -c /usr/local/bin/install-plugins.sh < /usr/share/jenkins/ref/plugins.txt' returned a non-zero code: 1

Here is my plugins.txt file:

pipeline-model-definition:latest

Just the one line.

I cannot seem to figure out what might fix this issue. I tried using the suggestion from this answer here: https://github.com/jenkinsci/docker/issues/348 but the command line spat out the exact same error as above. Any help is appreciated, thanks in advance.

Upvotes: 2

Views: 2471

Answers (1)

VonC
VonC

Reputation: 1324248

That variable was defined in plugins.sh (which is deprecated and supposed to be replaced by install-plugins.sh)

# the war includes a # of plugins, to make the build efficient filter out
# the plugins so we dont install 2x - there about 17!
if [ -d "$JENKINS_HOME" ]
then
    TEMP_ALREADY_INSTALLED=$JENKINS_HOME/preinstalled.plugins.$$.txt
else
    echo "ERROR $JENKINS_HOME not found"
    exit 1
fi

But it is not defined in install-plugins.sh, only used (in line 155)

Try and set TEMP_ALREADY_INSTALLED first, as shown above, before calling install-plugins.sh.

Upvotes: 2

Related Questions