mirror of https://github.com/rancher/dashboard.git
Upload build-gate to use a "version" of jq that will exist
This commit is contained in:
parent
7cb9153076
commit
486aa7fa4e
|
|
@ -1,6 +1,8 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
cd $(dirname $0)/..
|
||||||
|
|
||||||
BUILD_DEBUG="${BUILD_DEBUG:-}"
|
BUILD_DEBUG="${BUILD_DEBUG:-}"
|
||||||
if [[ -n "${BUILD_DEBUG}" ]]; then
|
if [[ -n "${BUILD_DEBUG}" ]]; then
|
||||||
set -x
|
set -x
|
||||||
|
|
@ -35,7 +37,7 @@ tmp=$(mktemp -u)
|
||||||
STATUS_CODE=$(curl -w "%{http_code}" -s -o $tmp https://api.github.com/repos/$DRONE_REPO/branches/$DRONE_BRANCH)
|
STATUS_CODE=$(curl -w "%{http_code}" -s -o $tmp https://api.github.com/repos/$DRONE_REPO/branches/$DRONE_BRANCH)
|
||||||
|
|
||||||
if [ "$STATUS_CODE" == "403" ]; then
|
if [ "$STATUS_CODE" == "403" ]; then
|
||||||
RATE_LIMIT_REMAINING=$(curl -s https://api.github.com/rate_limit | jq -r .rate.remaining)
|
RATE_LIMIT_REMAINING=$(curl -s https://api.github.com/rate_limit | ./scripts/jq-nano - rate remaining)
|
||||||
echo "Remaining GITHUB requests available: $RATE_LIMIT_REMAINING"
|
echo "Remaining GITHUB requests available: $RATE_LIMIT_REMAINING"
|
||||||
RATE_LIMIT_REMAINING=${RATE_LIMIT_REMAINING:-0}
|
RATE_LIMIT_REMAINING=${RATE_LIMIT_REMAINING:-0}
|
||||||
if ((RATE_LIMIT_REMAINING < 1)); then
|
if ((RATE_LIMIT_REMAINING < 1)); then
|
||||||
|
|
@ -45,7 +47,7 @@ if [ "$STATUS_CODE" == "403" ]; then
|
||||||
# Fall through to the normal path like any other failed status code
|
# Fall through to the normal path like any other failed status code
|
||||||
fi
|
fi
|
||||||
|
|
||||||
LATEST_BRANCH_COMMIT=$(cat $tmp | jq -r .commit.sha)
|
LATEST_BRANCH_COMMIT=$(cat $tmp | ./scripts/jq-nano - commit sha)
|
||||||
rm $tmp
|
rm $tmp
|
||||||
echo "Latest Branch Commit: $LATEST_BRANCH_COMMIT"
|
echo "Latest Branch Commit: $LATEST_BRANCH_COMMIT"
|
||||||
if [ -z "$LATEST_BRANCH_COMMIT" ]; then
|
if [ -z "$LATEST_BRANCH_COMMIT" ]; then
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,25 @@
|
||||||
|
#!/usr/bin/env node
|
||||||
|
|
||||||
|
const fs = require('fs');
|
||||||
|
const readline = require('readline');
|
||||||
|
|
||||||
|
const args = process.argv.slice(2);
|
||||||
|
const file = args.shift();
|
||||||
|
|
||||||
|
let text;
|
||||||
|
|
||||||
|
if ( file === '-' ) {
|
||||||
|
process.stdin.resume();
|
||||||
|
text = fs.readFileSync(0, "utf8");
|
||||||
|
} else {
|
||||||
|
text = fs.readFileSync(file, "utf8");
|
||||||
|
}
|
||||||
|
|
||||||
|
const data = JSON.parse(text);
|
||||||
|
|
||||||
|
let out = data;
|
||||||
|
while ( args.length ) {
|
||||||
|
out = out[args.shift()];
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log(out);
|
||||||
Loading…
Reference in New Issue