Pipeline is looping between self update and build

0

We have few ci/cd pipelines setup using code pipelines/. We use java/kotlin cdk to manage infrastructure. We made code changes in cdk code to include test report. But the update pipeline and build is going in loop. Any way to fix this issue.

1개 답변
0
수락된 답변

The issue is with the below code which I added in code build step to create a unit test report.

Map<String, String> reportGroupProps = Map.of(
                "files", "**/*.xml",
                "base-directory", "lambda/build/test-results/test/",
                "file-format", "JUNITXML"
        );
Map<String, ?> reports = Map.of(reportGroup.getReportGroupArn(), reportGroupProps);
Map<String, ?> reportsMap = Map.of("reports", reports);

It looks like cdk does Map.toString() somewhere in the code. Map.of() changes the order of keys while doing toString(), which result in cdk diff. This diff creates the pipeline to update, hence it is looping.

I tested with the below code, the hashmap and treemap is consitently giving the same order, whereas map.of() changes the order.

Map<String, String> mp = Map.of("k1", "v1", "k2", "V2");
System.out.println("mp = " + mp);

Map<String, String> hp = new HashMap<>();
hp.put("k1", "v1");
hp.put("k2", "v2");
System.out.println("hp = " + hp);

Map<String, String> smp = new TreeMap<>();
smp.put("k1", "v1");
smp.put("k2", "v2");
System.out.println("smp = " + smp);
답변함 일 년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인