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

cdk-pipelines: deploy outputs not usable if only referenced from stack step #17272

Closed
bmmin opened this issue Nov 2, 2021 · 5 comments · Fixed by #17311
Closed

cdk-pipelines: deploy outputs not usable if only referenced from stack step #17272

bmmin opened this issue Nov 2, 2021 · 5 comments · Fixed by #17311
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

@bmmin
Copy link
Contributor

bmmin commented Nov 2, 2021

What is the problem?

When using deploy outputs in a shell script that is a stackStep, then the deploy action does not declare a namespace, as such the pipeline deployment fails with the following error:

2:40:31 PM | CREATE_FAILED        | AWS::CodePipeline::Pipeline | Pipeline9850B417
Valid format for a pipeline execution variable reference is a namespace and a key separated by a period (.). The following pipeline exe
cution variables are referencing a namespace that does not exist.
StageName=[stage], ActionName=[integTest], ActionConfigurationKey=[EnvironmentVariables], VariableReferenceText=[stage-app.out] (Servic
e: AWSCodePipeline; Status Code: 400; Error Code: InvalidActionDeclarationException; Request ID: 60b6cbb3-bf5d-49a9-9a4c-0e55be10397a;
Proxy: null)

Reproduction Steps

import { Repository } from "@aws-cdk/aws-codecommit";
import { CfnOutput, Construct, Stack, Stage } from "@aws-cdk/core";
import { CodePipeline, CodePipelineSource, ShellStep } from "@aws-cdk/pipelines";

export class PipelineStack extends Stack {
    constructor(scope: Construct, id: string) {
        super(scope, id);

        const repository = Repository.fromRepositoryName(this, "Repository", "repo");
        const codeSource = CodePipelineSource.codeCommit(repository, "main");

        const pipeline = new CodePipeline(this, "Pipeline", {
            synth: new ShellStep("Synth", {
                commands: [ "echo hi" ],
                input: codeSource,
            })
        });
        const stage = new AppStage(this, "stage");
        pipeline.addStage(stage, {
            stackSteps: [{
                stack: stage.stack,
                post: [new ShellStep("integTest", {
                    commands: [ "echo hi" ],
                    envFromCfnOutputs: { "INPUT": stage.stack.output },
                })]
            }]
        });
    }
}

class AppStage extends Stage {
    public readonly stack: AppStack;
    constructor(scope: Construct, id: string) {
        super(scope, id);
        this.stack = new AppStack(this, "app"); 
    }
}

class AppStack extends Stack {
    public readonly output: CfnOutput;
    constructor(scope: Construct, id: string) {
        super(scope, id);
        this.output = new CfnOutput(this, "out", { value: "hi" });
    }
}

What did you expect to happen?

no errors on deployment

What actually happened?

deployment fails, since the deploy step does not define a variable namespace for the pipeline

CDK CLI Version

1.130.0

Framework Version

No response

Node.js Version

v12.20.0

OS

Mac 10.15.7

Language

Typescript

Language Version

TS: 4.4.4

Other information

bug is in


it ignores the stackSteps

@bmmin bmmin added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Nov 2, 2021
@github-actions github-actions bot added the @aws-cdk/pipelines CDK Pipelines library label Nov 2, 2021
@bmmin
Copy link
Contributor Author

bmmin commented Nov 2, 2021

I wanted to send in a pull request, but the current source code fails on

@aws-cdk/aws-applicationautoscaling: FAIL test/schedule.test.js (11.287 s)
@aws-cdk/aws-applicationautoscaling: ● at › test using at with a specific Date
@aws-cdk/aws-applicationautoscaling: expect(received).toEqual(expected) // deep equality
@aws-cdk/aws-applicationautoscaling: Expected: "at(2021-11-26T00:00:00)"
@aws-cdk/aws-applicationautoscaling: Received: "at(2021-11-25T23:00:00)"
@aws-cdk/aws-applicationautoscaling: 66 | describe('at', () => {
@aws-cdk/aws-applicationautoscaling: 67 | test('test using at with a specific Date', () => {
@aws-cdk/aws-applicationautoscaling: > 68 | expect(appscaling.Schedule.at(new Date(2021, 10, 26)).expressionString).toEqual('at(2021-11-26T00:00:00)');
@aws-cdk/aws-applicationautoscaling: | ^
@aws-cdk/aws-applicationautoscaling: 69 | });
@aws-cdk/aws-applicationautoscaling: 70 | });
@aws-cdk/aws-applicationautoscaling: 71 |
@aws-cdk/aws-applicationautoscaling: at Object. (test/schedule.test.ts:68:77)

I assume it is related to the dst changes recently, but nothing to do with this issue.

@rix0rrr
Copy link
Contributor

rix0rrr commented Nov 2, 2021

Feel free to send in the PR nevertheless! (And don't forget to add a test)

Thanks!

@rix0rrr rix0rrr added effort/small Small work item – less than a day of effort p1 and removed needs-triage This issue or PR still needs to be triaged. labels Nov 2, 2021
@rix0rrr rix0rrr removed their assignment Nov 2, 2021
@bmmin
Copy link
Contributor Author

bmmin commented Nov 5, 2021

I did send a PR, is there anything else I need to follow up on?

@bmmin
Copy link
Contributor Author

bmmin commented Nov 11, 2021

@rix0rrr any other action needed from my side?

@mergify mergify bot closed this as completed in #17311 Nov 24, 2021
mergify bot pushed a commit that referenced this issue Nov 24, 2021

Unverified

This user has not yet uploaded their public signing key.
fixes #17272


----

*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.

beezly pushed a commit to beezly/aws-cdk that referenced this issue Nov 29, 2021

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
…17311)

fixes aws#17272


----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
TikiTDO pushed a commit to TikiTDO/aws-cdk that referenced this issue Feb 21, 2022

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
…17311)

fixes aws#17272


----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
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.

2 participants