質問編集履歴

1

エラー内容が異なっていたので修正

2024/02/08 11:10

投稿

shoco
shoco

スコア170

test CHANGED
@@ -1 +1 @@
1
- AWS CodeBuildでbuildspec.ymlに記載した「while :」コマンドが失敗してしまう。
1
+ AWS CodeBuildでbuildspec.ymlに記載した「aws ecr describe-image-scan-findings」コマンドが失敗してしまう。
test CHANGED
@@ -1,19 +1,24 @@
1
1
  ### 実現したいこと
2
2
  AWS CodeBuildで、
3
3
  aws/codebuild/standard:3.0からaws/codebuild/standard:7.0に変えた後再ビルド実行したら
4
- buildspec.ymlに記載した「while :」コマンドが失敗してしまうので、成功するように解決したいです。
4
+ buildspec.ymlに記載した「aws ecr describe-image-scan-findings」コマンドが失敗してしまうので、成功するように解決したいです。
5
5
 
6
6
 
7
7
  ### 発生している問題・分からないこと
8
8
  エラーメッセージのうち下記エラーがきっかけで失敗しているように見えます。
9
9
 
10
- [Container] 2024/02/08 08:12:03.999403 Phase complete: BUILD State: FAILED
11
- [Container] 2024/02/08 08:12:03.999422 Phase context status code: COMMAND_EXECUTION_ERROR Message: Error while executing command: while :
10
+ [Container] 2024/02/08 09:09:20.363424 Running command scan_status=$(aws ecr describe-image-scan-findings --repository-name $target_project_name_l --image-id imageTag=latest | jq -r '.imageScanStatus.status' )
11
+ An error occurred (ImageNotFoundException) when calling the DescribeImageScanFindings operation: The image with imageId {imageDigest:'null', imageTag:'latest'} does not exist within the repository with name 'dcmprovisioningservice' in the registry with id '3544XXXXXXXX'
12
12
 
13
13
  ### エラーメッセージ
14
14
  ```error
15
+ [Container] 2024/02/08 09:09:20.363424 Running command scan_status=$(aws ecr describe-image-scan-findings --repository-name $target_project_name_l --image-id imageTag=latest | jq -r '.imageScanStatus.status' )
15
16
 
16
- [Container] 2024/02/08 08:12:03.994661 Command did not exit successfully while :
17
+ An error occurred (ImageNotFoundException) when calling the DescribeImageScanFindings operation: The image with imageId {imageDigest:'null', imageTag:'latest'} does not exist within the repository with name 'dcmprovisioningservice' in the registry with id '3544XXXXXXXX'
18
+
19
+ [Container] 2024/02/08 09:09:20.991607 Running command timeout_count=0
20
+
21
+ [Container] 2024/02/08 09:09:20.997543 Running command while :
17
22
  do
18
23
  echo "imageScanStatus: $scan_status";
19
24
  if [ $scan_status = "COMPLETE" ]; then
@@ -27,9 +32,14 @@
27
32
  scan_status=$(aws ecr describe-image-scan-findings --repository-name $target_project_name_l --image-id imageTag=latest | jq -r '.imageScanStatus.status' );
28
33
  timeout_count=$(( timeout_count + 1 ));
29
34
  done
30
- exit status 1
31
- [Container] 2024/02/08 08:12:03.999403 Phase complete: BUILD State: FAILED
32
- [Container] 2024/02/08 08:12:03.999422 Phase context status code: COMMAND_EXECUTION_ERROR Message: Error while executing command: while :
35
+
36
+ imageScanStatus:
37
+ /codebuild/output/tmp/script.sh: 7: [: =: unexpected operator
38
+
39
+ An error occurred (ImageNotFoundException) when calling the DescribeImageScanFindings operation: The image with imageId {imageDigest:'null', imageTag:'latest'} does not exist within the repository with name 'dcmprovisioningservice' in the registry with id '3544XXXXXXXX'
40
+ imageScanStatus:
41
+ /codebuild/output/tmp/script.sh: 7: [: =: unexpected operator
42
+
33
43
  ```
34
44
 
35
45
  ### 該当のソースコード