Lab - Trivy Q7 task not completed

Udated the kubesec-scan.sh script

#!/bin/bash

#kubesec-scan.sh

# using kubesec v2 api
scan_result=$(curl -sSX POST --data-binary @"k8s_deployment_service.yaml" https://v2.kubesec.io/scan)
scan_message=$(curl -sSX POST --data-binary @"k8s_deployment_service.yaml" https://v2.kubesec.io/scan | jq .[0].message -r )
scan_score=$(curl -sSX POST --data-binary @"k8s_deployment_service.yaml" https://v2.kubesec.io/scan | jq .[0].score)

echo $scan_score

if [[ "${scan_score}" -ge 4 ]]; then
  echo "Score is $scan_score"
  echo "Kubesec Scan $scan_message"
else
  echo "Score is $scan_score"
  echo "Kubernetes template scanning failed because score is less than or equal to $scan_score"
  exit 1;
fi
exactly as shown in solution still the task is not completed

Hi @shashwatshah101293
Can you please provide us the link to the lab please

Regard

skiped this question and tried the next one made changes in jenkins file as mentioned in solution and this task also failed so please check for Q8 also

HI @shashwatshah101293,

Base on the statement, the solution provided is not correct the right solution should be :

#!/bin/bash

#kubesec-scan.sh

# using kubesec v2 api
scan_result=$(curl -sSX POST --data-binary @"k8s_deployment_service.yaml" https://v2.kubesec.io/scan)
scan_message=$(curl -sSX POST --data-binary @"k8s_deployment_service.yaml" https://v2.kubesec.io/scan | jq .[0].message -r )
scan_score=$(curl -sSX POST --data-binary @"k8s_deployment_service.yaml" https://v2.kubesec.io/scan | jq .[0].score)

echo $scan_score

if [[ "${scan_score}" -ge 4 ]]; then
  echo "Score is $scan_score"
  echo "Kubesec Scan $scan_message"
else
  echo "Score is $scan_score"
  echo "Kubernetes template scanning failed because score is less than 4"
  exit 1;
fi

Thanks for reporting the issue, we’ll notify the labs team

Regard

Hi @shashwatshah101293,

Issue is fixed on lab

Regard