This repository was archived by the owner on Dec 2, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +45
-0
lines changed
Expand file tree Collapse file tree 2 files changed +45
-0
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,19 @@ eval $( jq -r '{
1414} | to_entries[] | .key + "=" + @sh "\(.value)"' < /tmp/stdin )
1515
1616
17+ #
18+ # validate
19+ #
20+
21+ case " $params_state " in
22+ error) true ;;
23+ failure) true ;;
24+ pending) true ;;
25+ success) true ;;
26+ * ) fatal " Invalid parameter: state: $params_state "
27+ esac
28+
29+
1730#
1831# commit
1932#
Original file line number Diff line number Diff line change 1+ #! /bin/sh
2+
3+ set -eu
4+
5+ DIR=$( dirname " $0 " ) /../..
6+
7+ set +e # error expected
8+
9+ BUILD_ID=123 $DIR /bin/out > $TMPDIR /resource-$$ 2> $TMPDIR /resource-$$ .out << EOF
10+ {
11+ "params": {
12+ "description": "test-description",
13+ "commit": "$TMPDIR /commit",
14+ "state": "failed",
15+ "target_url": "https://ci.example.com/\$ BUILD_ID/output"
16+ },
17+ "source": {
18+ "access_token": "test-token",
19+ "context": "test-context",
20+ "endpoint": "http://127.0.0.1:9192",
21+ "repository": "dpb587/test-repo"
22+ }
23+ }
24+ EOF
25+
26+ set -e
27+
28+ if ! grep -q ' ^FATAL: Invalid parameter: state: failed' $TMPDIR /resource-$$ .out ; then
29+ echo " FAILURE: Missing error for state validation"
30+ cat $TMPDIR /resource-$$ .out
31+ exit 1
32+ fi
You can’t perform that action at this time.
0 commit comments