Skip to content

(pipelines): CodeBuildStep.exportedVariable does not work: Output for step CodeBuildStep(Produce) not configured. Either the step is not in the pipeline, or this engine does not support Outputs for this step.. #19173

@markusl

Description

@markusl

What is the problem?

Using exportedVariable does not work when using it in a CodePipeline.

Reproduction Steps

Basically, using exportedVariable as an input for LambdaInvokeAction does not work and causes an error Output for step CodeBuildStep(Produce) not configured. Either the step is not in the pipeline, or this engine does not support Outputs for this step.. .

See https://github.com/aws/aws-cdk/pull/19156/files for a full code sample:

class TestLambdaAction extends cdkp.Step implements cdkp.ICodePipelineActionFactory {
  constructor (
    private readonly scope: Construct,
    id: string,
    private readonly userParameters?: { [key: string]: any }) {
    super(id);
  }

  public produceAction (stage: codePipeline.IStage, _options: cdkp.ProduceActionOptions): cdkp.CodePipelineActionFactoryResult {
    const lambdaPrefix = `arn:aws:lambda:${Stack.of(this.scope).region}:${Stack.of(this.scope).account}`;
    const lambdaf = lambda.Function.fromFunctionArn(this.scope, 'Lambda', `${lambdaPrefix}:function:TestLambda`);
    stage.addAction(new actions.LambdaInvokeAction({
      actionName: 'TestAction',
      lambda: lambdaf,
      userParameters: this.userParameters,
    }));
    return { runOrdersConsumed: 1 };
  }
}
  const producer = new cdkp.CodeBuildStep('Produce', {
    commands: ['export MY_VAR=hello'],
  });

  const consumer = new TestLambdaAction(pipelineStack, 'TestLambda', {
    THE_VAR: producer.exportedVariable('MY_VAR'),
  });

What did you expect to happen?

I would expect to be able to use output in a pipeline step as an input for another pipeline step.

What actually happened?

Error Output for step CodeBuildStep(Produce) not configured. Either the step is not in the pipeline, or this engine does not support Outputs for this step.. .

CDK CLI Version

2.14.0

Framework Version

No response

Node.js Version

14

OS

macOS

Language

Typescript

Language Version

4

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    @aws-cdk/pipelinesCDK Pipelines librarybugThis issue is a bug.cause/not-a-bugNot a bug (might still be a documentation issue, might still need work)effort/smallSmall work item – less than a day of effortp2

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions