-
Notifications
You must be signed in to change notification settings - Fork 1
/
go
executable file
·94 lines (74 loc) · 2.15 KB
/
go
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#!/bin/bash
set -e
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
readonly SCRIPT_DIR
goal_lint() {
find "$SCRIPT_DIR" -name "*.sh" -exec shellcheck {} +
shellcheck "$SCRIPT_DIR"/go
}
goal_test_unit() {
# shellcheck disable=SC1010
"${SCRIPT_DIR}/lein" do clean, test
}
goal_test_smoke() {
echo
echo "Running smoke test against recorded endpoints."
echo "If this fails you might have changed how the endpoints are requested, and might want to record from scratch."
echo "Testing GoCD sync"
"${SCRIPT_DIR}/test/smoke/test_gocd.sh"
echo "Testing Jenkins sync"
"${SCRIPT_DIR}/test/smoke/test_jenkins.sh"
echo "Testing Concourse sync"
"${SCRIPT_DIR}/test/smoke/test_concourse.sh"
}
goal_audit() {
"${SCRIPT_DIR}/lein" nvd check
}
goal_test() {
goal_lint
goal_test_unit
goal_test_smoke
goal_audit
}
goal_make_release() {
local NEW_VERSION=$1
local OLD_VERSION_ESCAPED
if [ -z "$NEW_VERSION" ]; then
echo "Provide a new version number"
exit 1
fi
(
cd "$SCRIPT_DIR"
OLD_VERSION_ESCAPED=$(git tag --sort=-version:refname | head -1 | sed 's/\./\\./')
sed -i "" "s/$OLD_VERSION_ESCAPED/$NEW_VERSION/g" README.md
sed -i "" "s/$OLD_VERSION_ESCAPED/$NEW_VERSION/g" BUILD_SERVERS.md
sed -i "" "s/$OLD_VERSION_ESCAPED/$NEW_VERSION/g" examples/README.md
sed -i "" "s/build-facts \"$OLD_VERSION_ESCAPED\"/build-facts \"$NEW_VERSION\"/" project.clj
git add README.md BUILD_SERVERS.md examples/README.md project.clj
git commit -m "Bump version"
./lein clean
./lein uberjar
git show
git tag "$NEW_VERSION"
echo
echo "You now want to"
echo "$ git push origin master --tags"
echo "and upload the jar"
)
}
goal_help() {
local GOALS
GOALS=$(set | grep -e "^goal_" | sed "s/^goal_\(.*\)().*/\1/" | xargs | sed "s/ / | /g")
echo "Usage: $0 [ ${GOALS} ]"
}
main() {
local GOAL
if [[ -z "$1" ]] || ! type -t "goal_$1" &>/dev/null; then
goal_help
exit 1
fi
GOAL="$1"
shift
"goal_${GOAL}" "$@"
}
main "$@"