-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcreate_service_targit_webhook.sh
executable file
·70 lines (49 loc) · 1.39 KB
/
create_service_targit_webhook.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/bin/sh
#
# Create _service file for obs with tar_git and webhook
set -e
scriptdir="$(dirname -- "$( readlink -f -- "$0"; )")"
. $scriptdir/shared.sh
branch=master
usage() {
cat <<EOF
usage: create_targit_webhook_package.sh [options] packages
options:
-r repository url
-b target branch
-w Create webhook service (default)
-W Don't create webhook service
-P OBS Project to upload to
-p OBS Package to create
-A API url to the target obs, defaults to $obs_api_url
-h Show this help
EOF
}
webhook="--webhook"
while getopts hr:b:P:p:A:wW arg ; do
case $arg in
r) repository=$OPTARG;;
b) branch=$OPTARG;;
P) obs_project=$OPTARG;;
p) obs_package=$OPTARG;;
A) obs_api_url=$OPTARG;;
w) webhook="--webhook";;
W) webhook="";;
h) usage; exit 0;;
?|*) usage; exit 1;;
esac
done
obs_default_opts="-A $obs_api_url"
obs_checkout_prj "$obs_project"
obs_cd_project "$obs_project" || exit $?
if [ -e "$obs_package" ] ; then
die "Package already exists"
fi
osc mkpac "$obs_package"
cd "$obs_package"
$scriptdir/osc_service_add.py --package "$obs_package" \
--project "$obs_project" \
--branch "$branch" \
--repository "$repository" $webhook _service
osc add _service
osc commit -m"Added package"