-
Notifications
You must be signed in to change notification settings - Fork 21
chore: refresh examples + docs + add security scanning #71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
d444922
cleanup
6f9225d
ad cache dep path
46ebaf0
add working dir
e5e28cf
dont fail fast on matrix jobs
ebc68da
match a commit sha
5521991
do actual tear down in test script on failure
2012af7
add aqua sec tests
3a39b03
add t/task.buf to gitignore
cb65c8f
remove whitespace
1197400
update readme
cac0c73
no longer need save flag, see https://stackoverflow.com/questions/195…
15b2afb
cleanup test script
e4dd47c
rephrase comment
93be1e2
update git ignore
3ef1db4
check in new packge lock file
0219696
remove package.json from sample and update readme
c69dd59
readd package.json
7ac8f7a
update ex readme
f30fc66
update ex readme typo
7c3bdf3
restore package lock from master; will change in another pr
9db05c3
little cleanup
8b51349
readd yarn lock, will remove in another pr
208c740
update typo in readme
13cf29a
remove node 14 from CI as it is EOL
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,33 @@ | ||
name: ci-aqua-security-trivy-tests | ||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
types: | ||
- opened | ||
- reopened | ||
- synchronize | ||
- ready_for_review | ||
branches: | ||
- master | ||
schedule: | ||
- cron: "0 * * * *" | ||
jobs: | ||
build: | ||
name: trivy-tests | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
- name: Run Trivy vulnerability scanner | ||
uses: aquasecurity/trivy-action@master | ||
with: | ||
scan-type: 'fs' | ||
scan-ref: '.' | ||
format: 'sarif' | ||
output: 'trivy-results.sarif' | ||
- name: Upload Trivy scan results to GitHub Security tab | ||
uses: github/codeql-action/upload-sarif@v2 | ||
with: | ||
sarif_file: 'trivy-results.sarif' |
This file contains hidden or 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 hidden or 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 |
---|---|---|
|
@@ -37,5 +37,8 @@ coverage/ | |
Thumbs.db | ||
|
||
# Dgraph | ||
|
||
data/** | ||
dgraph-local-data/ | ||
|
||
# npm test cruft | ||
t/ |
This file contains hidden or 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 hidden or 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 hidden or 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,6 +1,6 @@ | ||
{ | ||
"name": "simple", | ||
"dependencies": { | ||
"dgraph-js-http": "^0.1.0" | ||
"dgraph-js-http": "^21.3.1" | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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,99 @@ | ||
#!/bin/bash | ||
|
||
sleepTime=5 | ||
|
||
function wait-for-healthy() { | ||
printf 'wait-for-healthy: waiting for %s to return 200 OK\n' "$1" | ||
tries=0 | ||
until curl -sL -w "%{http_code}\\n" "$1" -o /dev/null | grep -q 200; do | ||
tries=$tries+1 | ||
if [[ $tries -gt 300 ]]; then | ||
printf "wait-for-healthy: Took longer than 1 minute to be healthy.\n" | ||
printf "wait-for-healthy: Waiting stopped.\n" | ||
return 1 | ||
fi | ||
sleep 0.2 | ||
done | ||
printf "wait-for-healthy: done.\n" | ||
} | ||
|
||
function errorCheck { | ||
EXIT_CODE=$1 | ||
ERROR_MESSAGE=$2 | ||
|
||
if [[ EXIT_CODE -ne 0 ]]; then | ||
echo $ERROR_MESSAGE | ||
stopCluster | ||
exit $EXIT_CODE | ||
fi | ||
return 0 | ||
} | ||
|
||
function stopCluster { | ||
echo "shutting down dgraph alpha and zero..." | ||
kill -9 $(pgrep -f "dgraph zero") > /dev/null # kill dgraph zero | ||
kill -9 $(pgrep -f "dgraph alpha") > /dev/null # kill dgraph alpha | ||
|
||
if pgrep -x dgraph > /dev/null | ||
then | ||
echo "sleeping for 5 seconds so dgraph can shutdown" | ||
sleep 5 | ||
fi | ||
|
||
echo "cluster teardown complete" | ||
return 0 | ||
} | ||
|
||
function startAlpha { | ||
echo -e "starting dgraph alpha..." | ||
head -c 1024 /dev/random > $SRCDIR/dgraph-local-data/acl-secret.txt | ||
dgraph alpha -p $SRCDIR/dgraph-local-data/p \ | ||
-w $SRCDIR/dgraph-local-data/w \ | ||
--bindall \ | ||
--my localhost:7080 \ | ||
--acl "access-ttl=1h; refresh-ttl=1d; secret-file=$SRCDIR/dgraph-local-data/acl-secret.txt" \ | ||
> $SRCDIR/dgraph-local-data/alpha.log 2>&1 & | ||
|
||
# wait for alpha to be healthy | ||
ALPHA_HTTP_ADDR="localhost:8080" | ||
wait-for-healthy $ALPHA_HTTP_ADDR/health | ||
errorCheck $? "dgraph alpha could not come up" | ||
sleep $sleepTime | ||
return 0 | ||
} | ||
|
||
function startZero { | ||
echo -e "starting dgraph zero..." | ||
dgraph zero --my localhost:5080 --bindall \ | ||
-w $SRCDIR/dgraph-local-data/wz > $SRCDIR/dgraph-local-data/zero.log 2>&1 & | ||
|
||
# wait for zero to be healthy | ||
ZERO_HTTP_ADDR="localhost:6080" | ||
wait-for-healthy $ZERO_HTTP_ADDR/health | ||
errorCheck $? "dgraph zero could not come up" | ||
sleep $sleepTime | ||
} | ||
|
||
function init { | ||
echo -e "initializing..." | ||
rm -rf $SRCDIR/dgraph-local-data | ||
mkdir $SRCDIR/dgraph-local-data | ||
} | ||
|
||
# find parent directory of test script | ||
readonly _SRCDIR=$(readlink -f ${BASH_SOURCE[0]%/*}) | ||
SRCDIR=$(dirname $_SRCDIR) | ||
|
||
init | ||
startZero | ||
startAlpha | ||
sleep 10 # need time to create Groot user | ||
|
||
npm run build | ||
|
||
npm test | ||
errorCheck $? "dgraph-js-http client tests FAILED" | ||
|
||
stopCluster | ||
rm -rf $SRCDIR/local-dgraph-data | ||
exit 0 |
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hasn't been needed in modern versions of npm for a long time, see https://stackoverflow.com/questions/19578796/what-is-the-save-option-for-npm-install