From 327eab305c0aefff8448ccf28092f5ee555f103e Mon Sep 17 00:00:00 2001 From: Scott Arnette Date: Tue, 17 Sep 2019 13:32:44 -0400 Subject: [PATCH 1/4] Fix issue where specifying commit would break grep. --- .cicd/helpers/dependency-info.sh | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/.cicd/helpers/dependency-info.sh b/.cicd/helpers/dependency-info.sh index f29ac1cb3..fe7a1e393 100755 --- a/.cicd/helpers/dependency-info.sh +++ b/.cicd/helpers/dependency-info.sh @@ -14,12 +14,14 @@ else exit 1 fi if [[ $TRAVIS ]]; then - CDT_COMMIT=$((curl -H "Authorization: token $key" -s https://api.github.com/repos/EOSIO/eosio.cdt/git/refs/tags/$CDT_VERSION && curl -H "Authorization: token $key" -s https://api.github.com/repos/EOSIO/eosio.cdt/git/refs/heads/$CDT_VERSION) | jq '.object.sha' | grep -v 'null' | tr -d '"' | sed -n '1p') # search GitHub for commit hash by tag and branch, preferring tag if both match - EOSIO_COMMIT=$((curl -H "Authorization: token $key" -s https://api.github.com/repos/EOSIO/eos/git/refs/tags/$EOSIO_VERSION && curl -H "Authorization: token $key" -s https://api.github.com/repos/EOSIO/eos/git/refs/heads/$EOSIO_VERSION) | jq '.object.sha' | grep -v 'null' | tr -d '"' | sed -n '1p') # search GitHub for commit hash by tag and branch, preferring tag if both match -else - CDT_COMMIT=$((curl -s https://api.github.com/repos/EOSIO/eosio.cdt/git/refs/tags/$CDT_VERSION && curl -s https://api.github.com/repos/EOSIO/eosio.cdt/git/refs/heads/$CDT_VERSION) | jq '.object.sha' | grep -v 'null' | tr -d '"' | sed -n '1p') # search GitHub for commit hash by tag and branch, preferring tag if both match - EOSIO_COMMIT=$((curl -s https://api.github.com/repos/EOSIO/eos/git/refs/tags/$EOSIO_VERSION && curl -s https://api.github.com/repos/EOSIO/eos/git/refs/heads/$EOSIO_VERSION) | jq '.object.sha' | grep -v 'null' | tr -d '"' | sed -n '1p') # search GitHub for commit hash by tag and branch, preferring tag if both match + AUTH="-H \"Authorization: token $key\"" fi + +# search GitHub for commit hash by tag and branch, preferring tag if both match +CDT_COMMIT=$((curl $AUTH -s https://api.github.com/repos/EOSIO/eosio.cdt/git/refs/tags/$CDT_VERSION && curl $AUTH -s https://api.github.com/repos/EOSIO/eosio.cdt/git/refs/heads/$CDT_VERSION) | jq '.object.sha' | sed "s/null//g" | sed "/^$/d" | tr -d '"' | sed -n '1p') + +EOSIO_COMMIT=$((curl $AUTH -s https://api.github.com/repos/EOSIO/eos/git/refs/tags/$EOSIO_VERSION && curl $AUTH -s https://api.github.com/repos/EOSIO/eos/git/refs/heads/$EOSIO_VERSION) | jq '.object.sha' | sed "s/null//g" | sed "/^$/d" | tr -d '"' | sed -n '1p') + test -z "$CDT_COMMIT" && CDT_COMMIT=$(echo $CDT_VERSION | tr -d '"' | tr -d "''" | cut -d ' ' -f 1) # if both searches returned nothing, the version is probably specified by commit hash already echo "Using cdt ${CDT_COMMIT:0:7} from \"$CDT_VERSION\"..." test -z "$EOSIO_COMMIT" && EOSIO_COMMIT=$(echo $EOSIO_VERSION | tr -d '"' | tr -d "''" | cut -d ' ' -f 1) # if both searches returned nothing, the version is probably specified by commit hash already From e69bcc591ce69ad1f9994a3176d384a88835f09e Mon Sep 17 00:00:00 2001 From: Scott Arnette Date: Tue, 17 Sep 2019 13:45:23 -0400 Subject: [PATCH 2/4] Switch back to separate Travis command. --- .cicd/helpers/dependency-info.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.cicd/helpers/dependency-info.sh b/.cicd/helpers/dependency-info.sh index fe7a1e393..75a52bac6 100755 --- a/.cicd/helpers/dependency-info.sh +++ b/.cicd/helpers/dependency-info.sh @@ -13,15 +13,15 @@ else echo 'ERROR: No pipeline configuration file or dependencies file found!' exit 1 fi +# search GitHub for commit hash by tag and branch, preferring tag if both match if [[ $TRAVIS ]]; then - AUTH="-H \"Authorization: token $key\"" + CDT_COMMIT=$((curl -H "Authorization: token $key" -s https://api.github.com/repos/EOSIO/eosio.cdt/git/refs/tags/$CDT_VERSION && curl $AUTH -s https://api.github.com/repos/EOSIO/eosio.cdt/git/refs/heads/$CDT_VERSION) | jq '.object.sha' | sed "s/null//g" | sed "/^$/d" | tr -d '"' | sed -n '1p') + EOSIO_COMMIT=$((curl -H "Authorization: token $key" -s https://api.github.com/repos/EOSIO/eos/git/refs/tags/$EOSIO_VERSION && curl $AUTH -s https://api.github.com/repos/EOSIO/eos/git/refs/heads/$EOSIO_VERSION) | jq '.object.sha' | sed "s/null//g" | sed "/^$/d" | tr -d '"' | sed -n '1p') +else + CDT_COMMIT=$((curl $AUTH -s https://api.github.com/repos/EOSIO/eosio.cdt/git/refs/tags/$CDT_VERSION && curl $AUTH -s https://api.github.com/repos/EOSIO/eosio.cdt/git/refs/heads/$CDT_VERSION) | jq '.object.sha' | sed "s/null//g" | sed "/^$/d" | tr -d '"' | sed -n '1p') + EOSIO_COMMIT=$((curl $AUTH -s https://api.github.com/repos/EOSIO/eos/git/refs/tags/$EOSIO_VERSION && curl $AUTH -s https://api.github.com/repos/EOSIO/eos/git/refs/heads/$EOSIO_VERSION) | jq '.object.sha' | sed "s/null//g" | sed "/^$/d" | tr -d '"' | sed -n '1p') fi -# search GitHub for commit hash by tag and branch, preferring tag if both match -CDT_COMMIT=$((curl $AUTH -s https://api.github.com/repos/EOSIO/eosio.cdt/git/refs/tags/$CDT_VERSION && curl $AUTH -s https://api.github.com/repos/EOSIO/eosio.cdt/git/refs/heads/$CDT_VERSION) | jq '.object.sha' | sed "s/null//g" | sed "/^$/d" | tr -d '"' | sed -n '1p') - -EOSIO_COMMIT=$((curl $AUTH -s https://api.github.com/repos/EOSIO/eos/git/refs/tags/$EOSIO_VERSION && curl $AUTH -s https://api.github.com/repos/EOSIO/eos/git/refs/heads/$EOSIO_VERSION) | jq '.object.sha' | sed "s/null//g" | sed "/^$/d" | tr -d '"' | sed -n '1p') - test -z "$CDT_COMMIT" && CDT_COMMIT=$(echo $CDT_VERSION | tr -d '"' | tr -d "''" | cut -d ' ' -f 1) # if both searches returned nothing, the version is probably specified by commit hash already echo "Using cdt ${CDT_COMMIT:0:7} from \"$CDT_VERSION\"..." test -z "$EOSIO_COMMIT" && EOSIO_COMMIT=$(echo $EOSIO_VERSION | tr -d '"' | tr -d "''" | cut -d ' ' -f 1) # if both searches returned nothing, the version is probably specified by commit hash already From 1999854681d1f59973f7a346117287380664c23d Mon Sep 17 00:00:00 2001 From: Scott Arnette Date: Tue, 17 Sep 2019 14:03:33 -0400 Subject: [PATCH 3/4] Cleanup of old auth variable. --- .cicd/helpers/dependency-info.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.cicd/helpers/dependency-info.sh b/.cicd/helpers/dependency-info.sh index 75a52bac6..12bd6e9a8 100755 --- a/.cicd/helpers/dependency-info.sh +++ b/.cicd/helpers/dependency-info.sh @@ -15,11 +15,11 @@ else fi # search GitHub for commit hash by tag and branch, preferring tag if both match if [[ $TRAVIS ]]; then - CDT_COMMIT=$((curl -H "Authorization: token $key" -s https://api.github.com/repos/EOSIO/eosio.cdt/git/refs/tags/$CDT_VERSION && curl $AUTH -s https://api.github.com/repos/EOSIO/eosio.cdt/git/refs/heads/$CDT_VERSION) | jq '.object.sha' | sed "s/null//g" | sed "/^$/d" | tr -d '"' | sed -n '1p') - EOSIO_COMMIT=$((curl -H "Authorization: token $key" -s https://api.github.com/repos/EOSIO/eos/git/refs/tags/$EOSIO_VERSION && curl $AUTH -s https://api.github.com/repos/EOSIO/eos/git/refs/heads/$EOSIO_VERSION) | jq '.object.sha' | sed "s/null//g" | sed "/^$/d" | tr -d '"' | sed -n '1p') + CDT_COMMIT=$((curl -H "Authorization: token $key" -s https://api.github.com/repos/EOSIO/eosio.cdt/git/refs/tags/$CDT_VERSION && curl -H "Authorization: token $key" -s https://api.github.com/repos/EOSIO/eosio.cdt/git/refs/heads/$CDT_VERSION) | jq '.object.sha' | sed "s/null//g" | sed "/^$/d" | tr -d '"' | sed -n '1p') + EOSIO_COMMIT=$((curl -H "Authorization: token $key" -s https://api.github.com/repos/EOSIO/eos/git/refs/tags/$EOSIO_VERSION && curl -H "Authorization: token $key" -s https://api.github.com/repos/EOSIO/eos/git/refs/heads/$EOSIO_VERSION) | jq '.object.sha' | sed "s/null//g" | sed "/^$/d" | tr -d '"' | sed -n '1p') else - CDT_COMMIT=$((curl $AUTH -s https://api.github.com/repos/EOSIO/eosio.cdt/git/refs/tags/$CDT_VERSION && curl $AUTH -s https://api.github.com/repos/EOSIO/eosio.cdt/git/refs/heads/$CDT_VERSION) | jq '.object.sha' | sed "s/null//g" | sed "/^$/d" | tr -d '"' | sed -n '1p') - EOSIO_COMMIT=$((curl $AUTH -s https://api.github.com/repos/EOSIO/eos/git/refs/tags/$EOSIO_VERSION && curl $AUTH -s https://api.github.com/repos/EOSIO/eos/git/refs/heads/$EOSIO_VERSION) | jq '.object.sha' | sed "s/null//g" | sed "/^$/d" | tr -d '"' | sed -n '1p') + CDT_COMMIT=$((curl -s https://api.github.com/repos/EOSIO/eosio.cdt/git/refs/tags/$CDT_VERSION && curl -s https://api.github.com/repos/EOSIO/eosio.cdt/git/refs/heads/$CDT_VERSION) | jq '.object.sha' | sed "s/null//g" | sed "/^$/d" | tr -d '"' | sed -n '1p') + EOSIO_COMMIT=$((curl -s https://api.github.com/repos/EOSIO/eos/git/refs/tags/$EOSIO_VERSION && curl -s https://api.github.com/repos/EOSIO/eos/git/refs/heads/$EOSIO_VERSION) | jq '.object.sha' | sed "s/null//g" | sed "/^$/d" | tr -d '"' | sed -n '1p') fi test -z "$CDT_COMMIT" && CDT_COMMIT=$(echo $CDT_VERSION | tr -d '"' | tr -d "''" | cut -d ' ' -f 1) # if both searches returned nothing, the version is probably specified by commit hash already From da799f5293a67aa632a24ff06a521d55ed8c49f4 Mon Sep 17 00:00:00 2001 From: Scott Arnette Date: Tue, 17 Sep 2019 14:06:41 -0400 Subject: [PATCH 4/4] Remove whitespace. --- .cicd/helpers/dependency-info.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/.cicd/helpers/dependency-info.sh b/.cicd/helpers/dependency-info.sh index 12bd6e9a8..1ce31f3da 100755 --- a/.cicd/helpers/dependency-info.sh +++ b/.cicd/helpers/dependency-info.sh @@ -21,10 +21,8 @@ else CDT_COMMIT=$((curl -s https://api.github.com/repos/EOSIO/eosio.cdt/git/refs/tags/$CDT_VERSION && curl -s https://api.github.com/repos/EOSIO/eosio.cdt/git/refs/heads/$CDT_VERSION) | jq '.object.sha' | sed "s/null//g" | sed "/^$/d" | tr -d '"' | sed -n '1p') EOSIO_COMMIT=$((curl -s https://api.github.com/repos/EOSIO/eos/git/refs/tags/$EOSIO_VERSION && curl -s https://api.github.com/repos/EOSIO/eos/git/refs/heads/$EOSIO_VERSION) | jq '.object.sha' | sed "s/null//g" | sed "/^$/d" | tr -d '"' | sed -n '1p') fi - test -z "$CDT_COMMIT" && CDT_COMMIT=$(echo $CDT_VERSION | tr -d '"' | tr -d "''" | cut -d ' ' -f 1) # if both searches returned nothing, the version is probably specified by commit hash already echo "Using cdt ${CDT_COMMIT:0:7} from \"$CDT_VERSION\"..." test -z "$EOSIO_COMMIT" && EOSIO_COMMIT=$(echo $EOSIO_VERSION | tr -d '"' | tr -d "''" | cut -d ' ' -f 1) # if both searches returned nothing, the version is probably specified by commit hash already echo "Using eosio ${EOSIO_COMMIT:0:7} from \"$EOSIO_VERSION\"..." - export CDT_URL="https://eos-public-oss-binaries.s3-us-west-2.amazonaws.com/${CDT_COMMIT:0:7}-eosio.cdt-ubuntu-18.04_amd64.deb" \ No newline at end of file