I have a python script using boto3 to create a instance on AWS and I'm using Jenkinsfile to automate it. In the Jenkinsfile I defined some parameters to put the information that we want. And I want that my python script capture those values in the value field.
Is there a module that allow me to get those values from Jenkinsfile or is there a way to call them?
Jenkinsfile:
parameters {
string(name: 'INSTANCETYPE', defaultValue: 't2.micro', description: 'e.g. t2.micro')
string(name: 'PR', defaultValue: '', description: 'Project')
string(name: 'OWNER', defaultValue: '', description: 'Owner for instance')
string(name: 'OS', defaultValue: '', description: 'Operative System e.g REDHAT')
}
test.py
ec2.create_tags(
Resources=[
instances[0].id,
],
Tags=[
{
'Key': 'Instance',
'Value': 'INSTANCETYPE'
},
{
'Key': 'PR',
'Value': 'PR'
},
{
'Key': 'Owner_Instance',
'Value': 'OWNER'
},
{
'Key': 'Operative_System',
'Value': 'OS'
},
]
)