Skip to content

Commit

Permalink
ci/test-metrics: Clean up various bash quoting issues
Browse files Browse the repository at this point in the history
(cherry picked from commit 91cd124)
  • Loading branch information
bgamari committed Oct 28, 2021
1 parent 7fa8a0a commit 82e6bf1
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions .gitlab/test-metrics.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@ fail() {

function pull() {
local ref="refs/notes/$REF"
run git fetch -f $NOTES_ORIGIN $ref:$ref
run git fetch -f "$NOTES_ORIGIN" "$ref:$ref"
echo "perf notes ref $ref is $(git rev-parse $ref)"
}

# Reset the git notes and append the metrics file to the notes, then push and return the result.
# This is favoured over a git notes merge as it avoids potential data loss/duplication from the merge strategy.
function reset_append_note_push {
pull || true
run git notes --ref=$REF append -F $METRICS_FILE HEAD
run git push $PERF_NOTES_PUSH_REPO refs/notes/$REF
run git notes --ref="$REF" append -F "$METRICS_FILE" HEAD
run git push "$PERF_NOTES_PUSH_REPO" "refs/notes/$REF"
}

function push() {
Expand All @@ -41,17 +41,17 @@ function push() {
fi

# TEST_ENV must be set.
if [ -z ${TEST_ENV+"$TEST_ENV"} ]
if [ -z "${TEST_ENV:-}" ]
then
fail "Not pushing performance git notes: TEST_ENV must be set."
fi

# Assert that the METRICS_FILE exists and can be read.
if [ -z ${METRICS_FILE+"$METRICS_FILE"} ]
if [ -z "${METRICS_FILE:-}" ]
then
fail "\$METRICS_FILE not set."
fi
if ! [ -r $METRICS_FILE ]
if ! [ -r "$METRICS_FILE" ]
then
fail "Metrics file not found: $METRICS_FILE"
fi
Expand Down

0 comments on commit 82e6bf1

Please sign in to comment.