Configure EC2 Plugin with Groovy

51 views
Skip to first unread message

John Mickey

unread,
Jan 20, 2017, 4:33:20 PM1/20/17
to Jenkins Users
I am trying to configure the EC2 Plugin via a Groovy script.  So far, it's been a complete failure.  Here is what I have so far:

I am trying to configure the Jenkins EC2-Plugin via Groovy. Plugin code: https://github.com/jenkinsci/ec2-plugin

I'm trying to setup the cloud with a name to get started

import hudson.model.*
import jenkins.model.*
import hudson.plugins.ec2.*
import com.amazonaws.services.ec2.model.*

SlaveTemplate awsTemplate = new SlaveTemplate(
  'ami-1234567',
  '',
  '',
  'sg-1234567',
  't2.micro',
  true,
  'foo',
  '',
  'stuff',
  'run code',
  '/var/tmp',
  'more code',
  '4',
  '',
  '',
  '',
  false,
  'subnet-1234567',
  '',
  '60',
  false,
  '',
  'iam-profile',
  false,
  false,
  '',
  false,
  '',
  true,
  false
)

def slaveTemplates = [awsTemplate]

def ec2Cloud = new AmazonEC2Cloud(
  'foo',
  true,
  '',
  'us-west-2',
  '',
  '10',
  slaveTemplates
)

def cloudList = Jenkins.instance.clouds
cloudList.add(ec2Cloud)

Any ideas?

These are the error messages

Error: Could not find matching constructor for: hudson.plugins.ec2.SlaveTemplate

or

Error: Could not find matching constructor for: hudson.plugins.ec2.AmazonEC2Cloud
Reply all
Reply to author
Forward
0 new messages