Fix API breakage caused by OS Plugin version scan
[releng/global-jjb.git] / ensure-documented.sh
1 #!/bin/bash
2 # SPDX-License-Identifier: EPL-1.0
3 ##############################################################################
4 # Copyright (c) 2017 The Linux Foundation and others.
5 #
6 # All rights reserved. This program and the accompanying materials
7 # are made available under the terms of the Eclipse Public License v1.0
8 # which accompanies this distribution, and is available at
9 # http://www.eclipse.org/legal/epl-v10.html
10 ##############################################################################
11
12 # Checks for JJB documentation interest points and ensures they are documented.
13
14 mapfile -t jjb_files < <(find jjb -name "*.yaml")
15
16 undocumented_count=0
17 for file in "${jjb_files[@]}"; do
18     docs_interests=$(grep -e '\- builder:' \
19          -e '\- job-group:' \
20          -e '\- job-template:' \
21          -e '\- parameter:' \
22          -e '\- property:' \
23          -e '\- publisher:' \
24          -e '\- scm:' \
25          -e '\- trigger:' \
26          -e '\- wrapper:' \
27          -A1 "$file" \
28          | grep 'name: ' | awk -F': ' '{print $2}' | awk -F"'" '{print $2}' | sort | uniq)
29
30     for item in "${docs_interests[@]}"; do
31         if ! grep -q "$item" "docs/${file//.yaml/.rst}"; then
32             echo "$item"
33             let "undocumented_count++"
34         fi
35     done
36 done
37
38 if [ $undocumented_count -gt 0 ]; then
39     echo "Number of undocumented items: $undocumented_count"
40     exit 1
41 fi