samle jules.yaml file:
sealId: 222222
node: java-11 && maven-3
baseVersion: 1.0.0
aws:
endpointType: codedeploy
appspec:
mapping:
- name: master
awsDeployment:
- env: dev
accountId: '122121212'
regions:
- region: us-east-1
codedeploy:
- application: cdp-agent-codedeploy
deploymentGroup: cdp-agent-codedeploy-gp
I need to replace application and deployment group with different value. I tried like below but no luck
my Jenkins file code:
julesnew = readYaml file: "jules.yml"
julesnew.mapping[0].awsDeployment.env[0].regions[0].codedeploy.deploymentGroup ="new-deploymentgroup"
writeYaml file: 'juels-new.yaml', data: julesnew
sh "cat juels-new.yaml"
Please guide me.
Your procedure is correct, but you need to properly navigate the original YAML structure . I think you need
julesnew.mapping[0].awsDeployment[0].regions[0].codedeploy[0].deploymentGroup = "new-deploymentgroup"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.