Install plugins even when they already exist in a different version (#323)
diff --git a/install-plugins.sh b/install-plugins.sh
index a83e611..30bc640 100755
--- a/install-plugins.sh
+++ b/install-plugins.sh
Binary files differ
diff --git a/tests/install-plugins/update/Dockerfile b/tests/install-plugins/update/Dockerfile
new file mode 100644
index 0000000..c088223
--- /dev/null
+++ b/tests/install-plugins/update/Dockerfile
@@ -0,0 +1,3 @@
+FROM bats-jenkins-install-plugins
+
+RUN /usr/local/bin/install-plugins.sh maven-plugin:2.13 ant:1.3
diff --git a/tests/tests.bats b/tests/tests.bats
index 7cdbb5d..3fcea46 100644
--- a/tests/tests.bats
+++ b/tests/tests.bats
@@ -88,11 +88,23 @@
assert_line 'mailer.jpi.pinned'
}
+@test "plugins are installed with install-plugins.sh even when already exist" {
+ run docker build -t $SUT_IMAGE-install-plugins-update --no-cache $BATS_TEST_DIRNAME/install-plugins/update
+ assert_success
+ assert_line "Using provided plugin: ant"
+ refute_line --partial 'Skipping already bundled dependency'
+ # replace DOS line endings \r\n
+ run bash -c "docker run -ti --rm $SUT_IMAGE-install-plugins-update unzip -p /var/jenkins_home/plugins/maven-plugin.jpi META-INF/MANIFEST.MF | tr -d '\r'"
+ assert_success
+ assert_line 'Plugin-Version: 2.13'
+}
+
@test "clean test containers" {
cleanup $SUT_CONTAINER
}
@test "plugins are getting upgraded but not downgraded" {
+ # Initial execution
run docker build -t $SUT_IMAGE-install-plugins $BATS_TEST_DIRNAME/install-plugins
assert_success
local work; work="$BATS_TEST_DIRNAME/upgrade-plugins/work"
@@ -103,6 +115,8 @@
assert_line 'Plugin-Version: 2.7.1'
run bash -c "unzip -p $work/plugins/ant.jpi META-INF/MANIFEST.MF | tr -d '\r'"
assert_line 'Plugin-Version: 1.3'
+
+ # Upgrade to new image with different plugins
run docker build -t $SUT_IMAGE-upgrade-plugins $BATS_TEST_DIRNAME/upgrade-plugins
assert_success
# Images contains maven-plugin 2.13 and ant-plugin 1.2