@cryptotaxi247 / netdata-1 / commits / 74dd65e22

netdata/packaging: Fix RPM packaging workflow issues, plus draft changes for .DEB packaging (#6415)

* netdata/packaging: enable builds on our dev repo to initiate working * netdata/packaging: first round of fixes and changes 1) Factor out source preparation for latest code 2) Prepare stable/latest build branching on deb code 3) In Travis, make branch code selection variables to make changes easier (Found a missed change when merging to prod, so the variables will make switching cleaner and easier) 4) Clean v letter from stable version for RPM (side fix) More to come, at this point nothing should be yet working * netdata/packaging: [ci skip] dont run epel install for centos 7/i386 * netdata/packaging: [ci skip] add all of them * netdata/packaging: [ci skip] redesign stable build. Just checkout the tag, dont rely on the published source because we want the binaries out before the release * netdata/packaging: oh lord.. the versioning.. * netdata/packaging: [ci skip] add git depth false * netdata/packaging: [ci skip] Do a git fetch first, so that checkout can actually work.. (mercy) * netdata/packaging: [ci skip] Do it all * netdata/packaging: [ci skip] Some more debug information and make sure you checkout master before any other action * netdata/packaging: [ci skip] didnt fix the problem, remove * netdata/packaging:[ci skip] Attempt to bring the right branch * netdata/packaging: [ci skip] Extreme, use a large depth and see what it will bring onboard. remove useless commands * netdata/packaging: [ci skip] found the culprit, was on the forked repo - bring back the expected commands * netdata/packaging: [ci skip] Well, do it a bit different otherwise we cant cheat the versioning problem. Check out the tag if necessary and always do anotated tagging with the right version * netdata/packaging: [ci skip] a couple of debug message nits and styles, plus one more further alignment of packaging process for .DEB 1) Clean style a bit 2) Clean some messages and comments 3) Bring the RPM processs to DEB packaging, for the tarball retrieval and placement * netdata/packaging: [ci skip] factor out common dependencies, to reuse on both cases * netdata/packaging: [ci skip] Reinstate the production branch assignments we added for testing, also fix call to method * netdata/packaging: do NOT trigger on pull requests, of course

Paul Emm. Katsoulakis committed Jul 10, 2019 at 13:42 UTC 74dd65e22f45fdcfb3ddea224cfd9825c640fd69
4 files changed +127 -100
.travis.yml
+31 -19
@@ -64,44 +64,44 @@ stages:
64 # Build DEB packages under special conditions
65 # Ubuntu
66 - name: "Package ubuntu/disco"
67 - if: type != cron AND branch = master AND commit_message =~ /(\[Package arm64 DEB Ubuntu\]|\[Package arm64 DEB\]|\[Package i386 DEB Ubuntu\]|\[Package i386 DEB\]|\[Package AMD64 DEB Ubuntu\]|\[Package AMD64 DEB\])/
67 + if: type != cron AND type != pull_request AND branch = master AND commit_message =~ /(\[Package arm64 DEB Ubuntu\]|\[Package arm64 DEB\]|\[Package i386 DEB Ubuntu\]|\[Package i386 DEB\]|\[Package AMD64 DEB Ubuntu\]|\[Package AMD64 DEB\])/
68 - name: "Package ubuntu/cosmic"
69 - if: type != cron AND branch = master AND commit_message =~ /(\[Package arm64 DEB Ubuntu\]|\[Package arm64 DEB\]|\[Package i386 DEB Ubuntu\]|\[Package i386 DEB\]|\[Package AMD64 DEB Ubuntu\]|\[Package AMD64 DEB\])/
69 + if: type != cron AND type != pull_request AND branch = master AND commit_message =~ /(\[Package arm64 DEB Ubuntu\]|\[Package arm64 DEB\]|\[Package i386 DEB Ubuntu\]|\[Package i386 DEB\]|\[Package AMD64 DEB Ubuntu\]|\[Package AMD64 DEB\])/
70 - name: "Package ubuntu/bionic"
71 - if: type != cron AND branch = master AND commit_message =~ /(\[Package arm64 DEB Ubuntu\]|\[Package arm64 DEB\]|\[Package i386 DEB Ubuntu\]|\[Package i386 DEB\]|\[Package AMD64 DEB Ubuntu\]|\[Package AMD64 DEB\])/
71 + if: type != cron AND type != pull_request AND branch = master AND commit_message =~ /(\[Package arm64 DEB Ubuntu\]|\[Package arm64 DEB\]|\[Package i386 DEB Ubuntu\]|\[Package i386 DEB\]|\[Package AMD64 DEB Ubuntu\]|\[Package AMD64 DEB\])/
72 - name: "Package ubuntu/artful"
73 - if: type != cron AND branch = master AND commit_message =~ /(\[Package arm64 DEB Ubuntu\]|\[Package arm64 DEB\]|\[Package i386 DEB Ubuntu\]|\[Package i386 DEB\]|\[Package AMD64 DEB Ubuntu\]|\[Package AMD64 DEB\])/
73 + if: type != cron AND type != pull_request AND branch = master AND commit_message =~ /(\[Package arm64 DEB Ubuntu\]|\[Package arm64 DEB\]|\[Package i386 DEB Ubuntu\]|\[Package i386 DEB\]|\[Package AMD64 DEB Ubuntu\]|\[Package AMD64 DEB\])/
74
75 # Debian
76 - name: "Package debian/buster"
77 - if: type != cron AND branch = master AND commit_message =~ /(\[Package arm64 DEB Debian\]|\[Package arm64 DEB\]|\[Package i386 DEB Debian\]|\[Package i386 DEB\]|\[Package AMD64 DEB Debian\]|\[Package AMD64 DEB\])/
77 + if: type != cron AND type != pull_request AND branch = master AND commit_message =~ /(\[Package arm64 DEB Debian\]|\[Package arm64 DEB\]|\[Package i386 DEB Debian\]|\[Package i386 DEB\]|\[Package AMD64 DEB Debian\]|\[Package AMD64 DEB\])/
78 - name: "Package debian/stretch"
79 - if: type != cron AND branch = master AND commit_message =~ /(\[Package arm64 DEB Debian\]|\[Package arm64 DEB\]|\[Package i386 DEB Debian\]|\[Package i386 DEB\]|\[Package AMD64 DEB Debian\]|\[Package AMD64 DEB\])/
79 + if: type != cron AND type != pull_request AND branch = master AND commit_message =~ /(\[Package arm64 DEB Debian\]|\[Package arm64 DEB\]|\[Package i386 DEB Debian\]|\[Package i386 DEB\]|\[Package AMD64 DEB Debian\]|\[Package AMD64 DEB\])/
80 - name: "Package debian/jessie"
81 - if: type != cron AND branch = master AND commit_message =~ /(\[Package arm64 DEB Debian\]|\[Package arm64 DEB\]|\[Package i386 DEB Debian\]|\[Package i386 DEB\]|\[Package AMD64 DEB Debian\]|\[Package AMD64 DEB\])/
81 + if: type != cron AND type != pull_request AND branch = master AND commit_message =~ /(\[Package arm64 DEB Debian\]|\[Package arm64 DEB\]|\[Package i386 DEB Debian\]|\[Package i386 DEB\]|\[Package AMD64 DEB Debian\]|\[Package AMD64 DEB\])/
82 - name: "Package debian/wheezy"
83 - if: type != cron AND branch = master AND commit_message =~ /(\[Package arm64 DEB Debian\]|\[Package arm64 DEB\]|\[Package i386 DEB Debian\]|\[Package i386 DEB\]|\[Package AMD64 DEB Debian\]|\[Package AMD64 DEB\])/
83 + if: type != cron AND type != pull_request AND branch = master AND commit_message =~ /(\[Package arm64 DEB Debian\]|\[Package arm64 DEB\]|\[Package i386 DEB Debian\]|\[Package i386 DEB\]|\[Package AMD64 DEB Debian\]|\[Package AMD64 DEB\])/
84
85 # Build RPM packages under special conditions
86 # Enterprise linux (Covers CentOS, Redhat, Amazon linux)
87 - name: "Package Enterprise Linux 7"
88 - if: type != cron AND branch = master AND commit_message =~ /(\[Package arm64 RPM Enterprise Linux\]|\[Package arm64 RPM\]|\[Package i386 RPM Enterprise Linux\]|\[Package i386 RPM\]|\[Package AMD64 RPM Enterprise Linux\]|\[Package AMD64 RPM\])/
88 + if: type != cron AND type != pull_request AND branch = master AND commit_message =~ /(\[Package arm64 RPM Enterprise Linux\]|\[Package arm64 RPM\]|\[Package i386 RPM Enterprise Linux\]|\[Package i386 RPM\]|\[Package AMD64 RPM Enterprise Linux\]|\[Package AMD64 RPM\])/
89 - name: "Package Enterprise linux 6"
90 - if: type != cron AND branch = master AND commit_message =~ /(\[Package i386 RPM Enterprise Linux\]|\[Package i386 RPM\]|\[Package AMD64 RPM Enterprise Linux\]|\[Package AMD64 RPM\])/
90 + if: type != cron AND type != pull_request AND branch = master AND commit_message =~ /(\[Package i386 RPM Enterprise Linux\]|\[Package i386 RPM\]|\[Package AMD64 RPM Enterprise Linux\]|\[Package AMD64 RPM\])/
91
92 # Fedora
93 - name: "Package Fedora 30"
94 - if: type != cron AND branch = master AND commit_message =~ /(\[Package arm64 RPM Fedora\]|\[Package arm64 RPM\]|\[Package AMD64 RPM Fedora\]|\[Package AMD64 RPM\])/
94 + if: type != cron AND type != pull_request AND branch = master AND commit_message =~ /(\[Package arm64 RPM Fedora\]|\[Package arm64 RPM\]|\[Package AMD64 RPM Fedora\]|\[Package AMD64 RPM\])/
95 - name: "Package Fedora 29"
96 - if: type != cron AND branch = master AND commit_message =~ /(\[Package arm64 RPM Fedora\]|\[Package arm64 RPM\]|\[Package AMD64 RPM Fedora\]|\[Package AMD64 RPM\])/
96 + if: type != cron AND type != pull_request AND branch = master AND commit_message =~ /(\[Package arm64 RPM Fedora\]|\[Package arm64 RPM\]|\[Package AMD64 RPM Fedora\]|\[Package AMD64 RPM\])/
97 - name: "Package Fedora 28"
98 - if: type != cron AND branch = master AND commit_message =~ /(\[Package arm64 RPM Fedora\]|\[Package arm64 RPM\]|\[Package AMD64 RPM Fedora\]|\[Package AMD64 RPM\])/
98 + if: type != cron AND type != pull_request AND branch = master AND commit_message =~ /(\[Package arm64 RPM Fedora\]|\[Package arm64 RPM\]|\[Package AMD64 RPM Fedora\]|\[Package AMD64 RPM\])/
99
100 # OpenSuSE
101 - name: "Package OpenSuSE 15.1"
102 - if: type != cron AND branch = master AND commit_message =~ /(\[Package arm64 RPM openSuSE\]|\[Package arm64 RPM\]|\[Package AMD64 RPM openSuSE\]|\[Package AMD64 RPM\])/
102 + if: type != cron AND type != pull_request AND branch = master AND commit_message =~ /(\[Package arm64 RPM openSuSE\]|\[Package arm64 RPM\]|\[Package AMD64 RPM openSuSE\]|\[Package AMD64 RPM\])/
103 - name: "Package OpenSuSE 15.0"
104 - if: type != cron AND branch = master AND commit_message =~ /(\[Package arm64 RPM openSuSE\]|\[Package arm64 RPM\]|\[Package AMD64 RPM openSuSE\]|\[Package AMD64 RPM\])/
104 + if: type != cron AND type != pull_request AND branch = master AND commit_message =~ /(\[Package arm64 RPM openSuSE\]|\[Package arm64 RPM\]|\[Package AMD64 RPM openSuSE\]|\[Package AMD64 RPM\])/
105
106
107
@@ -115,12 +115,17 @@ stages:
115 - post_message "TRAVIS_MESSAGE" "Starting package preparation and publishing for ${BUILD_STRING}.${BUILD_ARCH}" "${NOTIF_CHANNEL}"
116 - export PACKAGES_DIRECTORY="$(mktemp -d -t netdata-packaging-contents-dir-XXXXXX)" && echo "Created packaging directory ${PACKAGES_DIRECTORY}"
117 script:
118 + - echo "GIT Branch:" && git branch
119 + - echo "Last commit:" && git log -1
120 + - echo "GIT Describe:" && git describe
121 + - echo "packaging/version:" && cat packaging/version
122 - echo "Creating LXC environment for the build" && sudo -E .travis/package_management/create_lxc_for_build.sh
123 - echo "Building package in container" && sudo -E .travis/package_management/build_package_in_container.sh
124 - sudo chmod -R 755 "/var/lib/lxc"
125 - echo "Preparing RPM packaging contents for upload" && sudo -E .travis/package_management/prepare_packages.sh
126 + git:
127 + depth: false
128 after_failure: post_message "TRAVIS_MESSAGE" "Failed to build RPM for ${BUILD_STRING}.${BUILD_ARCH}"
123 -
129 before_deploy:
130 - .travis/package_management/yank_stale_rpm.sh "${PACKAGES_DIRECTORY}" "${BUILD_STRING}" || echo "No stale RPM found"
131 deploy:
@@ -135,7 +140,7 @@ stages:
140 on:
141 # Only deploy on ${USER}/netdata, master branch, when packages directory is created
142 repo: ${TRAVIS_REPO_SLUG}
138 - branch: master
143 + branch: "master"
144 condition: -d "${PACKAGES_DIRECTORY}"
145 # Production release packages deployment
146 - provider: packagecloud
@@ -155,6 +160,7 @@ stages:
160 - if [ -d "${PACKAGES_DIRECTORY}" ]; then rm -rf "${PACKAGES_DIRECTORY}"; fi;
161
162
163 +
164 # TODO: This section is stale, will be aligned with the RPM implementation when we get to DEB packaging
165 - stage: &_DEB_TEMPLATE
166 name: "Build & Publish DEB package"
@@ -165,10 +171,16 @@ stages:
171 - post_message "TRAVIS_MESSAGE" "Starting package preparation and publishing for ${BUILD_STRING}.${BUILD_ARCH}" "${NOTIF_CHANNEL}"
172 - export PACKAGES_DIRECTORY="$(mktemp -d -t netdata-packaging-contents-dir-XXXXXX)" && echo "Created packaging directory ${PACKAGES_DIRECTORY}"
173 script:
174 + - echo "GIT Branch:" && git branch
175 + - echo "Last commit:" && git log -1
176 + - echo "GIT Describe:" && git describe
177 + - echo "packaging/version:" && cat packaging/version
178 - echo "Creating LXC environment for the build" && sudo -E .travis/package_management/create_lxc_for_build.sh
179 - echo "Building package in container" && sudo -E .travis/package_management/build_package_in_container.sh
180 - sudo chmod -R 755 "/var/lib/lxc"
181 - echo "Preparing DEB packaging contents for upload" && sudo -E .travis/package_management/prepare_packages.sh
182 + git:
183 + depth: false
184 after_failure: post_message "TRAVIS_MESSAGE" "Failed to build DEB for ${BUILD_STRING}.${BUILD_ARCH}"
185 before_deploy:
186 - .travis/package_management/yank_stale_rpm.sh "${PACKAGES_DIRECTORY}" "${BUILD_STRING}" || echo "No stale DEB found"
@@ -184,7 +196,7 @@ stages:
196 on:
197 # Only deploy on ${USER}/netdata, master branch, when build-area directory is created
198 repo: ${TRAVIS_REPO_SLUG}
187 - branch: master
199 + branch: "master"
200 condition: -d "${PACKAGES_DIRECTORY}"
201 # Production release packages deployment
202 - provider: packagecloud
@@ -197,7 +209,7 @@ stages:
209 on:
210 # Only deploy on ${USER}/netdata, master branch, when build-area directory is created
211 repo: "netdata/netdata"
200 - branch: master
212 + branch: "master"
213 condition: -d "${PACKAGES_DIRECTORY}"
214 after_deploy:
215 - if [ -n "${BUILDER_NAME}" ]; then rm -rf /home/${BUILDER_NAME}/* && echo "Cleared /home/${BUILDER_NAME} directory" || echo "Failed to clean /home/${BUILDER_NAME} directory"; fi;
.travis/package_management/common.py
+58
@@ -6,6 +6,7 @@
6
7 import lxc
8 import subprocess
9 +import os
10
11 def replace_tag(tag_name, spec, new_tag_content):
12 print("Fixing tag %s in %s" % (tag_name, spec))
@@ -44,3 +45,60 @@ def run_command_in_host(cmd):
45 print('Output: ' + o.decode('ascii'))
46 print('Error: ' + e.decode('ascii'))
47 print('code: ' + str(proc.returncode))
48 +
49 +def install_common_dependendencies():
50 + if str(os.environ["REPO_TOOL"]).count("zypper") == 1:
51 + run_command(container, [os.environ["REPO_TOOL"], "clean", "-a"])
52 + run_command(container, [os.environ["REPO_TOOL"], "--no-gpg-checks", "update", "-y"])
53 + run_command(container, [os.environ["REPO_TOOL"], "install", "-y", "json-glib-devel"])
54 +
55 + elif str(os.environ["REPO_TOOL"]).count("yum") == 1:
56 + run_command(container, [os.environ["REPO_TOOL"], "install", "-y", "json-c-devel"])
57 + run_command(container, [os.environ["REPO_TOOL"], "clean", "all"])
58 + run_command(container, [os.environ["REPO_TOOL"], "update", "-y"])
59 + if os.environ["BUILD_STRING"].count("el/7") == 1 and os.environ["BUILD_ARCH"].count("i386") == 1:
60 + print ("Skipping epel-release install for %s-%s" % (os.environ["BUILD_STRING"], os.environ["BUILD_ARCH"]))
61 + else:
62 + run_command(container, [os.environ["REPO_TOOL"], "install", "-y", "epel-release"])
63 + else:
64 + run_command(container, [os.environ["REPO_TOOL"], "install", "-y", "json-c-devel"])
65 + run_command(container, [os.environ["REPO_TOOL"], "update", "-y"])
66 +
67 + run_command(container, [os.environ["REPO_TOOL"], "install", "-y", "sudo"])
68 + run_command(container, [os.environ["REPO_TOOL"], "install", "-y", "wget"])
69 + run_command(container, [os.environ["REPO_TOOL"], "install", "-y", "bash"])
70 + run_command(container, [os.environ["REPO_TOOL"], "install", "-y", "freeipmi-devel"])
71 + run_command(container, [os.environ["REPO_TOOL"], "install", "-y", "cups-devel"])
72 +
73 +def prepare_version_source(dest_archive, pkg_friendly_version, tag=None):
74 + print(".0 Preparing local implementation tarball for version %s" % pkg_friendly_version)
75 + tar_file = os.environ['LXC_CONTAINER_ROOT'] + dest_archive
76 +
77 + if tag is not None:
78 + print(".1 Checking out tag %s" % tag)
79 + run_command_in_host(['git', 'fetch', '--all'])
80 +
81 + # TODO: Keep in mind that tricky 'v' there, needs to be removed once we clear our versioning scheme
82 + run_command_in_host(['git', 'checkout', 'v%s' % pkg_friendly_version])
83 +
84 + print(".2 Tagging the code with version: %s" % pkg_friendly_version)
85 + run_command_in_host(['git', 'tag', '-a', pkg_friendly_version, '-m', 'Tagging while packaging on %s' % os.environ["CONTAINER_NAME"]])
86 +
87 + print(".3 Run autoreconf -ivf")
88 + run_command_in_host(['autoreconf', '-ivf'])
89 +
90 + print(".4 Run configure")
91 + run_command_in_host(['./configure', '--with-math', '--with-zlib', '--with-user=netdata'])
92 +
93 + print(".5 Run make dist")
94 + run_command_in_host(['make', 'dist'])
95 +
96 + print(".6 Copy generated tarbal to desired path")
97 + if os.path.exists('netdata-%s.tar.gz' % pkg_friendly_version):
98 + run_command_in_host(['sudo', 'cp', 'netdata-%s.tar.gz' % pkg_friendly_version, tar_file])
99 +
100 + print(".7 Fixing permissions on tarball")
101 + run_command_in_host(['sudo', 'chmod', '777', tar_file])
102 + else:
103 + print("I could not find (%s) on the disk, stopping the build. Kindly check the logs and try again" % 'netdata-%s.tar.gz' % pkg_friendly_version)
104 + sys.exit(1)
.travis/package_management/configure_deb_lxc_environment.py
+23 -13
@@ -46,20 +46,30 @@ common.run_command(container, ["useradd", "-m", os.environ['BUILDER_NAME']])
46
47 # Fetch package dependencies for the build
48 print("2. Installing package dependencies within LXC container")
49 -common.run_command(container, ["apt-get", "update", "-y"])
50 -common.run_command(container, ["apt-get", "install", "-y", "sudo"])
51 -common.run_command(container, ["apt-get", "install", "-y", "wget"])
52 -common.run_command(container, ["apt-get", "install", "-y", "bash"])
53 -common.run_command(container, ["wget", "-T", "15", "-O", "~/.install-required-packages.sh", "https://raw.githubusercontent.com/netdata/netdata-demo-site/master/install-required-packages.sh"])
54 -common.run_command(container, ["bash", "~/.install-required-packages.sh", "netdata", "--dont-wait", "--non-interactive"])
49 +common.install_common_dependendencies()
50
56 -# Download the source
57 -dest_archive="/home/%s/netdata-%s.tar.gz" % (os.environ['BUILDER_NAME'],os.environ['BUILD_VERSION'])
58 -release_url="https://github.com/netdata/netdata/releases/download/%s/netdata-%s.tar.gz" % (os.environ['BUILD_VERSION'], os.environ['BUILD_VERSION'])
59 -print("3. Fetch netdata source (%s -> %s)" % (release_url, dest_archive))
60 -common.run_command(container, ["sudo", "-u", os.environ['BUILDER_NAME'], "wget", "-T", "15", "--output-document=" + dest_archive, release_url])
51 +print ("3. Run install-required-packages scriptlet")
52 +common.run_command(container, ["wget", "-T", "15", "-O", "/home/%s/.install-required-packages.sh" % (os.environ['BUILDER_NAME']), "https://raw.githubusercontent.com/netdata/netdata-demo-site/master/install-required-packages.sh"])
53 +common.run_command(container, ["bash", "/home/%s/.install-required-packages.sh" % (os.environ['BUILDER_NAME']), "netdata", "--dont-wait", "--non-interactive"])
54
62 -print("4. Extracting directory contents to /home " + os.environ['BUILDER_NAME'])
63 -common.run_command(container, ["sudo", "-u", os.environ['BUILDER_NAME'], "tar", "xf", dest_archive, "-C", "/home/" + os.environ['BUILDER_NAME']])
55 +friendly_version=""
56 +dest_archive=""
57 +download_url=""
58 +tag = None
59 +
60 +# TODO: Checksum validations
61 +if str(os.environ['BUILD_VERSION']).count(".latest") == 1:
62 + version_list=str(os.environ['BUILD_VERSION']).replace('v', '').split('.')
63 + friendly_version='.'.join(version_list[0:3]) + "." + version_list[3]
64 +else:
65 + friendly_version = os.environ['BUILD_VERSION'].replace('v', '')
66 + tag = friendly_version # Go to stable tag
67 +
68 +tar_file="%s/netdata-%s.tar.gz" % (os.path.dirname(dest_archive), friendly_version)
69 +
70 +print("5. I will be building version '%s' of netdata." % os.environ['BUILD_VERSION'])
71 +dest_archive="/home/%s/netdata-%s.tar.gz" % (os.environ['BUILDER_NAME'], friendly_version)
72 +
73 +common.prepare_version_source(dest_archive, friendly_version, tag=tag)
74
75 print("Done!")
.travis/package_management/configure_rpm_lxc_environment.py
+15 -68
@@ -47,29 +47,10 @@ common.run_command(container, ["useradd", "-m", os.environ['BUILDER_NAME']])
47
48 # Fetch package dependencies for the build
49 print("2. Installing package dependencies within LXC container")
50 -if str(os.environ["REPO_TOOL"]).count("zypper") == 1:
51 - common.run_command(container, [os.environ["REPO_TOOL"], "clean", "-a"])
52 - common.run_command(container, [os.environ["REPO_TOOL"], "--no-gpg-checks", "update", "-y"])
53 - common.run_command(container, [os.environ["REPO_TOOL"], "install", "-y", "json-glib-devel"])
54 -
55 -elif str(os.environ["REPO_TOOL"]).count("yum") == 1:
56 - common.run_command(container, [os.environ["REPO_TOOL"], "install", "-y", "json-c-devel"])
57 - common.run_command(container, [os.environ["REPO_TOOL"], "clean", "all"])
58 - common.run_command(container, [os.environ["REPO_TOOL"], "update", "-y"])
59 - common.run_command(container, [os.environ["REPO_TOOL"], "install", "-y", "epel-release"])
60 -else:
61 - common.run_command(container, [os.environ["REPO_TOOL"], "install", "-y", "json-c-devel"])
62 - common.run_command(container, [os.environ["REPO_TOOL"], "update", "-y"])
63 -
64 -common.run_command(container, [os.environ["REPO_TOOL"], "install", "-y", "sudo"])
65 -common.run_command(container, [os.environ["REPO_TOOL"], "install", "-y", "wget"])
66 -common.run_command(container, [os.environ["REPO_TOOL"], "install", "-y", "bash"])
67 -common.run_command(container, [os.environ["REPO_TOOL"], "install", "-y", "freeipmi-devel"])
68 -common.run_command(container, [os.environ["REPO_TOOL"], "install", "-y", "cups-devel"])
50 +common.install_common_dependendencies()
51
52 # Exceptional cases, not available everywhere
53 #
72 -
54 # Not on Centos-7
55 if os.environ["BUILD_STRING"].count("el/7") <= 0:
56 common.run_command(container, [os.environ["REPO_TOOL"], "install", "-y", "libnetfilter_acct-devel"])
@@ -97,63 +78,29 @@ rpm_friendly_version=""
78 dest_archive=""
79 download_url=""
80 spec_file="/home/%s/rpmbuild/SPECS/netdata.spec" % os.environ['BUILDER_NAME']
81 +tag = None
82
83 # TODO: Checksum validations
84 if str(os.environ['BUILD_VERSION']).count(".latest") == 1:
85 version_list=str(os.environ['BUILD_VERSION']).replace('v', '').split('.')
86 rpm_friendly_version='.'.join(version_list[0:3]) + "." + version_list[3]
105 -
106 - print("Building latest nightly version of netdata..(%s)" % os.environ['BUILD_VERSION'])
107 - dest_archive="/home/%s/rpmbuild/SOURCES/netdata-%s.tar.gz" % (os.environ['BUILDER_NAME'], rpm_friendly_version)
108 -
109 - print("5. Preparing local latest implementation tarball for version %s" % rpm_friendly_version)
110 - tar_file = os.environ['LXC_CONTAINER_ROOT'] + dest_archive
111 -
112 - print("5.1 Tagging the code with latest version: %s" % rpm_friendly_version)
113 - common.run_command_in_host(['git', 'tag', '-a', rpm_friendly_version, '-m', 'Tagging while packaging on %s' % os.environ["CONTAINER_NAME"]])
114 -
115 - print("5.2 Run autoreconf -ivf")
116 - common.run_command_in_host(['autoreconf', '-ivf'])
117 -
118 - print("5.3 Run configure")
119 - common.run_command_in_host(['./configure', '--with-math', '--with-zlib', '--with-user=netdata'])
120 -
121 - print("5.4 Run make dist")
122 - common.run_command_in_host(['make', 'dist'])
123 -
124 - print("5.5 Copy generated tarbal to desired path")
125 - if os.path.exists('netdata-%s.tar.gz' % rpm_friendly_version):
126 - common.run_command_in_host(['sudo', 'cp', 'netdata-%s.tar.gz' % rpm_friendly_version, tar_file])
127 -
128 - print("5.6 Fixing permissions on tarball")
129 - common.run_command_in_host(['sudo', 'chmod', '777', tar_file])
130 - else:
131 - print("I could not find (%s) on the disk, stopping the build. Kindly check the logs and try again" % 'netdata-%s.tar.gz' % rpm_friendly_version)
132 - sys.exit(1)
133 -
134 - # Extract the spec file in place
135 - print("6. Extract spec file from the source")
136 - common.run_command_in_host(['sudo', 'cp', 'netdata.spec', os.environ['LXC_CONTAINER_ROOT'] + spec_file])
137 - common.run_command_in_host(['sudo', 'chmod', '777', os.environ['LXC_CONTAINER_ROOT'] + spec_file])
138 -
139 - print("7. Temporary hack: Change Source0 to %s on spec file %s" % (dest_archive, spec_file))
140 - common.replace_tag("Source0", os.environ['LXC_CONTAINER_ROOT'] + spec_file, tar_file)
87 else:
142 - rpm_friendly_version = os.environ['BUILD_VERSION']
88 + rpm_friendly_version = os.environ['BUILD_VERSION'].replace('v', '')
89 + tag = rpm_friendly_version # Go to stable tag
90 +
91 +tar_file="%s/netdata-%s.tar.gz" % (os.path.dirname(dest_archive), rpm_friendly_version)
92
144 - print("Building latest stable version of netdata.. (%s)" % os.environ['BUILD_VERSION'])
145 - dest_archive="/home/%s/rpmbuild/SOURCES/netdata-%s.tar.gz" % (os.environ['BUILDER_NAME'],os.environ['BUILD_VERSION'])
146 - download_url="https://github.com/netdata/netdata/releases/download/%s/netdata-%s.tar.gz" % (os.environ['BUILD_VERSION'], os.environ['BUILD_VERSION'])
93 +print("5. I will be building version '%s' of netdata." % os.environ['BUILD_VERSION'])
94 +dest_archive="/home/%s/rpmbuild/SOURCES/netdata-%s.tar.gz" % (os.environ['BUILDER_NAME'], rpm_friendly_version)
95
148 - print("5. Fetch netdata source into the repo structure(%s -> %s)" % (download_url, dest_archive))
149 - tar_file="%s/netdata-%s.tar.gz" % (os.path.dirname(dest_archive), rpm_friendly_version)
150 - common.run_command(container, ["sudo", "-u", os.environ['BUILDER_NAME'], "wget", "-T", "15", "--output-document=" + dest_archive, download_url])
96 +common.prepare_version_source(dest_archive, rpm_friendly_version, tag=tag)
97
152 - print("6.Extract spec file from the source")
153 - common.run_command(container, ["sudo", "-u", os.environ['BUILDER_NAME'], "tar", "--to-command=cat > %s" % spec_file, "-xvf", dest_archive, "netdata-%s/netdata.spec" % os.environ['BUILD_VERSION']])
98 +# Extract the spec file in place
99 +print("6. Extract spec file from the source")
100 +common.run_command_in_host(['sudo', 'cp', 'netdata.spec', os.environ['LXC_CONTAINER_ROOT'] + spec_file])
101 +common.run_command_in_host(['sudo', 'chmod', '777', os.environ['LXC_CONTAINER_ROOT'] + spec_file])
102
155 - print("7. Temporary hack: Adjust version string on the spec file (%s) to %s and Source0 to %s" % (os.environ['LXC_CONTAINER_ROOT'] + spec_file, rpm_friendly_version, download_url))
156 - common.replace_tag("Version", os.environ['LXC_CONTAINER_ROOT'] + spec_file, rpm_friendly_version)
157 - common.replace_tag("Source0", os.environ['LXC_CONTAINER_ROOT'] + spec_file, tar_file)
103 +print("7. Temporary hack: Change Source0 to %s on spec file %s" % (dest_archive, spec_file))
104 +common.replace_tag("Source0", os.environ['LXC_CONTAINER_ROOT'] + spec_file, tar_file)
105
106 print('Done!')