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

codepipeline: construct should allow 'disableInboundStageTransitions' to be set #1649

Closed
jesterhazy opened this issue Jan 31, 2019 · 6 comments · Fixed by #19911
Closed

codepipeline: construct should allow 'disableInboundStageTransitions' to be set #1649

jesterhazy opened this issue Jan 31, 2019 · 6 comments · Fixed by #19911
Labels
@aws-cdk/aws-codepipeline Related to AWS CodePipeline effort/medium Medium work item – several days of effort feature/coverage-gap Gaps in CloudFormation coverage by L2 constructs feature-request A feature should be added or improved. p2

Comments

@jesterhazy
Copy link
Contributor

The codepipeline construct doesn't allow the disableInboundStageTransitions property to be set. This is useful for pipelines you want to run on a schedule or some other event rather than for every source change.

There is a workaround via the CfnPipeline, but it would be great if we could do this through the construct, either in the Pipeline construct, the individual Stage constructs, or both.

Workaround code is:

const cfnPipeline = pipeline.node.findChild('Resource') as codepipeline.CfnPipeline
cfnPipeline.propertyOverrides.disableInboundStageTransitions = [{
    reason: 'Pipeline is triggered by schedule not source changes',
    stageName: 'Source'
}]
@skinny85 skinny85 added @aws-cdk/aws-codepipeline Related to AWS CodePipeline gap labels Jan 31, 2019
@skinny85 skinny85 self-assigned this Aug 12, 2019
@skinny85
Copy link
Contributor

Still relevant.

@SomayaB SomayaB added feature-request A feature should be added or improved. and removed gap labels Nov 11, 2019
@skinny85 skinny85 added the effort/medium Medium work item – several days of effort label Feb 6, 2020
@skinny85 skinny85 added the p2 label Sep 11, 2020
@ericzbeard ericzbeard added the feature/coverage-gap Gaps in CloudFormation coverage by L2 constructs label Apr 20, 2021
@berenddeboer
Copy link
Contributor

berenddeboer commented May 27, 2021

The current way to add this override is:

    cfnPipeline.addPropertyOverride("DisableInboundStageTransitions", [{
      Reason: 'Pipeline is triggered by schedule not source changes',
      StageName: 'Source'
    }])

@paulrichards-provar
Copy link

Do you have a more complete example? When I try to use that code snippet it can't find a child called Resource on the pipeline construct.

const pipeline = new CdkPipeline(this, "SomePipeline", {...})
pipeline.node.findChild('Resource')

When running cdk synth I get a "No child with id: 'Resource'" error.

@berenddeboer
Copy link
Contributor

@paulrichards-provar that's exactly how it works for me. I'm assuming you are on the latest CDK. Perhaps you can come up with a small example that gives that error?

@paulrichards-provar
Copy link

I'm using cdk version 1.109.0 (build c647e38)

`import { Repository } from '@aws-cdk/aws-codecommit';
import { CodeCommitSourceAction } from "@aws-cdk/aws-codepipeline-actions";
import { Artifact, CfnPipeline } from '@aws-cdk/aws-codepipeline';
import { Construct, Stack, StackProps } from '@aws-cdk/core';
import { CdkPipeline, SimpleSynthAction } from '@aws-cdk/pipelines';

interface PipelineStackProps extends StackProps {
env: any
}

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

const cloudAssemblyArtifact = new Artifact();
const sourceArtifact = new Artifact();
const repoArn = `arn:aws:codecommit:${props.env.region}:${props.env.account}:SomeRepo`;


const pipeline = new CdkPipeline(this, "TestPipeline", {
  pipelineName: "TestPipeline",
  cloudAssemblyArtifact,
  sourceAction: new CodeCommitSourceAction({
    actionName: "PipelineSource",
    repository: Repository.fromRepositoryArn(
      this,
      "TestRepo",
      repoArn,
    ),
    branch: "main",
    output: sourceArtifact
  }),
  synthAction: SimpleSynthAction.standardNpmSynth({
    sourceArtifact,
    cloudAssemblyArtifact,
    buildCommand: "npm run build && npm test",
  }),
});

pipeline.node.findChild('Resource') as CfnPipeline;

}
}
`

jogold added a commit to jogold/aws-cdk that referenced this issue Apr 14, 2022
Add a `disableTransition` options to disable transition to a stage.

Closes aws#1649
@mergify mergify bot closed this as completed in #19911 Apr 14, 2022
mergify bot pushed a commit that referenced this issue Apr 14, 2022
Add a `transitionToEnabled` options to disable transition to a stage. A reason
can be optionally specified with `transitionDisabledReason`.

Closes #1649


----

### All Submissions:

* [x] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/master/CONTRIBUTING.md)

### Adding new Unconventional Dependencies:

* [ ] This PR adds new unconventional dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/master/CONTRIBUTING.md/#adding-new-unconventional-dependencies)

### New Features

* [x] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/master/INTEGRATION_TESTS.md)?
	* [x] Did you use `yarn integ` to deploy the infrastructure and generate the snapshot (i.e. `yarn integ` without `--dry-run`)?

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

StevePotter pushed a commit to StevePotter/aws-cdk that referenced this issue Apr 27, 2022
Add a `transitionToEnabled` options to disable transition to a stage. A reason
can be optionally specified with `transitionDisabledReason`.

Closes aws#1649


----

### All Submissions:

* [x] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/master/CONTRIBUTING.md)

### Adding new Unconventional Dependencies:

* [ ] This PR adds new unconventional dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/master/CONTRIBUTING.md/#adding-new-unconventional-dependencies)

### New Features

* [x] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/master/INTEGRATION_TESTS.md)?
	* [x] Did you use `yarn integ` to deploy the infrastructure and generate the snapshot (i.e. `yarn integ` without `--dry-run`)?

*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/aws-codepipeline Related to AWS CodePipeline effort/medium Medium work item – several days of effort feature/coverage-gap Gaps in CloudFormation coverage by L2 constructs feature-request A feature should be added or improved. p2
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants