Merge branch 'master' into arch

This commit is contained in:
Carlos Sanchez 2017-12-17 11:33:54 +01:00
commit b79dc00ad1
7 changed files with 46 additions and 27 deletions

View File

@ -1,5 +1,4 @@
# DO NOT UPGRADE alpine until https://github.com/jenkinsci/docker/issues/508 is fixed
FROM openjdk:8u121-jdk-alpine
FROM openjdk:8-jdk-alpine
RUN apk add --no-cache git openssh-client curl unzip bash ttf-dejavu coreutils tini

4
Jenkinsfile vendored
View File

@ -1,8 +1,8 @@
#!/usr/bin/env groovy
properties([
buildDiscarder(logRotator(numToKeepStr: '5', artifactNumToKeepStr: '5')),
pipelineTriggers([cron('@daily')]),
buildDiscarder(logRotator(numToKeepStr: '50', artifactNumToKeepStr: '5')),
pipelineTriggers([cron('H H/6 * * *')]),
])
node('docker') {

View File

@ -151,7 +151,7 @@ COPY custom.groovy /usr/share/jenkins/ref/init.groovy.d/custom.groovy
## Preinstalling plugins
You can rely on the `install-plugins.sh` script to pass a set of plugins to download with their dependencies.
This script will perform downloads from update centers, an internet access is required for the default update centers.
This script will perform downloads from update centers, and internet access is required for the default update centers.
### Setting update centers

View File

@ -111,7 +111,7 @@ resolveDependencies() {
echo "Skipping optional dependency $plugin"
else
local pluginInstalled
if pluginInstalled="$(echo "${bundledPlugins}" | grep "^${plugin}:")"; then
if pluginInstalled="$(echo -e "${bundledPlugins}\n${installedPlugins}" | grep "^${plugin}:")"; then
pluginInstalled="${pluginInstalled//[$'\r']}"
local versionInstalled; versionInstalled=$(versionFromPlugin "${pluginInstalled}")
local minVersion; minVersion=$(versionFromPlugin "${d}")
@ -119,7 +119,7 @@ resolveDependencies() {
echo "Upgrading bundled dependency $d ($minVersion > $versionInstalled)"
download "$plugin" &
else
echo "Skipping already bundled dependency $d ($minVersion <= $versionInstalled)"
echo "Skipping already installed dependency $d ($minVersion <= $versionInstalled)"
fi
else
download "$plugin" &
@ -190,8 +190,14 @@ main() {
# Read plugins from stdin or from the command line arguments
if [[ ($# -eq 0) ]]; then
while read -r line; do
plugins+=("${line}")
while read -r line || [ "$line" != "" ]; do
# Remove leading/trailing spaces, comments, and empty lines
plugin=$(echo "${line}" | sed -e 's/^[ \t]*//g' -e 's/[ \t]*$//g' -e 's/[ \t]*#.*$//g' -e '/^[ \t]*$/d')
# Avoid adding empty plugin into array
if [ ${#plugin} -ne 0 ]; then
plugins+=("${plugin}")
fi
done
else
plugins=("$@")
@ -206,6 +212,9 @@ main() {
echo "Analyzing war..."
bundledPlugins="$(bundledPlugins)"
echo "Registering preinstalled plugins..."
installedPlugins="$(installedPlugins)"
# Check if there's a version-specific update center, which is the case for LTS versions
jenkinsVersion="$(jenkinsMajorMinorVersion)"
if curl -fsL -o /dev/null "$JENKINS_UC/$jenkinsVersion"; then

View File

@ -85,12 +85,7 @@ publish() {
build_opts=()
fi
local dir=war
# lts is in a different dir
if [[ "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
dir=war-stable
fi
sha=$(curl -q -fsSL "http://mirrors.jenkins.io/${dir}/${version}/jenkins.war.sha256" | cut -d' ' -f 1)
sha=$(curl -q -fsSL "https://repo.jenkins-ci.org/releases/org/jenkins-ci/main/jenkins-war/${version}/jenkins-war-${version}.war.sha256" )
docker build --file "Dockerfile$variant" \
--build-arg "JENKINS_VERSION=$version" \

View File

@ -26,7 +26,7 @@ SUT_IMAGE=$(sut_image)
@test "plugins are installed with install-plugins.sh" {
run docker_build_child $SUT_IMAGE-install-plugins $BATS_TEST_DIRNAME/install-plugins
assert_success
refute_line --partial 'Skipping already bundled dependency'
refute_line --partial 'Skipping already installed dependency'
# replace DOS line endings \r\n
run bash -c "docker run --rm $SUT_IMAGE-install-plugins ls --color=never -1 /var/jenkins_home/plugins | tr -d '\r'"
assert_success
@ -55,7 +55,7 @@ SUT_IMAGE=$(sut_image)
@test "plugins are installed with install-plugins.sh from a plugins file" {
run docker_build_child $SUT_IMAGE-install-plugins-pluginsfile $BATS_TEST_DIRNAME/install-plugins/pluginsfile
assert_success
refute_line --partial 'Skipping already bundled dependency'
refute_line --partial 'Skipping already installed dependency'
# replace DOS line endings \r\n
run bash -c "docker run --rm $SUT_IMAGE-install-plugins ls --color=never -1 /var/jenkins_home/plugins | tr -d '\r'"
assert_success
@ -84,8 +84,8 @@ SUT_IMAGE=$(sut_image)
@test "plugins are installed with install-plugins.sh even when already exist" {
run docker_build_child $SUT_IMAGE-install-plugins-update $BATS_TEST_DIRNAME/install-plugins/update --no-cache
assert_success
assert_line --partial 'Skipping already installed dependency javadoc'
assert_line "Using provided plugin: ant"
refute_line --partial 'Skipping already bundled dependency'
# replace DOS line endings \r\n
run bash -c "docker run --rm $SUT_IMAGE-install-plugins-update unzip -p /var/jenkins_home/plugins/maven-plugin.jpi META-INF/MANIFEST.MF | tr -d '\r'"
assert_success

View File

@ -1,5 +1,21 @@
# comment line should be skipped
# simple case
ant:1.3
# trailing spaces
maven-plugin:2.7.1
mesos:0.13.0
git:latest
filesystem_scm:experimental
# leading spaces
mesos:0.13.0
# leading spaces, and trailing spaces
git:latest
# with comments at the end
filesystem_scm:experimental # comment at the end
# empty line
#
# empty line