-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathazure-pipelines.yml
42 lines (41 loc) · 1.58 KB
/
azure-pipelines.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
name: $(majorMinorVersion).$(semanticVersion).$(rev:r)
pool:
name: Azure Pipelines
vmImage: ubuntu-18.04
variables:
majorMinorVersion: 1
semanticVersion: 0.0
RG-NAME: <Resource Group of AKS cluster>
AKS-NAME: <AKS Cluster Name >
NAME-SPACE: <K8s Namespace>
AZ-Connection: <Azure Service Connection to connect azure cloud>
steps:
- task: AzureCLI@2
displayName: AKS Login
inputs:
azureSubscription: '$(AZ-Connection)'
scriptType: bash
scriptLocation: inlineScript
inlineScript: |
# az --version
# az account show
az aks get-credentials --resource-group $(RG-NAME) --name $(AKS-NAME)
kubectl get ns
- task: CmdLine@2
displayName: Scanning the AKS Cluster
inputs:
script: |
docker run --rm -i -v $HOME/.kube:/root/.kube derailed/popeye --context $(AKS-NAME) -n $(NAME-SPACE) --force-exit-zero
docker run --rm -i -v $HOME/.kube:/root/.kube -e POPEYE_REPORT_DIR=/tmp/popeye -v /tmp:/tmp derailed/popeye --context $(AKS-NAME) -n $(NAME-SPACE) --force-exit-zero --save --out junit --output-file report.xml
docker run --rm -i -v $HOME/.kube:/root/.kube -e POPEYE_REPORT_DIR=/tmp/popeye -v /tmp:/tmp derailed/popeye --context $(AKS-NAME) -n $(NAME-SPACE) --force-exit-zero --save --out html --output-file htmlreport.html
cp /tmp/popeye/report.xml .
cp /tmp/popeye/htmlreport.html .
- task: PublishTestResults@2
inputs:
testResultsFormat: 'JUnit'
testResultsFiles: 'report.xml'
- task: PublishPipelineArtifact@1
inputs:
targetPath: 'htmlreport.html'
artifact: 'aksreport'
publishLocation: 'pipeline'