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

feat(pipelines): ECR source action #16385

Merged
merged 9 commits into from Feb 24, 2022
Merged

feat(pipelines): ECR source action #16385

merged 9 commits into from Feb 24, 2022

Conversation

alexpulver
Copy link
Contributor

Closes #16378


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@gitpod-io
Copy link

gitpod-io bot commented Sep 5, 2021

@alexpulver
Copy link
Contributor Author

I will need to rework the actionName definition, because / can appear in ECR repository name (namespace), and is not a valid character in CodePipeline action name.

@rix0rrr rix0rrr marked this pull request as ready for review September 7, 2021 12:29
rix0rrr
rix0rrr previously approved these changes Sep 7, 2021
@mergify mergify bot dismissed rix0rrr’s stale review September 7, 2021 12:30

Pull request has been modified.

@alexpulver
Copy link
Contributor Author

@rix0rrr I changed the code to handle the / namespace character by replacing it with _ character. I tested manually that const formattedRepositoryName = Fn.join('_', Fn.split('/', this.repository.repositoryName)); works on repositories with and without namespace, because I don't think it's possible to test without deploying the stack. Below are the snippets from the template I used for manual testing. Can you please let me know if it's acceptable from your perspective?

No namespace:

{
  "Resources": {
    "Repository22E53BBD": {
      "Type": "AWS::ECR::Repository"
    },
<snip>

With namespace:

{
  "Resources": {
    "Repository22E53BBD": {
      "Type": "AWS::ECR::Repository",
      "Properties": {
        "RepositoryName": "namespace/repo"
      }
    },
<snip>

Pipeline:

{
  "Resources": {
    <snip>
    "Pipeline9850B417": {
      "Type": "AWS::CodePipeline::Pipeline",
      "Properties": {
        "RoleArn": {
          "Fn::GetAtt": [
            "PipelineRoleB27FAA37",
            "Arn"
          ]
        },
        "Stages": [
          {
            "Actions": [
              {
                "InputArtifacts": [],
                "ActionTypeId": {
                  "Version": "1",
                  "Owner": "AWS",
                  "Category": "Source",
                  "Provider": "ECR"
                },
                "OutputArtifacts": [
                  {
                    "Name": "Source"
                  }
                ],
                "RunOrder": 1,
                "Configuration": {
                  "ImageTag": "latest",
                  "RepositoryName": {
                    "Ref": "Repository22E53BBD"
                  }
                },
                "Name": {
                  "Fn::Join": [
                    "_",
                    {
                      "Fn::Split": [
                        "/",
                        {
                          "Ref": "Repository22E53BBD"
                        }
                      ]
                    }
                  ]
                }
              }
            ],
            "Name": "Source"
          },
<snip>

@alexpulver
Copy link
Contributor Author

@rix0rrr would be glad to have your input on the above

@peterwoodworth peterwoodworth changed the title feat(pipelines): add ecr source action feat(pipelines): add ecr source action Oct 21, 2021
@github-actions github-actions bot added the @aws-cdk/aws-codepipeline Related to AWS CodePipeline label Oct 21, 2021
@peterwoodworth peterwoodworth added @aws-cdk/pipelines CDK Pipelines library and removed @aws-cdk/aws-codepipeline Related to AWS CodePipeline labels Oct 21, 2021
@peterwoodworth peterwoodworth assigned rix0rrr and unassigned skinny85 Oct 21, 2021
rix0rrr
rix0rrr previously approved these changes Oct 27, 2021
@rix0rrr rix0rrr changed the title feat(pipelines): add ecr source action feat(pipelines): ECR source action Oct 27, 2021
@mergify mergify bot dismissed rix0rrr’s stale review October 27, 2021 15:11

Pull request has been modified.

rix0rrr
rix0rrr previously approved these changes Oct 27, 2021
* const bucket: IBucket = ...
* CodePipelineSource.s3(bucket, {
* key: 'path/to/file.zip',
* import * as ecr from '@aws-cdk/aws-ecr';
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alexpulver : should the following comments have been modified ? I think they still apply to the s3 factory method.

@mergify mergify bot dismissed rix0rrr’s stale review February 24, 2022 13:53

Pull request has been modified.

@mergify
Copy link
Contributor

mergify bot commented Feb 24, 2022

Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject89A8053A-LhjRyN9kxr8o
  • Commit ID: 1761505
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@mergify mergify bot merged commit fc11ae2 into aws:master Feb 24, 2022
@mergify
Copy link
Contributor

mergify bot commented Feb 24, 2022

Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@alexpulver alexpulver deleted the pipelines-ecr-source branch February 24, 2022 15:33
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

(pipelines): Add support for Amazon ECR source action
6 participants