File tree 2 files changed +27
-0
lines changed
packages/@aws-cdk/pipelines/lib/codepipeline 2 files changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -234,6 +234,20 @@ export class CodeBuildStep extends ShellStep {
234
234
* it finishes its `post_build` phase.
235
235
*
236
236
* @param variableName the name of the variable for reference.
237
+ * @example
238
+ * // Access the output of one CodeBuildStep in another CodeBuildStep
239
+ * declare const pipeline: pipelines.CodePipeline;
240
+ *
241
+ * const step1 = new pipelines.CodeBuildStep('Step1', {
242
+ * commands: ['export MY_VAR=hello'],
243
+ * });
244
+ *
245
+ * const step2 = new pipelines.CodeBuildStep('Step2', {
246
+ * env: {
247
+ * IMPORTED_VAR: step1.exportedVariable('MY_VAR'),
248
+ * },
249
+ * commands: ['echo $IMPORTED_VAR'],
250
+ * });
237
251
*/
238
252
public exportedVariable ( variableName : string ) : string {
239
253
if ( this . exportedVarsRendered && ! this . exportedVariables . has ( variableName ) ) {
Original file line number Diff line number Diff line change @@ -162,6 +162,19 @@ export abstract class CodePipelineSource extends Step implements ICodePipelineAc
162
162
* - `RegistryId`
163
163
*
164
164
* @see https://docs.aws.amazon.com/codepipeline/latest/userguide/reference-variables.html#reference-variables-list
165
+ * @example
166
+ * // Access the CommitId of a GitHub source in the synth
167
+ * const source = pipelines.CodePipelineSource.gitHub('owner/repo', 'main');
168
+ *
169
+ * const pipeline = new pipelines.CodePipeline(scope, 'MyPipeline', {
170
+ * synth: new pipelines.ShellStep('Synth', {
171
+ * input: source,
172
+ * commands: [],
173
+ * env: {
174
+ * 'COMMIT_ID': source.sourceAttribute('CommitId'),
175
+ * }
176
+ * })
177
+ * });
165
178
*/
166
179
public sourceAttribute ( name : string ) : string {
167
180
return makeCodePipelineOutput ( this , name ) ;
You can’t perform that action at this time.
0 commit comments