Popeye fails with error while running with spinach.yaml file
Describe the bug Im using this task in azure devops to run a popeye against my AKS cluster.
- task: AzureCLI@2
displayName: 'Run Popeye Audit Script'
inputs:
azureSubscription: ${{ parameters.AZURE_SERVICE_CONNECTION_NAME }}
scriptType: 'bash'
scriptLocation: 'inlineScript'
inlineScript: |
set -feuo pipefail
set -x
# Validate parameters
: "${RESOURCE_GROUP:?Need to set RESOURCE_GROUP environment variable}"
: "${CLUSTER_NAME:?Need to set CLUSTER_NAME environment variable}"
: "${POPEYE_VERSION:?Need to set POPEYE_VERSION environment variable}"
: "${KUBELOGIN_VERSION:?Need to set KUBELOGIN_VERSION environment variable}"
SUBSCRIPTION_ID=${SUBSCRIPTION_ID:-""}
# Getting KubeConfig
az aks get-credentials -n "${CLUSTER_NAME}" -g "${RESOURCE_GROUP}" --overwrite-existing
# Download Kubelogin
curl -LO "https://github.com/Azure/kubelogin/releases/download/${KUBELOGIN_VERSION}/kubelogin-linux-amd64.zip"
unzip kubelogin-linux-amd64.zip
sudo mv bin/linux_amd64/kubelogin /usr/bin/kubelogin
# Convert to non-interactive
kubelogin convert-kubeconfig -l azurecli
echo "Download POPEYE..."
curl -LO "https://github.com/derailed/popeye/releases/download/${POPEYE_VERSION}/popeye_Linux_amd64.tar.gz"
tar xzvpf "popeye_Linux_amd64.tar.gz" popeye
mv popeye /tmp/popeye
# Construct SPINACH path
SPINACH="$(System.DefaultWorkingDirectory)/terraform/playgrounds/babu/popeye/spinach.yml"
POPEYE=${POPEYE:-/tmp/popeye}
# Create output directory for Popeye HTML report
POPEYE_REPORT_DIR=$(System.DefaultWorkingDirectory)
# Run Popeye and save the output to a file
"$POPEYE" --save --out html --output-file report.html -A -f "$SPINACH"
env:
RESOURCE_GROUP: ${{ parameters.RESOURCE_GROUP }}
CLUSTER_NAME: ${{ parameters.CLUSTER_NAME }}
POPEYE_VERSION: ${{ parameters.POPEYE_VERSION }}
KUBELOGIN_VERSION: ${{ parameters.KUBELOGIN_VERSION }}
Popeye is running fine and I got error: ##[error]Script failed with exit code: 1 in the pipeline without saving output as html file. I used below command to run popeye with spinach configuration /tmp/popeye -A -f /home/vsts/work/1/s/terraform/playgrounds/babu/popeye/spinach.yml
If I try to save output file as HTML format and my pipeline is throwing error as below /tmp/popeye --save --out html --output-file report.html -A -f /home/vsts/work/1/s/terraform/playgrounds/babu/popeye/spinach.yml
`+ echo 'Download POPEYE...' Download POPEYE...
-
curl -LO https://github.com/derailed/popeye/releases/download/v0.21.3/popeye_Linux_amd64.tar.gz % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
19 17.2M 19 3501k 0 0 3673k 0 0:00:04 --:--:-- 0:00:04 3673k 100 17.2M 100 17.2M 0 0 13.7M 0 0:00:01 0:00:01 --:--:-- 45.9M
- tar xzvpf popeye_Linux_amd64.tar.gz popeye popeye
- mv popeye /tmp/popeye
- SPINACH=/home/vsts/work/1/s/terraform/playgrounds/babu/popeye/spinach.yml
- POPEYE=/tmp/popeye
- POPEYE_REPORT_DIR=/home/vsts/work/1/s
- /tmp/popeye --save --out html --output-file report.html -A -f /home/vsts/work/1/s/terraform/playgrounds/babu/popeye/spinach.yml
___ ___ _____ _____ D .-'-.
| _ _| _ \ \ \ / / | O | K\ | _/ _ \ _/ _| \ V /| _| H-,---._
|_| _/| || || || [] .->' X|-' Biffsem and Buffsem!=/ (/_ /
_,_)----; |
Boom! 💥 open /tmp/popeye/BABUZ-AKSCluster00/BABUZ-AKSCluster00/report.html: not a directory (see logs)
##[error]Script failed with exit code: 1`
Expected behavior Popeye should run without any error and It should generate HTML file correctly,
Versions (please complete the following information):
- OS: [Azure DevOps Linux Agent]
- Popeye [0.21.3]
- K8s [1.27.7]
Additional context I'm using this spinach.yaml configuration: https://github.com/derailed/popeye/blob/master/spinach-examples/spinach_aks.yml for my test
@babuga365 Could you include the popeye's logs?
Hi @derailed , I have added two log files for your reference. popeye_logs1.txt poeye_logs.txt
Did you had a chance to check these logs? please help me as soon as possible
@derailed, please help me on this issue to fix it or do I have any workaround?
Thanks for your response