grim/convey
Clone
Summary
Browse
Changes
Graph
Missed a bunch of updates on unit tests for the options update
2018-01-21, Gary Kramlich
2909e17deafe
file is
Executable
Missed a bunch of updates on unit tests for the options update
#!/bin/sh
set
-e
if
[
-z
"
${
BITBUCKET_REPO
}
"
]
;
then
echo
"you must specify a BITBUCKET_REPO"
>
&
2
exit
1
fi
if
[
-z
"
${
BITBUCKET_AUTH_USER
}
"
]
;
then
echo
"BITBUCKET_AUTH_USER not set. You must specify a user to authenticate as"
exit
1
fi
if
[
-z
"
${
BITBUCKET_AUTH_PASSWORD
}
"
]
;
then
echo
"BITBUCKET_AUTH_PASSWORD not set."
exit
1
fi
BITBUCKET_HOST
=
"
${
BITBUCKET_HOST
:-
api
.bitbucket.org
}
"
BITBUCKET_ROOT_URL
=
"
${
BITBUCKET_URL
:-
https
://
${
BITBUCKET_HOST
}
/2.0/
}
"
BITBUCKET_ROOT_URL
=
$(
echo
${
BITBUCKET_ROOT_URL
}
|
sed
's@/*$@@'
)
BITBUCKET_REPO
=
$(
echo
${
BITBUCKET_REPO
}
|
sed
's@^/*@@'
|
sed
's@/*$@@'
)
cd
${
CONVEY_WORKSPACE
}
FILE_ARGS
=
""
for
FILE_NAME
in
${
BITBUCKET_FILES
}
;
do
FILE_ARGS
=
"
${
FILE_ARGS
}
-F files=@\"
${
FILE_NAME
}
\""
done
set
+x
printf
"machine
${
BITBUCKET_HOST
}
login
${
BITBUCKET_AUTH_USER
}
password
${
BITBUCKET_AUTH_PASSWORD
}
"
|
\
(
set
-x
;
curl
${
BITBUCKET_OPTIONS
}
--netrc-file
/dev/stdin
${
BITBUCKET_ROOT_URL
}
/repositories/
${
BITBUCKET_REPO
}
/downloads
${
FILE_ARGS
}
)