Skip to content

Commit

Permalink
Fix COS version upload (Yelp#260)
Browse files Browse the repository at this point in the history
* Fix COS version upload

* Specify region

* Remove version.txt

* Python libs

* fail build

* pass build?

* Fix false 0 exit code

* Fix exit status issue

* save line
  • Loading branch information
justineyster committed Jun 24, 2020
1 parent 8ab0bac commit 87e9b5f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
7 changes: 5 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,18 @@ script: |
VERSION_TAG=$(tr '+' '.' <<<"$TRAVIS_TAG")
./tag-and-publish.sh "$DOCKER_IMAGES" "$DOCKER_DOMAIN_LOCAL" "$DOCKER_REMOTE_DOMAINS" "$VERSION_TAG"
if python scripts/version_greater_than_in_cos.py "$TRAVIS_TAG"
pip install requests packaging
should_update=$(python scripts/version_greater_than_in_cos.py "$TRAVIS_TAG")
if [ "$should_update" == "yes" ]
then
# install ibmcloud cli
curl -sL https://raw.githubusercontent.com/IBM-Cloud/ibm-cloud-developer-tools/master/linux-installer/idt-installer | bash
ibmcloud plugin install cloud-object-storage
# login to ibm cloud
ibmcloud login --apikey ${IBM_CLOUD_API_KEY} -a https://cloud.ibm.com -r us-east
# update latest version in ibmcloud object storage
echo $TRAVIS_TAG > version.txt
ibmcloud cos put-object --bucket detect-secrets-client-version --key version --body version.txt
ibmcloud cos put-object --bucket detect-secrets-client-version --key version --body version.txt --region us-south
fi
fi
cache:
Expand Down
5 changes: 3 additions & 2 deletions scripts/version_greater_than_in_cos.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ def version_greater_than_in_cos(new_version):
latest_version = parse(resp.text)
new_version = parse(new_version)
if new_version > latest_version:
sys.exit(0)
print('yes')
else:
sys.exit(1)
print('no')
sys.exit(0)


if __name__ == '__main__':
Expand Down

0 comments on commit 87e9b5f

Please sign in to comment.