Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(pipelines): no way to set "synth" action environment variables #12061

Closed
pgarbe opened this issue Dec 14, 2020 · 1 comment · Fixed by #12602
Closed

(pipelines): no way to set "synth" action environment variables #12061

pgarbe opened this issue Dec 14, 2020 · 1 comment · Fixed by #12602
Assignees
Labels
@aws-cdk/pipelines CDK Pipelines library bug This issue is a bug. effort/small Small work item – less than a day of effort p1

Comments

@pgarbe
Copy link
Contributor

pgarbe commented Dec 14, 2020

When using the standardYarnSynth (or npm) action in a CodePipeline it allows me to define environment variables in two places. One is as part of the standardYarnSynth props and the second is part of the environment property. This makes sense as the first should generate the environment variables in the CodePieline action and the second in the CodeBuild project.

But it doesn't matter where I define my variable it always ends as part of the Codebuild project. And this is a problem as some values (like exuction id) can't re resolved within a CodeBuild project but only within a CodePipeline action.

Reproduction Steps

    const synthAction = pipelines.SimpleSynthAction.standardYarnSynth({

      environment: {
        environmentVariables: {
          VERSION_IN: { value: codepipeline.GlobalVariables.executionId },
        },
        buildImage: codebuild.LinuxBuildImage.STANDARD_4_0,
        privileged: true,
      },
      environmentVariables: {
        VERSION_OUT: { value: codepipeline.GlobalVariables.executionId },
      },
      sourceArtifact: sourceArtifact,
      cloudAssemblyArtifact,
      buildCommand: 'yarn build',
    });

What did you expect to happen?

I'd have expected to have "VERSION_IN" as part of the CodeBuild and "VERSION_OUT" as part of the CodePipeline action.

What actually happened?

The sample code above creates a CodeBuild action with two environment variables. But CodeBuild can't resolve these variables.

Environment

  • CDK CLI Version : 1.76.0
  • Framework Version:
  • Node.js Version: 15.3.0
  • OS : macOS BigSur (11.0.1)
  • Language (Version): TypeScript (3.9.5)

This is 🐛 Bug Report

@pgarbe pgarbe added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Dec 14, 2020
@github-actions github-actions bot added the @aws-cdk/pipelines CDK Pipelines library label Dec 14, 2020
@rix0rrr rix0rrr changed the title (pipelines): synth actions doesn't differentiate environment variables (pipelines): no way to set "synth" action environment variables Dec 14, 2020
@rix0rrr rix0rrr added effort/small Small work item – less than a day of effort p1 labels Dec 14, 2020
@SomayaB SomayaB removed the needs-triage This issue or PR still needs to be triaged. label Dec 14, 2020
pgarbe pushed a commit to pgarbe/aws-cdk that referenced this issue Jan 19, 2021
@mergify mergify bot closed this as completed in #12602 Jan 25, 2021
mergify bot pushed a commit that referenced this issue Jan 25, 2021
… variables (#12602)

Fixes #12061
Fixes #11178

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
@github-actions
Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/pipelines CDK Pipelines library bug This issue is a bug. effort/small Small work item – less than a day of effort p1
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants