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

cfn-lint does not totally validate CodeBuildProject: Source or Artifacts #3614

Open
christiana-smith-seagen opened this issue Aug 22, 2024 · 0 comments

Comments

@christiana-smith-seagen
Copy link

christiana-smith-seagen commented Aug 22, 2024

CloudFormation Lint Version

1.9.7

What operating system are you using?

Windows

Describe the bug

Cfn-lint does not seem to catch issues related to CodeBuildProject:Source or CodeBuildProject:Artifacts. I have provided a template that should raise errors but does not. There may be other rules its missing but these are what I ran into.

Expected behavior

CodeBuildProject:Source should require Location when Type: S3

CodeBuildProject:Artifacts:Location may not contain forward-slashes

Reproduction template


Parameters:
  GithubRepository:
    Type: String
    Default: test-repo
    Description: Name of repository in Github
  CodeBuildComputeType:
    Type: String
    Default: BUILD_GENERAL1_SMALL
    Description: Type of compute environment to use
  CodeBuildRole:
    Type: String
    Default: arn:aws:iam::123456789:role/CODEBUILD-ROLE

    
Resources:
  EcrRepository:
    Type: AWS::ECR::Repository
    Properties:
      RepositoryName: !Ref GithubRepository

  CodeBuildProject:
    Type: AWS::CodeBuild::Project
    Properties:
      Name: !Ref GithubRepository
      Artifacts:
        Type: S3
        Location: !Sub dev-artifacts/${GithubRepository}
      Environment:
        ComputeType: !Ref CodeBuildComputeType
        EnvironmentVariables:
          - Name: ENV
            Value : "dev"
          - Name: AWS_DEFAULT_REGION
            Value: !Ref AWS::Region
          - Name: AWS_ACCOUNT_ID
            Value: !Ref "AWS::AccountId"
          - Name: AWS_ECR_REPOSITORY_URI
            Value: !Sub ${AWS::AccountId}.dkr.ecr.${AWS::Region}.amazonaws.com/${EcrRepository}
          - Name: IMAGE_REPO_NAME
            Value: !Ref GithubRepository
          - Name: IMAGE_TAG
            Value: "latest"
        Image: "public.ecr.aws/lts/ubuntu:24.04"
        PrivilegedMode: true
        Type: "LINUX_CONTAINER"
      ServiceRole: !Ref CodeBuildRole
      Source:
        Type: "S3"
        BuildSpec: codebuild.yaml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant