make sure curl fails on errors

This commit is contained in:
Rui Lopes 2021-04-26 06:47:12 +01:00
parent 92489ef7ad
commit 518b7fc148
3 changed files with 5 additions and 3 deletions

View File

@ -23,6 +23,8 @@ popd
# see https://help.sonatype.com/repomanager3/formats/apt-repositories # see https://help.sonatype.com/repomanager3/formats/apt-repositories
apt-get install -y curl apt-get install -y curl
curl \ curl \
--fail \
--show-error \
--user 'alice.doe:password' \ --user 'alice.doe:password' \
--header 'Content-Type: multipart/form-data' \ --header 'Content-Type: multipart/form-data' \
--data-binary @hello-world_1.0.0_amd64.deb \ --data-binary @hello-world_1.0.0_amd64.deb \

View File

@ -13,7 +13,7 @@ mkdir -p tmp/use-npm-repository && cd tmp/use-npm-repository
# install node LTS. # install node LTS.
# see https://github.com/nodesource/distributions#debinstall # see https://github.com/nodesource/distributions#debinstall
curl -sL https://deb.nodesource.com/setup_14.x | bash curl -sL --fail --show-error https://deb.nodesource.com/setup_14.x | bash
apt-get install -y nodejs apt-get install -y nodejs
node --version node --version
npm --version npm --version

View File

@ -14,8 +14,8 @@ apt-get install -y curl
# see https://help.sonatype.com/display/NXRM3/Raw+Repositories+and+Maven+Sites#RawRepositoriesandMavenSites-UploadingFilestoHostedRawRepositories # see https://help.sonatype.com/display/NXRM3/Raw+Repositories+and+Maven+Sites#RawRepositoriesandMavenSites-UploadingFilestoHostedRawRepositories
expected='this is an adhoc package' expected='this is an adhoc package'
echo "$expected" >package-1.0.0.txt echo "$expected" >package-1.0.0.txt
curl --silent --user 'alice.doe:password' --upload-file package-1.0.0.txt https://$nexus_domain/repository/adhoc-package/package-1.0.0.txt curl --silent --fail --show-error --user 'alice.doe:password' --upload-file package-1.0.0.txt https://$nexus_domain/repository/adhoc-package/package-1.0.0.txt
# download. # download.
actual=$(curl --silent https://$nexus_domain/repository/adhoc-package/package-1.0.0.txt) actual=$(curl --silent --fail --show-error https://$nexus_domain/repository/adhoc-package/package-1.0.0.txt)
[ "$actual" = "$expected" ] || (echo 'upload adhoc package test failed' && false) [ "$actual" = "$expected" ] || (echo 'upload adhoc package test failed' && false)