forked from griddynamics/openstack-rhel
-
Notifications
You must be signed in to change notification settings - Fork 0
/
trigger-openstackx-new
executable file
·91 lines (79 loc) · 2.43 KB
/
trigger-openstackx-new
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#!/bin/bash
abspath="$(cd "${0%/*}" 2>/dev/null; echo "$PWD"/"${0##*/}")"
dirname="$(dirname $abspath)"
cd "$dirname" || exit -1
OurSpec="openstackx.spec"
prj=$(grep '^Name:' $OurSpec | sed 's/^Name:\s\+//')
GithubSource="griddynamics/openstackx"
ActualVersion="$(grep '^Version:' $OurSpec | sed 's/^Version:\s\+//')"
ActualRelease="0.`date +%Y%m%d.%H%M`"
ActualTarBall=%{name}-%{version}.tar.gz
source trigger.conf
source build_helpers
# If you need to build a specific version - specify it as ./build release_num (digits only).
# If build # is not specified, latest available tarball will be built
#
# Project details:
# To build we need take rackspace sources from their tree, generate tar.gz, take OUR spec file and patches from openstack-rhel and build it all together
# To auto-build we are checking if OUR spec updated. If yes - get new sources and run build. We DO NOT run build after update of sources.
# Usual usage:
# get new version to local pc
# test and fix
# generate patches for release
# update spec (insert patches, update version)
# push spec and patches to github
# Commands to run:
# build - get new sources and build project
# check - check for sources update
# build_ver - build specified release
# release_check - check for speck update
# release_build - build without downloading sources (if spec update)
#
case "$1" in
build)
check_enviroment
check_spec_update
check_git_update
get_git
update_spec
create_srpm
create_rpm && commit_spec || undo_changes
sign_rpm
update_repo
#do_mock
exit 0
;;
check)
check_git_update
check_spec_update
[[ $FireNewBuild == "1" ]] || exit 0
curl -s "http://$jenkins/job/$JobName/build"
[ $Debug ] && echo "Fire jenkins to build $JobName"
exit 0
;;
build_ver)
ActualRelease=$2
build
;;
release_check)
check_spec_update
[[ $FireNewBuild == "1" ]] || exit 0
curl -s "http://$jenkins/job/$JobName/build"
[ $Debug ] && echo "Fire jenkins to build $JobName"
exit 0
;;
release_build)
create_rpm # && commit_spec || undo_changes
sign_rpm
update_repo
;;
*)
echo $"Usage: $0 {build|check|build_ver|release}"
echo "build - build rpms"
echo "check - check for updates and trigger jenkins"
echo "build_ver NUM - build specified release"
echo "release_check - check release if spec update"
echo "release_build - build release"
exit 2
esac
exit $?