This repository has been archived by the owner on Dec 2, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- added base_context - added syntax highlighting to README - removed obsolete groundcrew section - added `put` context param to override the source param - created makefile for ease of development / testing - bumped `jq` version in makefile
- Loading branch information
Christopher Mancini
committed
Sep 19, 2019
1 parent
bed72b0
commit 679927c
Showing
13 changed files
with
170 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
FROM alpine | ||
RUN apk --no-cache add curl ca-certificates gettext \ | ||
&& curl -Ls https://github.com/stedolan/jq/releases/download/jq-1.5/jq-linux64 > /usr/bin/jq && chmod +x /usr/bin/jq | ||
&& curl -Ls https://github.com/stedolan/jq/releases/download/jq-1.6/jq-linux64 > /usr/bin/jq && chmod +x /usr/bin/jq | ||
ADD bin /opt/resource |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
SHELL=/bin/bash | ||
|
||
root_mkfile := $(abspath $(lastword $(MAKEFILE_LIST))) | ||
root_dir := $(dir $(root_mkfile)) | ||
|
||
.PHONY: resource-dev | ||
resource-dev: | ||
@docker run \ | ||
-v $(root_dir):/resource \ | ||
--rm -i -t dpb587/github-status-resource:master \ | ||
/bin/ash | ||
|
||
.PHONY: test | ||
test: | ||
@docker run \ | ||
-v $(root_dir):/resource \ | ||
--rm -i -t dpb587/github-status-resource:master \ | ||
/resource/test/all.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
#!/bin/sh | ||
|
||
set -eu | ||
|
||
DIR=$( dirname "$0" )/../.. | ||
|
||
echo 'a1b2c3d4e5' > $TMPDIR/commit | ||
|
||
cat <<EOF | nc -l -s 127.0.0.1 -p 9192 > $TMPDIR/http.req-$$ & | ||
HTTP/1.0 200 OK | ||
{ | ||
"created_at": "2012-07-20T01:19:13Z", | ||
"updated_at": "2012-07-20T02:19:13Z", | ||
"state": "success", | ||
"target_url": "https://ci.example.com/1000/output", | ||
"description": "Build has completed successfully", | ||
"id": 1, | ||
"url": "https://api.github.com/repos/octocat/Hello-World/statuses/1", | ||
"context": "continuous-integration/jenkins", | ||
"creator": { | ||
"login": "octocat", | ||
"id": 1, | ||
"avatar_url": "https://github.com/images/error/octocat_happy.gif", | ||
"gravatar_id": "", | ||
"url": "https://api.github.com/users/octocat", | ||
"html_url": "https://github.com/octocat", | ||
"followers_url": "https://api.github.com/users/octocat/followers", | ||
"following_url": "https://api.github.com/users/octocat/following{/other_user}", | ||
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}", | ||
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", | ||
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions", | ||
"organizations_url": "https://api.github.com/users/octocat/orgs", | ||
"repos_url": "https://api.github.com/users/octocat/repos", | ||
"events_url": "https://api.github.com/users/octocat/events{/privacy}", | ||
"received_events_url": "https://api.github.com/users/octocat/received_events", | ||
"type": "User", | ||
"site_admin": false | ||
} | ||
} | ||
EOF | ||
|
||
BUILD_ID=123 BUILD_JOB_NAME=myjob $DIR/bin/out > $TMPDIR/resource-$$ <<EOF | ||
{ | ||
"params": { | ||
"description": "test-description", | ||
"commit": "$TMPDIR/commit", | ||
"context": "override-context/\$BUILD_JOB_NAME", | ||
"state": "success", | ||
"target_url": "https://ci.example.com/\$BUILD_ID/output" | ||
}, | ||
"source": { | ||
"access_token": "test-token", | ||
"context": "test-context", | ||
"endpoint": "http://127.0.0.1:9192", | ||
"repository": "dpb587/test-repo" | ||
} | ||
} | ||
EOF | ||
|
||
if ! grep -q '^POST /repos/dpb587/test-repo/statuses/a1b2c3d4e5 ' $TMPDIR/http.req-$$ ; then | ||
echo "FAILURE: Invalid HTTP method or URI" | ||
cat $TMPDIR/http.req-$$ | ||
exit 1 | ||
fi | ||
|
||
if ! grep -q '^{"context":"concourse-ci/override-context/myjob","description":"test-description","state":"success","target_url":"https://ci.example.com/123/output"}$' $TMPDIR/http.req-$$ ; then | ||
echo "FAILURE: Unexpected request body" | ||
cat $TMPDIR/http.req-$$ | ||
exit 1 | ||
fi | ||
|
||
if ! grep -q '"version":{"commit":"a1b2c3d4e5","status":"1"}' $TMPDIR/resource-$$ ; then | ||
echo "FAILURE: Unexpected version output" | ||
cat $TMPDIR/resource-$$ | ||
exit 1 | ||
fi | ||
|
||
if ! grep -q '{"name":"created_at","value":"2012-07-20T01:19:13Z"}' $TMPDIR/resource-$$ ; then | ||
echo "FAILURE: Unexpected created_at output" | ||
cat $TMPDIR/resource-$$ | ||
exit 1 | ||
fi | ||
|
||
if ! grep -q '{"name":"created_by","value":"octocat"}' $TMPDIR/resource-$$ ; then | ||
echo "FAILURE: Unexpected creator output" | ||
cat $TMPDIR/resource-$$ | ||
exit 1 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters