Skip to content

Commit 1ca13c9

Browse files
committed
ci: create log check template
1 parent b845d57 commit 1ca13c9

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
parameters:
2+
clusterName: ""
3+
podLabel: ""
4+
logGrep: ""
5+
6+
steps:
7+
- task: AzureCLI@2
8+
inputs:
9+
azureSubscription: $(BUILD_VALIDATIONS_SERVICE_CONNECTION)
10+
scriptLocation: "inlineScript"
11+
scriptType: "bash"
12+
addSpnToEnvironment: true
13+
inlineScript: |
14+
make -C ./hack/aks set-kubeconf AZCLI=az CLUSTER=${{ parameters.clusterName }}
15+
16+
if ! [ -z"$(kubectl logs -n kube-system -l ${{ parameters.podLabel }} --tail=-1 | grep ${{ parameters.logGrep }})" ]; then
17+
kubectl logs -n kube-system -l ${{ parameters.podLabel }} --tail=-1 | grep ${{ parameters.logGrep }}
18+
echo "Logs found with ${{ parameters.logGrep }}"
19+
exit 1
20+
done
21+
# Leaving "name:" blank as this template could be called multiple times in a single job with the same parameters.
22+
displayName: "Check pod with ${{ parameters.podLabel }} label for ${{ parameters.logGrep }}"
23+
condition: always()

0 commit comments

Comments
 (0)