Skip to main content

Jenkins JCasC S3 plugin configuration with Helm

If you want to add Jenkins S3 plugin (or any other plugin) to your Jenkins Configuration as Code deployment you may hit a problem that the plugin cannot be configured easily using YAML.

In such case you can go with groovy init script. Just add them to your values.yaml, for example:

# List of groovy init scripts to be executed during Jenkins master start
#  - |
#    print 'adding global pipeline libraries, register properties, bootstrap jobs...'
  s3: |
    import jenkins.model.*
    import hudson.plugins.s3.*

    instance  = Jenkins.instance
    new_name  = "s3"
    accessKey = "access"
    secretKey = "secret"
    useRole   = false
    S3Profile profile = new S3Profile(new_name, accessKey, secretKey, useRole, 60, "", "", "", "", false);

    publisher = hudson.plugins.s3.S3BucketPublisher
    des       = new hudson.plugins.s3.S3BucketPublisher.DescriptorImpl();
    s3Plugin  = instance.getDescriptor(S3BucketPublisher.class);

    new_profiles = [];
    des.getProfiles().each { if ( != new_name) { new_profiles.push(it) } }

Follow ups: