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

(aws-scheduler-targets-alpha): Add targets.CodePipelineStartPipelineExecution Target #27449

Closed
1 of 2 tasks
filletofish opened this issue Oct 9, 2023 · 1 comment · Fixed by #27799
Closed
1 of 2 tasks
Labels
@aws-cdk/aws-scheduler Related to the AWS Scheduler service @aws-cdk/aws-scheduler-targets Related to targets of the AWS Scheduler service effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p2

Comments

@filletofish
Copy link
Contributor

Describe the feature

Work to support L2 constructs for AWS Scheduler is in progress (#23394). See the approved RFC. RFC planned to add 12 templates targets, but only Lambda Invoke is currently implemented (#26575).

This issue tracks implementation of CodePipelineStartPipelineExecution target to start an AWS CodePipeline execution.

Use Case

Customers would like to use templated target CodePipelineStartPipelineExecution to be able to start AWS CodePipeline execution with AWS Scheduler. L2 target construct should grant required permissions to the AWS Scheduler to start the CodePipeline execution.

Proposed Solution

The proposed solution needs to be adopted to the recent examples of LambdaInvoke (https://github.com/aws/aws-cdk/blob/main/packages/%40aws-cdk/aws-scheduler-targets-alpha/lib/lambda-invoke.ts).

Solution should also include unit and integration tests.

export class CodePipelineStartPipelineExecution  extends ScheduleTargetBase implements IScheduleTarget {
    constructor(
      private readonly pipeline: codepipeline.IPipeline,
      private readonly props: ScheduleTargetBaseProps,
    ) {
      super(props, pipeline.pipelineArn);
    }

   protected addTargetActionToRole(schedule: ISchedule, role: IRole): void {
      // TODO: Check if target and schedule are in the same account and region
      // TODO: Check if target and role are in the same account

      // TODO: Check if L2 grant methods can be used      
      role.addToPrincipalPolicy(new iam.PolicyStatement({
        actions: ['codepipeline:StartPipelineExecution'],
        resources: [this.pipeline.pipelineArn],
      }));
    }
  }

Other Information

No response

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

CDK version used

2.99.1

Environment details (OS name and version, etc.)

MacOs

@filletofish filletofish added feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels Oct 9, 2023
@github-actions github-actions bot added the @aws-cdk/aws-codepipeline Related to AWS CodePipeline label Oct 9, 2023
@pahud pahud added p2 effort/medium Medium work item – several days of effort and removed needs-triage This issue or PR still needs to be triaged. labels Oct 9, 2023
@kaizencc kaizencc added @aws-cdk/aws-scheduler Related to the AWS Scheduler service @aws-cdk/aws-scheduler-targets Related to targets of the AWS Scheduler service and removed @aws-cdk/aws-codepipeline Related to AWS CodePipeline labels Oct 11, 2023
@mergify mergify bot closed this as completed in #27799 Dec 18, 2023
mergify bot pushed a commit that referenced this issue Dec 18, 2023
…7799)

Closes #27449

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
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/aws-scheduler Related to the AWS Scheduler service @aws-cdk/aws-scheduler-targets Related to targets of the AWS Scheduler service effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p2
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants