Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-69505

withAWSParameterStore ignores naming param when namePrefixes is used

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • None
    • aws-parameter-store 1.2.2
      Jenkins 2.346

      Usecase:

      •  - user has dozens of AWS Parameters defined in /foo/bar/... e.g. /foo/bar/flibble, /foo/bar/flobble, /foo/bar/didntwantthisone and many others.
      •  - user only wants to pass two of them, /foo/bar/flibble and /foo/bar/flobble, into a build environment, and not all of the others (i.e. not /foo/bar/didntwantthisone)
      •  - user needs the environment variables to be named according to the "basename" naming option, i.e. FLIBBLE and FLOBBLE.

       

      Problem:

      As-is, if you pass in naming: 'basename', path: '/foo/bar/' then you get all the AWS parameters passed in, so while you get the two you did want, you also get DIDNTWANTTHISONE defined plus many others.

      If, you pass in naming: 'basename', path: '/foo/bar/', namePrefixes: 'flibble,flobble' then the code (silently!) ignores namePrefixes and behaves as above - while this is somewhat counterintuitive, it is working-as-documented.

      So, with all other options ruled out (and having now read the documentation!), we pass in naming: 'basename', namePrefixes: '/foo/bar/flibble,/foo/bar/flobble' with the expectation that it'll now work - we should get just FLIBBLE and FLOBBLE defined...

      ... except we get FOO_BAR_FLIBBLE and FOO_BAR_FLOBBLE defined because the code ignores the naming parameter (AwsParameterStoreService.java's toEnvironmentVariable(String) method seems to be the problem) and defaults to "absolute" behavior.

       

      TL;DR: naming should not be assumed to be "absolute" when namePrefixes is set.

            rikturnbull Rik Turnbull
            pjdarton pjdarton
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: