Make Jenkinsfile work in https://ci.jenkins.io/job/Packaging/job/docker
diff --git a/tests/functions.bats b/tests/functions.bats
index b89de8c..9847f5a 100644
--- a/tests/functions.bats
+++ b/tests/functions.bats
@@ -14,18 +14,18 @@
}
@test "versionLT" {
- run docker run -ti --rm $SUT_IMAGE bash -c "source /usr/local/bin/jenkins-support && versionLT 1.0 1.0"
+ run docker run --rm $SUT_IMAGE bash -c "source /usr/local/bin/jenkins-support && versionLT 1.0 1.0"
assert_failure
- run docker run -ti --rm $SUT_IMAGE bash -c "source /usr/local/bin/jenkins-support && versionLT 1.0 1.1"
+ run docker run --rm $SUT_IMAGE bash -c "source /usr/local/bin/jenkins-support && versionLT 1.0 1.1"
assert_success
- run docker run -ti --rm $SUT_IMAGE bash -c "source /usr/local/bin/jenkins-support && versionLT 1.1 1.0"
+ run docker run --rm $SUT_IMAGE bash -c "source /usr/local/bin/jenkins-support && versionLT 1.1 1.0"
assert_failure
- run docker run -ti --rm $SUT_IMAGE bash -c "source /usr/local/bin/jenkins-support && versionLT 1.0-beta-1 1.0"
+ run docker run --rm $SUT_IMAGE bash -c "source /usr/local/bin/jenkins-support && versionLT 1.0-beta-1 1.0"
assert_success
- run docker run -ti --rm $SUT_IMAGE bash -c "source /usr/local/bin/jenkins-support && versionLT 1.0 1.0-beta-1"
+ run docker run --rm $SUT_IMAGE bash -c "source /usr/local/bin/jenkins-support && versionLT 1.0 1.0-beta-1"
assert_failure
- run docker run -ti --rm $SUT_IMAGE bash -c "source /usr/local/bin/jenkins-support && versionLT 1.0-alpha-1 1.0-beta-1"
+ run docker run --rm $SUT_IMAGE bash -c "source /usr/local/bin/jenkins-support && versionLT 1.0-alpha-1 1.0-beta-1"
assert_success
- run docker run -ti --rm $SUT_IMAGE bash -c "source /usr/local/bin/jenkins-support && versionLT 1.0-beta-1 1.0-alpha-1"
+ run docker run --rm $SUT_IMAGE bash -c "source /usr/local/bin/jenkins-support && versionLT 1.0-beta-1 1.0-alpha-1"
assert_failure
}
diff --git a/tests/install-plugins.bats b/tests/install-plugins.bats
index e89758c..ffde661 100644
--- a/tests/install-plugins.bats
+++ b/tests/install-plugins.bats
@@ -15,7 +15,7 @@
run docker build -t $SUT_IMAGE-plugins $BATS_TEST_DIRNAME/plugins
assert_success
# replace DOS line endings \r\n
- run bash -c "docker run -ti --rm $SUT_IMAGE-plugins ls --color=never -1 /var/jenkins_home/plugins | tr -d '\r'"
+ run bash -c "docker run --rm $SUT_IMAGE-plugins ls --color=never -1 /var/jenkins_home/plugins | tr -d '\r'"
assert_success
assert_line 'maven-plugin.jpi'
assert_line 'maven-plugin.jpi.pinned'
@@ -28,7 +28,7 @@
assert_success
refute_line --partial 'Skipping already bundled dependency'
# replace DOS line endings \r\n
- run bash -c "docker run -ti --rm $SUT_IMAGE-install-plugins ls --color=never -1 /var/jenkins_home/plugins | tr -d '\r'"
+ run bash -c "docker run --rm $SUT_IMAGE-install-plugins ls --color=never -1 /var/jenkins_home/plugins | tr -d '\r'"
assert_success
assert_line 'maven-plugin.jpi'
assert_line 'maven-plugin.jpi.pinned'
@@ -54,7 +54,7 @@
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'"
+ 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
assert_line 'Plugin-Version: 2.13'
}
@@ -64,8 +64,9 @@
run docker build -t $SUT_IMAGE-install-plugins $BATS_TEST_DIRNAME/install-plugins
assert_success
local work; work="$BATS_TEST_DIRNAME/upgrade-plugins/work"
+ mkdir -p $work
# Image contains maven-plugin 2.7.1 and ant-plugin 1.3
- run bash -c "docker run -ti -v $work:/var/jenkins_home --rm $SUT_IMAGE-install-plugins true"
+ run bash -c "docker run -u $UID -v $work:/var/jenkins_home --rm $SUT_IMAGE-install-plugins true"
assert_success
run bash -c "unzip -p $work/plugins/maven-plugin.jpi META-INF/MANIFEST.MF | tr -d '\r'"
assert_line 'Plugin-Version: 2.7.1'
@@ -76,7 +77,7 @@
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
- run bash -c "docker run -ti -v $work:/var/jenkins_home --rm $SUT_IMAGE-upgrade-plugins true"
+ run bash -c "docker run -u $UID -v $work:/var/jenkins_home --rm $SUT_IMAGE-upgrade-plugins true"
assert_success
run bash -c "unzip -p $work/plugins/maven-plugin.jpi META-INF/MANIFEST.MF | tr -d '\r'"
assert_success
@@ -95,15 +96,16 @@
run docker build -t $SUT_IMAGE-install-plugins $BATS_TEST_DIRNAME/install-plugins
assert_success
local work; work="$BATS_TEST_DIRNAME/upgrade-plugins/work"
+ mkdir -p $work
# Image contains maven-plugin 2.7.1 and ant-plugin 1.3
- run bash -c "docker run -ti -v $work:/var/jenkins_home --rm $SUT_IMAGE-install-plugins curl --connect-timeout 5 --retry 5 --retry-delay 0 --retry-max-time 60 -s -f -L https://updates.jenkins.io/download/plugins/maven-plugin/2.12.1/maven-plugin.hpi -o /var/jenkins_home/plugins/maven-plugin.jpi"
+ run bash -c "docker run -u $UID -v $work:/var/jenkins_home --rm $SUT_IMAGE-install-plugins curl --connect-timeout 5 --retry 5 --retry-delay 0 --retry-max-time 60 -s -f -L https://updates.jenkins.io/download/plugins/maven-plugin/2.12.1/maven-plugin.hpi -o /var/jenkins_home/plugins/maven-plugin.jpi"
assert_success
run bash -c "unzip -p $work/plugins/maven-plugin.jpi META-INF/MANIFEST.MF | tr -d '\r'"
assert_line 'Plugin-Version: 2.12.1'
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
- run bash -c "docker run -ti -v $work:/var/jenkins_home --rm $SUT_IMAGE-upgrade-plugins true"
+ run bash -c "docker run -u $UID -v $work:/var/jenkins_home --rm $SUT_IMAGE-upgrade-plugins true"
assert_success
run bash -c "unzip -p $work/plugins/maven-plugin.jpi META-INF/MANIFEST.MF | tr -d '\r'"
assert_success
diff --git a/tests/runtime.bats b/tests/runtime.bats
index 6b3da88..e0baac1 100644
--- a/tests/runtime.bats
+++ b/tests/runtime.bats
@@ -20,14 +20,14 @@
# running --help --version should return the version, not the help
local version=$(grep 'ENV JENKINS_VERSION' Dockerfile | sed -e 's/.*:-\(.*\)}/\1/')
# need the last line of output
- assert "${version}" docker run --rm -ti -e JENKINS_OPTS="--help --version" --name $SUT_CONTAINER -P $SUT_IMAGE | tail -n 1
+ assert "${version}" docker run --rm -e JENKINS_OPTS="--help --version" --name $SUT_CONTAINER -P $SUT_IMAGE | tail -n 1
}
@test "test jenkins arguments" {
# running --help --version should return the version, not the help
local version=$(grep 'ENV JENKINS_VERSION' Dockerfile | sed -e 's/.*:-\(.*\)}/\1/')
# need the last line of output
- assert "${version}" docker run --rm -ti --name $SUT_CONTAINER -P $SUT_IMAGE --help --version | tail -n 1
+ assert "${version}" docker run --rm --name $SUT_CONTAINER -P $SUT_IMAGE --help --version | tail -n 1
}
@test "create test container" {