| Nicolas De Loof | acb8649 | 2014-10-24 13:43:13 +0200 | [diff] [blame] | 1 | #! /bin/bash | 
 | 2 |  | 
 | 3 | # Parse a support-core plugin -style txt file as specification for jenkins plugins to be installed | 
 | 4 | # in the reference directory, so user can define a derived Docker image with just : | 
| Nikolay Yurin | 390dc61 | 2015-04-20 14:46:29 +0300 | [diff] [blame] | 5 | # | 
| Nicolas De Loof | acb8649 | 2014-10-24 13:43:13 +0200 | [diff] [blame] | 6 | # FROM jenkins | 
 | 7 | # COPY plugins.txt /plugins.txt | 
| Justin Clayton | 8aec15c | 2015-01-23 12:19:02 -0800 | [diff] [blame] | 8 | # RUN /usr/local/bin/plugins.sh /plugins.txt | 
| Nikolay Yurin | 390dc61 | 2015-04-20 14:46:29 +0300 | [diff] [blame] | 9 | # | 
| Nicolas De Loof | acb8649 | 2014-10-24 13:43:13 +0200 | [diff] [blame] | 10 |  | 
| Jesse Glick | 9c8ddc4 | 2015-06-01 11:47:18 -0400 | [diff] [blame^] | 11 | set -e | 
 | 12 |  | 
| Nicolas De Loof | acb8649 | 2014-10-24 13:43:13 +0200 | [diff] [blame] | 13 | REF=/usr/share/jenkins/ref/plugins | 
 | 14 | mkdir -p $REF | 
 | 15 |  | 
| Carlos Sanchez | c0475fd | 2015-04-29 11:55:48 +0200 | [diff] [blame] | 16 | while read spec || [ -n "$spec" ]; do | 
| Nikolay Yurin | 390dc61 | 2015-04-20 14:46:29 +0300 | [diff] [blame] | 17 |     plugin=(${spec//:/ }); | 
| Manuel Prinz | dddb965 | 2015-02-21 13:03:29 +0100 | [diff] [blame] | 18 |     [[ ${plugin[0]} =~ ^# ]] && continue | 
 | 19 |     [[ ${plugin[0]} =~ ^\s*$ ]] && continue | 
| Nikolay Yurin | 390dc61 | 2015-04-20 14:46:29 +0300 | [diff] [blame] | 20 |     [[ -z ${plugin[1]} ]] && plugin[1]="latest" | 
 | 21 |     echo "Downloading ${plugin[0]}:${plugin[1]}" | 
| Jesse Glick | 9c8ddc4 | 2015-06-01 11:47:18 -0400 | [diff] [blame^] | 22 |     curl -s -L -f ${JENKINS_UC}/download/plugins/${plugin[0]}/${plugin[1]}/${plugin[0]}.hpi -o $REF/${plugin[0]}.jpi | 
| Nicolas De Loof | acb8649 | 2014-10-24 13:43:13 +0200 | [diff] [blame] | 23 | done  < $1 |