如何在Jenkins Slave模板ec-2插件中修改IamInstanceProfile?

时间:2018-03-27 20:13:13

标签: jenkins amazon-ec2 groovy

我正在尝试修改Jenkins AWC EC-2插件从模板配置中的IamInstanceProfile,但它无法正常工作。

import hudson.model.*
import hudson.node_monitors.*
import hudson.slaves.*
import java.util.concurrent.*
import jenkins.model.*
import hudson.plugins.ec2.*
import com.amazonaws.services.ec2.model.*

jenkins = Hudson.instance
def now = new Date()
def instance = Jenkins.getInstance()
def clouds = instance.clouds
def temp=instance.clouds[0].getTemplates()[0]
println temp.getIamInstanceProfile()
def riRequest = new RunInstancesRequest()
riRequest.setIamInstanceProfile(new IamInstanceProfileSpecification().withArn(temp.getIamInstanceProfile()));
println riRequest
Jenkins.instance.save()

执行时没有任何错误,但没有更新IamInstanceProfile。

1 个答案:

答案 0 :(得分:0)