Open dhc8 opened 6 years ago
What groovy script are you running in the "Execute system groovy script" step?
(If you can provide sufficient details to allow the bug to be reproduced outside your environment, it'll make it much easier to fix)
your script probably assumes some internal behaviour or exposed data. By nature, groovy scripts aren't stable between release as there's no way for plugin author to know which internal stuff may be used by scripts.
Script is set to Groovy script file
and executes a script present in the workspace containing this code:
import hudson.model.*
import java.net.*
def docker_host = ''
def host = ''
docker_host = build.buildVariableResolver.resolve("DOCKER_HOST").replaceFirst('tcp', 'http')
Looks like it's this last line that's failing
Hmm, sounds like resolve("DOCKER_HOST")
is returning null.
Are you 100% sure that DOCKER_HOST is a variable that should be available?
PS. Personally I avoid chaining multiple thing.thing.method().anotherMethod() calls together because it can then be unclear where (in the long line of multiple calls) the NPE came from. Groovy allows you to "def something=foo.bar" then "def somethingelse=bar.method()" etc so you can easily split a long line into multiple statements without having to have a mass of import statements. We got away with it in this case as there's only one "replaceFirst" method, so we can be fairly sure where it failed. PS again. I think "DOCKER_HOST" should be 'DOCKER_HOST' as you don't need a GString there.
"Expose DOCKER_HOST" is checked. It also works perfectly with version 1.1.1 of the docker plugin (both before upgrading to 1.1.3 and after downgrading again). It seems that something between 1.1.1 and 1.1.3 has made the DOCKER_HOST variable no longer available.
docker-plugin version: 1.1.3 (was not present on 1.1.1; downgrading resolves it again) jenkins version: 2.89.4 groovy plugin version: 2.0 docker engin version: 1.9.0
Execute system groovy script
step (which runs on master) will fail with the following stacktrace:Other potentially useful details: The following errors occur in Manage Old Data (with a type of
hudson.model.FreeStyleBuild
):