Skip to content
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

Rename CIRCLECI variables, with backwards compatibity #20

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions scripts/pin-to-cluster.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,23 @@ if [[ $# -eq 0 ]] ; then
echo 'CLUSTER_USER="who" \'
echo 'CLUSTER_PASSWORD="_secret_" \'
echo 'GITHUB_TOKEN="_secret" \'
echo 'CIRCLE_SHA1="bf3aae3bc98666fbf459b03ab2d87a97505bfab0" \'
echo 'CIRCLE_PROJECT_USERNAME="ipfs-shipyard" \'
echo 'CIRCLE_PROJECT_REPONAME="ipld-explorer" \'
echo 'SHA1="bf3aae3bc98666fbf459b03ab2d87a97505bfab0" \'
echo 'PROJECT_USERNAME="ipfs-shipyard" \'
echo 'PROJECT_REPONAME="ipld-explorer" \'
echo './pin-to-cluster.sh <pin name> <input root dir to pin recursivly>'
exit 1
fi

HOST=${CLUSTER_HOST:-"/dnsaddr/cluster.ipfs.io"}
# Default to CIRCLE_CI variables when not set
: "${SHA1:=$CIRCLE_SHA1}"
: "${PROJECT_USERNAME:=$CIRCLE_PROJECT_USERNAME}"
: "${PROJECT_REPONAME:=$CIRCLE_PROJECT_REPONAME}"
Comment on lines +24 to +26
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pls enlightne me. What does the preeceeding colon do here?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

Source ( grep for The following table )

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"these are not the colons you are (i am) looking for"

I meant the initial colon at the start of the line. I find this https://stackoverflow.com/a/4892546

A useful application for : is if you're only interested in using parameter expansions for their side-effects rather than actually passing their result to a command.

In that case, you use the parameter expansion as an argument to either : or false depending upon whether you want an exit status of 0 or 1. An example might be

: "${var:=$1}"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah sorry I misunderstood - yes, this is correct. If you don't add the : it will try to "run" the result.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Man, I copypasted from SO

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PIN_NAME=$1
INPUT_DIR=$2
STATUS_API_URL="https://api.github.com/repos/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME/statuses/$CIRCLE_SHA1"
INPUT_DIR=$2
STATUS_API_URL="https://api.github.com/repos/$PROJECT_USERNAME/$PROJECT_REPONAME/statuses/$SHA1"



update_github_status () {
local params
Expand Down