(pipelines): Using CodeBuildStep.exportedVariable causes 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...
- Dominant language
- TypeScript
- Stars
- 12.9k
- Forks
- 4.6k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 83
Description
### What is the problem?
`CodeBuildStep.exportedVariable` does not seem to work as expected.
### Reproduction Steps
See https://github.com/aws/aws-cdk/pull/19156
```ts
const producer = new cdkp.CodeBuildStep('Produce', {
commands: ['export MY_VAR=hello'],
});
const consumer2 = new cdkp.CodeBuildStep('Consume2', {
buildEnvironment: {
environmentVariables: {
'THE_VAR': {
type: codebuild.BuildEnvironmentVariableType.PLAINTEXT,
value: step.exportedVariable('MY_VAR'),
},
}
},
commands: [
'echo "The variable was: $THE_VAR"',
],
});
```
### What did you expect to happen?
The variable would be referred properly.
### What actually happened?
```text
@aws-cdk/pipelines: Resolution error: Resolution error: Resolution error: Resolution error: Resolution 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...
@aws-cdk/pipelines: Object creation stack:
@aws-cdk/pipelines: at Execute again with CDK_DEBUG=true to capture stack traces.
@aws-cdk/pipelines: Object creation stack:
@aws-cdk/pipelines: at Execute again with CDK_DEBUG=true to capture stack traces..
@aws-cdk/pipelines: 105 | public resolve(_context: IResolveContext) {
@aws-cdk/pipelines: 106 | if (this.resolution === undefined) {
@aws-cdk/pipelines: > 107 | throw new Error(`Output for step ${this.step} not configured. Either the step is not in the pipeline, or this engine does not support Outputs for this step.`);
@aws-cdk/pipelines: | ^
@aws-cdk/pipelines: 108 | }
@aws-cdk/pipelines: 109 | return this.resolution;
@aws-cdk/pipelines: 110 | }
```
### CDK CLI Version
2.15.0 (build 151055e)
### Framework Version
_No response_
### Node.js Version
16
### OS
macOS
### Language
Typescript
### Language Version
4.4.4
### Other information
_No response_
Contributor guide
Research direction
Start with the CodeBuildStep.exportedVariable entry point and the reproduced Produce/Consume2 pipeline configuration. Trace how the exported variable is resolved and how the CodeBuildStep output is configured, then verify the example no longer raises the reported resolution error and that THE_VAR receives the exported value.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, typescript
- Domain
- ci-cd, devops
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100