Skip to content

Commit

Permalink
fix: remove unsupported public ECR lifecycle policies (#507)
Browse files Browse the repository at this point in the history
Remove the ECR lifecycle policies as they are not supported for
public ECRs.

Disable the Trivy Java DB sync since there is currently a bug with
the published artifact and it cannot be pushed to the public ECR.
  • Loading branch information
patheard authored Oct 18, 2024
1 parent e7aaeb4 commit 66e4da0
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 43 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/trivy-db-refresh.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,9 @@ jobs:
with:
registry-type: public

- name: Refresh Trivy Databases
- name: Refresh Trivy Database
run: |
./bin/generate_sbom/trivy_db_refresh.sh trivy-db:latest ${{ vars.TRIVY_DB_REPOSITORY }}
./bin/generate_sbom/trivy_db_refresh.sh trivy-java-db:1 ${{ vars.TRIVY_JAVA_DB_REPOSITORY }}
- name: Logout of Amazon ECR
run: docker logout ${{ steps.login-ecr.outputs.registry }}
25 changes: 0 additions & 25 deletions terragrunt/aws/generate_sbom/ecr.tf
Original file line number Diff line number Diff line change
Expand Up @@ -66,28 +66,3 @@ resource "aws_ecrpublic_repository_policy" "generate_sbom_trivy_java_db" {
repository_name = aws_ecrpublic_repository.generate_sbom_trivy_java_db.repository_name
policy = sensitive(data.aws_iam_policy_document.sbom_public_policy_document.json)
}

#
# Policy to expire untagged images
#
resource "aws_ecr_lifecycle_policy" "generate_sbom_trivy_db" {
provider = aws.us-east-1
repository = aws_ecrpublic_repository.generate_sbom_trivy_db.repository_name
policy = file("${path.module}/policy/lifecycle.json")
}

resource "aws_ecr_lifecycle_policy" "generate_sbom_trivy_java_db" {
provider = aws.us-east-1
repository = aws_ecrpublic_repository.generate_sbom_trivy_java_db.repository_name
policy = file("${path.module}/policy/lifecycle.json")
}

moved {
from = aws_ecrpublic_repository.generate_sbom_public
to = aws_ecrpublic_repository.generate_sbom_trivy_db
}

moved {
from = aws_ecrpublic_repository_policy.sbom_public_policy
to = aws_ecrpublic_repository_policy.generate_sbom_trivy_db
}
16 changes: 0 additions & 16 deletions terragrunt/aws/generate_sbom/policy/lifecycle.json

This file was deleted.

0 comments on commit 66e4da0

Please sign in to comment.