Jenkins Job Builder Wrappers Not Being Realized

430 Views Asked by At

I'm trying to get a simple example going with Jenkins Job Builder but the wrappers I set on my job template don't appear on the jobs. Example:

- job-template:
name: 'test_{stage}'
project: test
scm:
  - '{stage}'
builders:
  - shell: /bin/bash '{stage}'
triggers:
  - pollscm:
      cron: '@yearly'
wrappers:
  - timeout:
      timeout: 150
      timeout-var: BUILD_TIMEOUT
      type: absolute
  - timestamps
  - credentials-binding:
    - username-password-separated:
        credential-id: gem_userpass
        username: GEM_USERNAME
        password: GEM_PASSWORD
  - credentials-binding:
    - amazon-web-services:
        credential-id: NOT_A_REAL_AWS_ACCESS_KEY
        access-key: AWS_ACCESS_KEY_ID
        secret-key: AWS_SECRET_ACCESS_KEY
  - rbenv:
      ruby_version: 2.1.5
      preinstall-gem-list: "bundler,rake"
publishers:
  - stash-notifier

(if SO mangles the yaml indenting, sorry; it's fine on my end)

I define two stages, "precommit" and "default". The jobs "test_precommit" and "test_default" are created with the correct scm, build steps, trigger, and publisher, but no wrappers are enabled or configured in the "Build Environment" section.

The Credentials Plugin, Credentials Binding Plugin, AWS Credentials Plugin, and rbenv plugin are all installed and at the latest version.

Jenkins Job Builder shows no errors when creating/updating the jobs.

1

There are 1 best solutions below

0
On

Turns out this issue was at least part of the problem. Resolving the ruby-runtime plugin's version now has the timeout and credentials bindings checked/configured in the job.

Important note: What it didn't solve was the rbenv wrapper; the job XML on the Jenkins server has the correct buildWrappers, including the ruby-proxy-object (which has the configured ruby version, not the default) but the job in the UI does not. Will update answer if I find it.