File tree Expand file tree Collapse file tree 7 files changed +52
-50
lines changed Expand file tree Collapse file tree 7 files changed +52
-50
lines changed Original file line number Diff line number Diff line change 33set -o nounset
44set -o pipefail
55
6- source " hack/lib/test_lib .sh"
6+ source " hack/lib/common .sh"
77
88echo " Checking format of error and log messages..."
99allfiles=$( listFiles| grep -v ./internal/bindata/...)
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ set -o errexit
44set -o nounset
55set -o pipefail
66
7- source " hack/lib/test_lib .sh"
7+ source " hack/lib/common .sh"
88
99echo " Checking for license header..."
1010allfiles=$( listFiles| grep -v ./internal/bindata/...)
Original file line number Diff line number Diff line change 44
55source ./hack/lib/common.sh
66
7- header_text " Building the site and checking links "
7+ header_text " Building the website "
88docker volume create sdk-html
9+ trap_add " docker volume rm sdk-html" EXIT
910docker run --rm -v " $( pwd) :/src" -v sdk-html:/src/website/public klakegg/hugo:0.73.0-ext-ubuntu -s website
10- docker run --rm -v sdk-html:/target mtlynch/htmlproofer /target --empty-alt-ignore --http-status-ignore 429 --allow_hash_href
11- docker volume rm sdk-html
11+
12+ header_text " Checking links"
13+ # For config explanation: https://github.com/gjtorikian/html-proofer#special-cases-for-the-command-line
14+ docker run --rm -v sdk-html:/target klakegg/html-proofer:latest /target \
15+ --empty-alt-ignore \
16+ --http-status-ignore 429 \
17+ --allow_hash_href \
18+ --url-ignore " /github.com\/operator-framework\/operator-sdk\/edit\/master\//"
Original file line number Diff line number Diff line change @@ -24,3 +24,43 @@ function header_text {
2424function error_text {
2525 echo " $error_color $* $reset_color "
2626}
27+
28+ # ===================================================================
29+ # FUNCTION trap_add ()
30+ #
31+ # Purpose: prepends a command to a trap
32+ #
33+ # - 1st arg: code to add
34+ # - remaining args: names of traps to modify
35+ #
36+ # Example: trap_add 'echo "in trap DEBUG"' DEBUG
37+ #
38+ # See: http://stackoverflow.com/questions/3338030/multiple-bash-traps-for-the-same-signal
39+ # ===================================================================
40+ function trap_add() {
41+ trap_add_cmd=$1 ; shift || fatal " ${FUNCNAME} usage error"
42+ new_cmd=
43+ for trap_add_name in " $@ " ; do
44+ # Grab the currently defined trap commands for this trap
45+ existing_cmd=` trap -p " ${trap_add_name} " | awk -F" '" ' {print $2}' `
46+
47+ # Define default command
48+ [ -z " ${existing_cmd} " ] && existing_cmd=" echo exiting @ ` date` "
49+
50+ # Generate the new command
51+ new_cmd=" ${trap_add_cmd} ;${existing_cmd} "
52+
53+ # Assign the test
54+ trap " ${new_cmd} " " ${trap_add_name} " || \
55+ fatal " unable to add to trap ${trap_add_name} "
56+ done
57+ }
58+
59+ function listPkgDirs() {
60+ go list -f ' {{.Dir}}' ./cmd/... ./test/... ./internal/... | grep -v generated
61+ }
62+
63+ function listFiles() {
64+ # pipeline is much faster than for loop
65+ listPkgDirs | xargs -I {} find {} -name ' *.go' | grep -v generated
66+ }
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 11#! /usr/bin/env bash
22
33source hack/lib/common.sh
4- source hack/lib/test_lib.sh
54source hack/lib/image_lib.sh
65
76set -eu
Original file line number Diff line number Diff line change 33set -eu
44
55source hack/lib/common.sh
6- source hack/lib/test_lib.sh
76source hack/lib/image_lib.sh
87
98TMPDIR=" $( mktemp -d -p /tmp memcached-operator-XXXX) "
You can’t perform that action at this time.
0 commit comments