Hello, This ticket is to request a new release of the plugin with the current master branch's latest code. Recently there was a pull-request merged to catch unknown exceptions from AWS SDK. This has successfully fixed a bug I have been experiencing when the AWS SDK cannot resolve credentials correctly, causing the plugin & jenkins to crash. I built the latest plugin code, and tested the same scenario (a jcasc file with a ${foobar-secret}, and no proper AWS configuration), only changing the plugin between the old release and a new build. With the new build, Jenkins no longer crashes if the AWS SDK throws an exception about not being able to find configuration. With the current release I would get this error and Jenkins would stop:
com.amazonaws.SdkClientException: Unable to find a region via the region provider chain. Must provide an explicit region in the builder or setup environment to supply a region.
at com.amazonaws.client.builder.AwsClientBuilder.setRegion(AwsClientBuilder.java:462)
at com.amazonaws.client.builder.AwsClientBuilder.configureMutableProperties(AwsClientBuilder.java:424)
at com.amazonaws.client.builder.AwsSyncClientBuilder.build(AwsSyncClientBuilder.java:46)
at com.bambora.jenkins.plugin.casc.secrets.ssm.AwsSsmSecretSource.getClient(AwsSsmSecretSource.java:48)
at com.bambora.jenkins.plugin.casc.secrets.ssm.AwsSsmSecretSource.reveal(AwsSsmSecretSource.java:34)
But with a build of the latest code, I get the following:
2020-02-14 06:20:43.670+0000 [id=28] SEVERE c.b.j.p.c.s.s.AwsSsmSecretSource#reveal: Error building sdk: foobar-secret
com.amazonaws.SdkClientException: Unable to find a region via the region provider chain. Must provide an explicit region in the builder or setup environment to supply a region.
at com.amazonaws.client.builder.AwsClientBuilder.setRegion(AwsClientBuilder.java:462)
at com.amazonaws.client.builder.AwsClientBuilder.configureMutableProperties(AwsClientBuilder.java:424)
at com.amazonaws.client.builder.AwsSyncClientBuilder.build(AwsSyncClientBuilder.java:46)
at com.bambora.jenkins.plugin.casc.secrets.ssm.AwsSsmSecretSource.getClient(AwsSsmSecretSource.java:52)
at com.bambora.jenkins.plugin.casc.secrets.ssm.AwsSsmSecretSource.reveal(AwsSsmSecretSource.java:35)
2020-02-14 06:20:43.683+0000 [id=28] WARNING i.j.p.casc.SecretSourceResolver#handleUndefinedVariable: Configuration import: Found unresolved variable foobar-secret. Will default to empty string
It is correctly catching the exception and Jenkins does not die. I find this fix very useful as it allows me to use Jenkins with the plugin installed and while using variables in JCasC, without needing proper AWS credentials set up. |