From 3475bd6f261b81cc52646efbc01cf13d2128f4e4 Mon Sep 17 00:00:00 2001 From: Scott Gerring Date: Fri, 22 Dec 2023 12:15:47 +0100 Subject: [PATCH 1/6] Remove CDK test --- .../infra/src/test/java/cdk/CdkStackTest.java | 48 ------------------- 1 file changed, 48 deletions(-) delete mode 100644 examples/powertools-examples-core/cdk/infra/src/test/java/cdk/CdkStackTest.java diff --git a/examples/powertools-examples-core/cdk/infra/src/test/java/cdk/CdkStackTest.java b/examples/powertools-examples-core/cdk/infra/src/test/java/cdk/CdkStackTest.java deleted file mode 100644 index 29cb15545..000000000 --- a/examples/powertools-examples-core/cdk/infra/src/test/java/cdk/CdkStackTest.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright 2023 Amazon.com, Inc. or its affiliates. - * Licensed under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * http://www.apache.org/licenses/LICENSE-2.0 - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package cdk; - -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Test; -import software.amazon.awscdk.App; -import software.amazon.awscdk.assertions.Template; - -public class CdkStackTest { - - @Test - public void testStack() { - App app = new App(); - CdkStack stack = new CdkStack(app, "test"); - - Template template = Template.fromStack(stack); - - // There should be 2 lambda functions, one to handle regular input, and another for streaming - template.resourceCountIs("AWS::Lambda::Function", 2); - - // API Gateway should exist - template.resourceCountIs("AWS::ApiGateway::RestApi", 1); - - // API Gateway should have a path pointing to the regular Lambda - Map resourceProperties = new HashMap<>(); - resourceProperties.put("PathPart", "hello"); - template.hasResourceProperties("AWS::ApiGateway::Resource", resourceProperties); - - // API Gateway should have a path pointing to the streaming Lambda - resourceProperties = new HashMap<>(); - resourceProperties.put("PathPart", "hellostream"); - template.hasResourceProperties("AWS::ApiGateway::Resource", resourceProperties); - } -} From 631d2f3dd1f4fbb3f922a098ce52a31bdc2cce02 Mon Sep 17 00:00:00 2001 From: Scott Gerring Date: Fri, 22 Dec 2023 12:35:47 +0100 Subject: [PATCH 2/6] Build core utilities so that sam validator can find them --- .github/workflows/pr_iac_lint.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/pr_iac_lint.yml b/.github/workflows/pr_iac_lint.yml index 1ed2077f5..b68d4b9f4 100644 --- a/.github/workflows/pr_iac_lint.yml +++ b/.github/workflows/pr_iac_lint.yml @@ -24,6 +24,10 @@ jobs: with: distribution: 'corretto' java-version: 11 + - name: Build Project + working-directory: core + run: | + mvn install -DskipTests - name: Run SAM validator to check syntax of IaC templates - Java working-directory: examples/powertools-examples-core/${{ matrix.project }} run: | From 2f69e8196529b8db9b124e837b94073165461a4e Mon Sep 17 00:00:00 2001 From: Scott Gerring Date: Fri, 22 Dec 2023 12:36:32 +0100 Subject: [PATCH 3/6] Remove CDK test --- .github/workflows/pr_iac_lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr_iac_lint.yml b/.github/workflows/pr_iac_lint.yml index b68d4b9f4..a190ba7ff 100644 --- a/.github/workflows/pr_iac_lint.yml +++ b/.github/workflows/pr_iac_lint.yml @@ -25,7 +25,7 @@ jobs: distribution: 'corretto' java-version: 11 - name: Build Project - working-directory: core + working-directory: powertools-core run: | mvn install -DskipTests - name: Run SAM validator to check syntax of IaC templates - Java From b4cda11f4e3f3b9235c71a6c03ff5d5c63af5d18 Mon Sep 17 00:00:00 2001 From: Scott Gerring Date: Fri, 22 Dec 2023 12:37:47 +0100 Subject: [PATCH 4/6] Ok just build it all --- .github/workflows/pr_iac_lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr_iac_lint.yml b/.github/workflows/pr_iac_lint.yml index a190ba7ff..0eca12628 100644 --- a/.github/workflows/pr_iac_lint.yml +++ b/.github/workflows/pr_iac_lint.yml @@ -25,7 +25,7 @@ jobs: distribution: 'corretto' java-version: 11 - name: Build Project - working-directory: powertools-core + working-directory: . run: | mvn install -DskipTests - name: Run SAM validator to check syntax of IaC templates - Java From 0a99e83012fbaaf04856954c564029c10c0c5ec2 Mon Sep 17 00:00:00 2001 From: Scott Gerring Date: Fri, 22 Dec 2023 12:45:22 +0100 Subject: [PATCH 5/6] Remove the plan ... --- .github/workflows/pr_iac_lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr_iac_lint.yml b/.github/workflows/pr_iac_lint.yml index 0eca12628..629c5afd4 100644 --- a/.github/workflows/pr_iac_lint.yml +++ b/.github/workflows/pr_iac_lint.yml @@ -42,7 +42,7 @@ jobs: terraform -version terraform init -backend=false terraform validate - terraform plan + echo terraform plan # We can't do this without a credentials source - name: Setup Terraform lint uses: terraform-linters/setup-tflint@a5a1af8c6551fb10c53f1cd4ba62359f1973746f # v3.1.1 - name: Run Terraform lint to check for best practices, errors, deprecated syntax etc. From 6dd90d49836d715a0f1d84ab48f338a8734e52f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Van=20Der=20Linden?= <117538+jeromevdl@users.noreply.github.com> Date: Tue, 2 Jan 2024 10:05:30 +0100 Subject: [PATCH 6/6] Remove terraform plan from iac lint --- .github/workflows/pr_iac_lint.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/pr_iac_lint.yml b/.github/workflows/pr_iac_lint.yml index 629c5afd4..c6e17ab1c 100644 --- a/.github/workflows/pr_iac_lint.yml +++ b/.github/workflows/pr_iac_lint.yml @@ -42,7 +42,6 @@ jobs: terraform -version terraform init -backend=false terraform validate - echo terraform plan # We can't do this without a credentials source - name: Setup Terraform lint uses: terraform-linters/setup-tflint@a5a1af8c6551fb10c53f1cd4ba62359f1973746f # v3.1.1 - name: Run Terraform lint to check for best practices, errors, deprecated syntax etc.