awslabs / aws-codepipeline-plugin-for-jenkins

Use this plugin to integrate your Jenkins project with a pipeline in AWS CodePipeline. For more information and step-by-step directions on how to install and configure this plugin, follow the Four Stage Pipeline Tutorial. http://docs.aws.amazon.com/codepipeline/latest/userguide/getting-started-4.html
Apache License 2.0
82 stars 68 forks source link

Read actionconfigurations of jobData and make it actionable in the job #45

Open anmolnehru opened 4 years ago

anmolnehru commented 4 years ago

Implement getData() method to grab the actionConfiguration of a job (https://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/com/amazonaws/services/codepipeline/model/JobData.html ).

==== Use case ==== I'd like to pass custom actionConfiguration via a customAction type from codepipeline and would like Jenkins to read that info and make it available to the job environment via an env variable or equivalent.

For example when creating the custom action I'd like to specify version of an artifact that the job should consume. So this should be encodable in the custom action type created by specifying in the actionConfiguration array like below (specifies aheversion)

"configurationProperties":[ { "name":"ProjectName", "required":true, "key":true, "secret":false, "queryable":true, "description":"Jenkins custom action for CICD", "type":"String" }, { "name":"AHEversion", "required":true, "key":true, "secret":false, "queryable":false, "description":"AHE version of the ZenobiaJob run", "type":"String" } ]

If this can be read and stored in an env var of the same name scripts can then access this custom data and do something useful. This will make the build parametrizable from the codepipeline stage itself. This will allow reuse of the same stage for triggering builds with different parameters.