Skip to content

Commit

Permalink
fix deploy script
Browse files Browse the repository at this point in the history
  • Loading branch information
cyril-s committed Aug 13, 2018
1 parent a2ed4d4 commit 052b579
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
deploy:
skip_cleanup: true
provider: script
script: docker run --entrypoint /bin/bash oms:built deploy.sh "$API_ENDPOINT" stretch-onat stable main /local/build/*.deb
script: docker run --entrypoint /bin/bash oms:built deploy.sh "$API_ENDPOINT" "stretch-onat_stable_main" "stretch-onat/stretch" /local/build/*.deb
on:
tags: true
repo: onat-edu-ua/oms
20 changes: 8 additions & 12 deletions deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,23 @@
set -e

function usage(){
echo -e "usage: $0 api_base release distribution component deb_file1 [ deb_file2 ...]"
echo -e "usage: $0 <api_base> <local repo name> <publish prefix>/<publish distribution> deb_file1 [ deb_file2 ...]"
exit 1
}

[ -z "$1" ] && echo -e "\nmissed api base\n" && usage
[ -z "$2" ] && echo -e "\nmissed release\n" && usage
[ -z "$3" ] && echo -e "\nmissed distribution\n" && usage
[ -z "$4" ] && echo -e "\nmissed component\n" && usage
[ -z "$5" ] && echo -e "\nmissed package\n" && usage
[ -z "$2" ] && echo -e "\nmissed local repo name\n" && usage
[ -z "$3" ] && echo -e "\nmissed publish prefix and distribution\n" && usage
[ -z "$4" ] && echo -e "\nmissed package\n" && usage

api_base="$1"
shift
release="$1"
repo="$1"
shift
distr="$1"
shift
component="$1"
pub="$1"
shift

files="$@"
repo="${release}_${distr}_${component}"
timestamp="$(date +%s)"
dir="${repo}_${timestamp}"

Expand All @@ -40,6 +36,6 @@ done
echo -e "\n\e[33m> add pkg to repo $repo\e[39m\n"
curl -sSf -X POST "${api_base}/repos/$repo/file/$dir" || fail "can't add pkg to repo"

echo -e "\n\e[33m> update publish $release/$distr \e[39m\n"
curl -sSf -X PUT -H 'Content-Type: application/json' --data '{ "Signing": {"PassphraseFile":"/home/pkg/gpg_pass"} }' "${api_base}/publish/${release}/${distr}" || fail "can't publish"
echo -e "\n\e[33m> update publish $pub \e[39m\n"
curl -sSf -X PUT -H 'Content-Type: application/json' --data '{ "Signing": {"PassphraseFile":"/home/pkg/gpg_pass"} }' "${api_base}/publish/${pub}" || fail "can't publish"

0 comments on commit 052b579

Please sign in to comment.