forked from jenkinsci/docker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
plugins.sh
executable file
·28 lines (23 loc) · 861 Bytes
/
plugins.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#! /bin/bash
# Parse a support-core plugin -style txt file as specification for jenkins plugins to be installed
# in the reference directory, so user can define a derived Docker image with just :
#
# FROM jenkins
# COPY plugins.txt /plugins.txt
# RUN /usr/local/bin/plugins.sh /plugins.txt
#
set -e
REF=/usr/share/jenkins/ref/plugins
mkdir -p $REF
while read spec || [ -n "$spec" ]; do
plugin=(${spec//:/ });
[[ ${plugin[0]} =~ ^# ]] && continue
[[ ${plugin[0]} =~ ^\s*$ ]] && continue
[[ -z ${plugin[1]} ]] && plugin[1]="latest"
echo "Downloading ${plugin[0]}:${plugin[1]}"
if [ -z "$JENKINS_UC_DOWNLOAD" ]; then
JENKINS_UC_DOWNLOAD=$JENKINS_UC/download
fi
curl -sSL -f ${JENKINS_UC_DOWNLOAD}/plugins/${plugin[0]}/${plugin[1]}/${plugin[0]}.hpi -o $REF/${plugin[0]}.jpi
unzip -qqt $REF/${plugin[0]}.jpi
done < $1