Skip to content

Instantly share code, notes, and snippets.

@kpucynski
Last active May 12, 2020 11:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kpucynski/e2a1db6590e390ebf9832a0205ffb681 to your computer and use it in GitHub Desktop.
Save kpucynski/e2a1db6590e390ebf9832a0205ffb681 to your computer and use it in GitHub Desktop.

Jenkins S3 plugin configuration with Helm

If you will want to add Jenkins S3 plugin (or any other plugin) to your Jenkins Configuration as Code deployment you may hit 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
  initScripts:
  #  - |
  #    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 (it.name != new_name) { new_profiles.push(it) } }
      new_profiles.push(profile)

Follow up:

https://issues.jenkins-ci.org/browse/JENKINS-55595

jenkinsci/s3-plugin#118

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment