@cryptotaxi247 / netdata-1 / commits / 2c3b4cdd7

netdata/packaging: Netdata binary packages generation - spec file refinement, support for nightlies (RPM) (#6369)

Detailed list of changes: * netdata/packaging: First round of netdata.spec refactoring - package dependencies - Remove freeipmi/nfacct plugin flags. We auto-detect all plugins by decision - Start refactor of package dependencies - Add missing dependencies, with respect to distro peculiarities - Adjust existing dependencies, so that distro-specific package names is applied * netdata/packaging: add packaging trigger mechanism on binary-packages-specfile-cleanup to help testing * netdata/packaging: WIP - Allow building nightly versions for RPM (Still investigating the right version scheme) * netdata/packaging: Attempt to fix syntax errors - wow travis, mercy * netdata/packaging: tiny nits and fixes 1) there was a syntax error in version definition 2) bring default deploy repo name at the top, then overwrite when latest is published 3) Leave a comment * netdata/packaging: Move these core package requirements to the right section * netdata/packaging: libuv requires >= 1, missed to add that on devel libs * netdata/packaging: some comments, also when you put logrotate in our conf directory, link it to actual log rotate * netdata/packaging: Adjust configure options on spec file (align with netdata-installer.sh) * netdata/packaging: In order to properly support packaging both latest and stable releases, you need to star that extraction part, folder name contains the version with the hash that we cant tell * netdata/packaging: until we fix versioning, bring the original unprocessed spec file and pass the version we like in * netdata/packaging: fix version string in the spec file * netdata/packaging: Replace source path, we need to work with whatever we downloaded (to be refined) * netdata/packaging: [ci skip] you mixed the paths, reverse them * netdata/packaging: [ci skip] attempt to fix source path when needed * netdata/packaging: fixes and nits 1) generalize the spec file refinement method 2) Do both replacement that way 3) Adjust file names and paths * netdata/packaging: Replace Source0 explicitly and also make sure you remove extra new lines that may confuse the replacement later * netdata/packaging: [ci skip] move env outside, add some more log * netdata/packaging: [ci skip] adjust logic of replacing tag lines in spec file * netdata/packaging: [ci skip] Alas, fetch the archive, rename the structure to the new version, repack and proceed * netdata/packaging: [ci skip] Extract to specific path * netdata/packaging: [ci skip] replace problematic tar call with the respective pythonized one * netdata/packaging: [ci skip] Add new friendly octal format for chmod * netdata/packaging: [ci skip] more checks * netdata/packaging: [ci skip] dont chmod, chown the whole folder after extraction * netdata/packaging: nit * netdata/packaging: [ci skip] attempt to fix permissions differently * netdata/packaging: [ci skip] Another hack, attempt to fix permissions on the host directly * netdata/packaging: [ci skip] fine, do the move also on the host, pointless to run all through the container * netdata/packaging: [ci skip] Do the move through the container. Also, move a more specific folder * netdata/packaging: [ci skip] move as w00t * netdata/packaging: [ci skip] fix * netdata/packaging: sync permissions handling, round two * netdata/packaging: scratch those hacks, we should do latest differently * netdata/packaging: [ci skip] Set up rpm version string depending on whether we are on latest or not * netdata/packaging: [ci skip] Branch the code here, latest build up should be on the commit rather the tar files * netdata/packaging: Attempt to handle latest version build up * netdata/packaging: [ci skip] Dont continue processing if the file was not generated. Also do the tagging before autoreconf * netdata/packaging: [ci skip] fixes and nits * netdata/packaging: [ci skip] When doing annotated tags, you need to provide a message otherwise an editor pops up and will block the build * netdata/packaging: on the latest code case go all the way host level operations * netdata/packaging: [ci skip] Do not modify version, no longer need it because we properly generated the package with the right version * netdata/packaging: [ci skip] fix sensors line, you missed the Recommends keyword * netdata/packaging: Some code style (remove tabification from some tags) and also remove Recommends, we start with required packages for build and runtime and then we document further needs * netdata/packaging: [ci skip] Make sure you get epel in there, its needed * netdata/packaging: [ci skip] Fix bogus date * netdata/packaging: [ci skip] add these packages to include functionality * netdata/packaging: [ci skip] more fine grained dependency handling * netdata/packaging: [ci skip] Dependency hell - do not depend on libnetacctfilter if on el/7 * netdata/packaging: [ci skip] Be serious, that is not what you do when building the package silly * netdata/packaging: [ci skip] define directory attributes too * netdata/packaging: [ci skip] mystery unfold - comment out as we need to figure out how to handle missing directories that our installer creates if necessary * netdata/packaging: [ci skip] Make sure you properly set deployment repo based on commit message * netdata/packaging: [ci skip] Install these packages for specific versions, remove optimisations for now * netdata/packaging: [ci skip] Make package yanking flexible, so that we can manage both netdata and netdata-edge cleanup properly * netdata/packaging: [ci skip] Actually, set user at travis layer and let the script consume it only. We need to be sure the same user is used on yanking and the deployment process * netdata/packaging: [ci skip] wow pkatsoul * netdata/packaging: Dont forget to install some of the enabled plugins * netdata/packaging: nfacct.plugin not really working on rhel, disable temporarily * netdata/packaging: include installed directories to package * netdata/packaging: [ci skip] nits * netdata/packaging: fixes * netdata/packaging: [ci skip] dont add ghost files * netdata/packaging: [ci skip] Dont do that, make install already places the files in the right location. Also, seems that libexec is not really getting overriden there * netdata/packaging: [ci skip] Extreme - override _libexecdir macro * Revert "netdata/packaging: [ci skip] Dont do that, make install already places the files in the right location. Also, seems that libexec is not really getting overriden there" This reverts commit 320102c96284e4622266f6f089d6ce87319976f3. That wasnt really the problem here * netdata/packaging: [ci skip] Include contents of dir here * netdata/packaging: fixes * netdata/packaging: [ci skip] Fixes and additions - Tighter permissions for some files - Introduce go.d plugin install (likely broken like this, dont recall if bash style code is fine here) - Raise the path overrides to the spec level, otherwise we build with the overrides and package with the defaults * netdata/packaging: [ci skip] Missed an invalid variable. These files are under our current path, no need for complexity * netdata/packaging: [ci skip] bring sha method onboard * netdata/packaging: [ci skip] Wrong path provided, should be under build root * netdata/packaging: [ci skip] Add registry directory * netdata/packaging: [ci skip] add missing config directory definitions * netdata/packaging: [ci skip] Fix missing dirs * netdata/packaging:[ci fix] hos * netdata/packaging: [ci skip] Fixes and additions - Change versioning to v1.15.0.114 from v1.15.0114 - Add CUPS, Xenstat, json-c * netdata/packaging: [ci skip] fix package dependencies on the builder setup, otherwise spec will fail * netdata/packaging: [ci skip] limit xenstat to suse and fedora for now * netdata/packaging: [ci skip] separate fedora and suse cases, unfortunately suse has different package names.... * netdata/packaging: [ci skip] yajl is not the same package everywhere, of course * netdata/packagin: [ci skip] skip xenstat for now * netdata/packaging: [ci skip] remove the vvvvvvvvv * netdata/packaging: [ci skip] one more fix attempt * netdata/packaging: [ci skip] Spec file extraction is different when building from stable. We *must* fetch it from the tarball rather than the local one * netdata/packaging: [ci skip] spec_file defined on all cases, latest or stable. Also move latest spec file copy after make dist operation, that is where is suppose to be * netdata/packaging: [ci skip] Tag source with the local version, as we build upon the very latest * netdata/packaging: oopsie -- remove json-c from that place, it was forgotten * netdata/packaging: fix packaging, even though devel is consistent between fedora and suse, the binary one is not .... (also fix default perms to be root:netdata rather root:root) * netdata/packaging: Suse love - again, libuuid-devel same, but libuuid is named libuuid1 on suse...... * netdata/packaging: [ci skip] libcap same.... * netdata/packaging: [ci skip] use the noreplace directive for the configuration files * netdata/packaging: [ci skip] Bring back master as the triggering repository * netdata/packaging: [ci skip] attempt to enable/disable service where necessary. Default preset action requires further setup, so we override that * Revert "netdata/packaging: [ci skip] Bring back master as the triggering repository" This reverts commit 9b25a622dc5f12b1539f6863bab52d7bb225fd8d. ** Reverting as we need to test further the service enable action ** * netdata/packaging: [ci skip] revert this change - not the right way, we have empty files * netdata/packaging: [ci skip] Add daemon-reload option, to make sure systemd learns about the newly installed service * netdata/packaging: [ci skip] Attempt to silence codacy by factoring out the few small methods for common usage, then kill directories to reduce complexity adn thats it * netdata/packaging: [ci skip] Just making sure codacy reprocess everything * netdata/packaging: [ci skip] missed one adjustment * netdata/packaging: python style - print shouldnt have space before open parenthesis. Also, add restart on all cases on the spec file * netdata/packaging: [ci skip] fix syntax * netdata/packaging: [ci skip] syntax fixes 2 * netdata/packaging: [ci skip] another miss * netdata/packaging: [ci skip] You need to explicitly trigger a restart, apparently * netdata/packaging: [ci skip] override packaging user definition temporarily, to get things going on testing

Paul Emm. Katsoulakis committed Jul 3, 2019 at 09:18 UTC 2c3b4cdd75802625eb5668d0b33964557c803764
13 files changed +661 -332
.travis.yml
+22 -16
@@ -23,6 +23,13 @@ install:
23 - source tests/installer/slack.sh
24 - export NOTIF_CHANNEL="automation-beta"
25 - if [ "${TRAVIS_REPO_SLUG}" = "netdata/netdata" ]; then export NOTIF_CHANNEL="automation"; fi;
26 +- export BUILD_VERSION="$(cat packaging/version | cut -d'-' -f1)"
27 +- if [[ "${TRAVIS_COMMIT_MESSAGE}" = *"[Build latest]"* ]]; then export BUILD_VERSION="$(cat packaging/version | cut -d'-' -f1,2 | sed -e 's/-/./g').latest"; fi;
28 +- export DEPLOY_REPO="netdata" # Default production packaging repository
29 +- if [[ "${TRAVIS_COMMIT_MESSAGE}" = *"[Build latest]"* ]]; then export DEPLOY_REPO="netdata-edge"; fi;
30 +#- export PACKAGING_USER="$(echo ${TRAVIS_REPO_SLUG} | cut -d'/' -f1)"
31 +#Override to help push packages towards netdata/netdata-edge
32 +- export PACKAGING_USER="netdata"
33
34
35
@@ -80,23 +87,23 @@ stages:
87 # Build RPM packages under special conditions
88 # Enterprise linux (Covers CentOS, Redhat, Amazon linux)
89 - name: "Package Enterprise Linux 7"
83 - 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\])/
90 + if: type != cron AND branch = binary-packages-specfile-cleanup 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\])/
91 - name: "Package Enterprise linux 6"
85 - 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\])/
92 + if: type != cron AND branch = binary-packages-specfile-cleanup AND commit_message =~ /(\[Package i386 RPM Enterprise Linux\]|\[Package i386 RPM\]|\[Package AMD64 RPM Enterprise Linux\]|\[Package AMD64 RPM\])/
93
94 # Fedora
95 - name: "Package Fedora 30"
89 - 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 branch = binary-packages-specfile-cleanup AND commit_message =~ /(\[Package arm64 RPM Fedora\]|\[Package arm64 RPM\]|\[Package AMD64 RPM Fedora\]|\[Package AMD64 RPM\])/
97 - name: "Package Fedora 29"
91 - 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 branch = binary-packages-specfile-cleanup AND commit_message =~ /(\[Package arm64 RPM Fedora\]|\[Package arm64 RPM\]|\[Package AMD64 RPM Fedora\]|\[Package AMD64 RPM\])/
99 - name: "Package Fedora 28"
93 - if: type != cron AND branch = master AND commit_message =~ /(\[Package arm64 RPM Fedora\]|\[Package arm64 RPM\]|\[Package AMD64 RPM Fedora\]|\[Package AMD64 RPM\])/
100 + if: type != cron AND branch = binary-packages-specfile-cleanup AND commit_message =~ /(\[Package arm64 RPM Fedora\]|\[Package arm64 RPM\]|\[Package AMD64 RPM Fedora\]|\[Package AMD64 RPM\])/
101
102 # OpenSuSE
103 - name: "Package OpenSuSE 15.1"
97 - 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 branch = binary-packages-specfile-cleanup AND commit_message =~ /(\[Package arm64 RPM openSuSE\]|\[Package arm64 RPM\]|\[Package AMD64 RPM openSuSE\]|\[Package AMD64 RPM\])/
105 - name: "Package OpenSuSE 15.0"
99 - if: type != cron AND branch = master AND commit_message =~ /(\[Package arm64 RPM openSuSE\]|\[Package arm64 RPM\]|\[Package AMD64 RPM openSuSE\]|\[Package AMD64 RPM\])/
106 + if: type != cron AND branch = binary-packages-specfile-cleanup AND commit_message =~ /(\[Package arm64 RPM openSuSE\]|\[Package arm64 RPM\]|\[Package AMD64 RPM openSuSE\]|\[Package AMD64 RPM\])/
107
108
109
@@ -109,20 +116,20 @@ stages:
116 before_script:
117 - post_message "TRAVIS_MESSAGE" "Starting package preparation and publishing for ${BUILD_STRING}.${BUILD_ARCH}" "${NOTIF_CHANNEL}"
118 - export PACKAGES_DIRECTORY="$(mktemp -d -t netdata-packaging-contents-dir-XXXXXX)" && echo "Created packaging directory ${PACKAGES_DIRECTORY}"
112 - - export BUILD_VERSION=$(cat packaging/version | cut -d'-' -f1) # We always build on the latest release
119 script:
120 - echo "Creating LXC environment for the build" && sudo -E .travis/package_management/create_lxc_for_build.sh
121 - echo "Building package in container" && sudo -E .travis/package_management/build_package_in_container.sh
122 - sudo chmod -R 755 "/var/lib/lxc"
123 - echo "Preparing RPM packaging contents for upload" && sudo -E .travis/package_management/prepare_packages.sh
124 after_failure: post_message "TRAVIS_MESSAGE" "Failed to build RPM for ${BUILD_STRING}.${BUILD_ARCH}"
125 +
126 before_deploy:
127 - .travis/package_management/yank_stale_rpm.sh "${PACKAGES_DIRECTORY}" "${BUILD_STRING}" || echo "No stale RPM found"
128 deploy:
129 # Beta packages deployment
130 - provider: packagecloud
124 - repository: "netdata"
125 - username: "$(echo ${TRAVIS_REPO_SLUG} | cut -d'/' -f1)"
131 + repository: "${DEPLOY_REPO}"
132 + username: "${PACKAGING_USER}"
133 token: "${PKG_CLOUD_TOKEN}"
134 dist: "${BUILD_STRING}"
135 local_dir: "${PACKAGES_DIRECTORY}"
@@ -130,7 +137,7 @@ stages:
137 on:
138 # Only deploy on ${USER}/netdata, master branch, when packages directory is created
139 repo: ${TRAVIS_REPO_SLUG}
133 - branch: master
140 + branch: binary-packages-specfile-cleanup
141 condition: -d "${PACKAGES_DIRECTORY}"
142 # Production release packages deployment
143 - provider: packagecloud
@@ -143,14 +150,14 @@ stages:
150 on:
151 # Only deploy on ${USER}/netdata, master branch, when packages directory is created
152 repo: "${TRAVIS_REPO_SLUG}"
146 - branch: master
153 + branch: binary-packages-specfile-cleanup
154 condition: -d "${PACKAGES_DIRECTORY}"
155 after_deploy:
156 - 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;
157 - if [ -d "${PACKAGES_DIRECTORY}" ]; then rm -rf "${PACKAGES_DIRECTORY}"; fi;
158
159
153 -
160 + # TODO: This section is stale, will be aligned with the RPM implementation when we get to DEB packaging
161 - stage: &_DEB_TEMPLATE
162 name: "Build & Publish DEB package"
163 before_install:
@@ -159,7 +166,6 @@ stages:
166 before_script:
167 - post_message "TRAVIS_MESSAGE" "Starting package preparation and publishing for ${BUILD_STRING}.${BUILD_ARCH}" "${NOTIF_CHANNEL}"
168 - export PACKAGES_DIRECTORY="$(mktemp -d -t netdata-packaging-contents-dir-XXXXXX)" && echo "Created packaging directory ${PACKAGES_DIRECTORY}"
162 - - export BUILD_VERSION=$(cat packaging/version | cut -d'-' -f1) # We always build on the latest release
169 script:
170 - echo "Creating LXC environment for the build" && sudo -E .travis/package_management/create_lxc_for_build.sh
171 - echo "Building package in container" && sudo -E .travis/package_management/build_package_in_container.sh
@@ -171,8 +177,8 @@ stages:
177 deploy:
178 # Beta packages deployment
179 - provider: packagecloud
174 - repository: "netdata"
175 - username: "$(echo ${TRAVIS_REPO_SLUG} | cut -d'/' -f1)"
180 + repository: "${DEPLOY_REPO}"
181 + username: "${PACKAGING_USER}"
182 token: "${PKG_CLOUD_TOKEN}"
183 dist: "${BUILD_STRING}"
184 local_dir: "${PACKAGES_DIRECTORY}"
.travis/package_management/build_package_in_container.sh
+4 -4
@@ -54,24 +54,24 @@ case "${BUILD_ARCH}" in
54 echo "Building for amd64.."
55 export CONTAINER_NAME="${BUILDER_NAME}-${BUILD_DISTRO}${BUILD_RELEASE}-amd64"
56 export LXC_CONTAINER_ROOT="/var/lib/lxc/${CONTAINER_NAME}/rootfs"
57 - .travis/package_management/"${PACKAGE_TYPE}"/trigger_lxc_build.py "${CONTAINER_NAME}"
57 + .travis/package_management/trigger_${PACKAGE_TYPE}_lxc_build.py "${CONTAINER_NAME}"
58
59 echo "Building for arm64.."
60 export CONTAINER_NAME="${BUILDER_NAME}-${BUILD_DISTRO}${BUILD_RELEASE}-arm64"
61 export LXC_CONTAINER_ROOT="/var/lib/lxc/${CONTAINER_NAME}/rootfs"
62 - .travis/package_management/"${PACKAGE_TYPE}"/trigger_lxc_build.py "${CONTAINER_NAME}"
62 + .travis/package_management/trigger_${PACKAGE_TYPE}_lxc_build.py "${CONTAINER_NAME}"
63
64 echo "Building for i386.."
65 export CONTAINER_NAME="${BUILDER_NAME}-${BUILD_DISTRO}${BUILD_RELEASE}-i386"
66 export LXC_CONTAINER_ROOT="/var/lib/lxc/${CONTAINER_NAME}/rootfs"
67 - .travis/package_management/"${PACKAGE_TYPE}"/trigger_lxc_build.py "${CONTAINER_NAME}"
67 + .travis/package_management/trigger_${PACKAGE_TYPE}_lxc_build.py "${CONTAINER_NAME}"
68
69 ;;
70 "amd64"|"arm64"|"i386")
71 echo "Building for ${BUILD_ARCH}.."
72 export CONTAINER_NAME="${BUILDER_NAME}-${BUILD_DISTRO}${BUILD_RELEASE}-${BUILD_ARCH}"
73 export LXC_CONTAINER_ROOT="/var/lib/lxc/${CONTAINER_NAME}/rootfs"
74 - .travis/package_management/"${PACKAGE_TYPE}"/trigger_lxc_build.py "${CONTAINER_NAME}"
74 + .travis/package_management/trigger_${PACKAGE_TYPE}_lxc_build.py "${CONTAINER_NAME}"
75 ;;
76 *)
77 echo "Unknown build architecture '${BUILD_ARCH}', nothing to do for build"
.travis/package_management/common.py new
+46
@@ -0,0 +1,46 @@
1 +#
2 +#
3 +# Python library with commonly used functions within the package management scope
4 +#
5 +# Author : Pavlos Emm. Katsoulakis <paul@netdata.cloud>
6 +
7 +import lxc
8 +import subprocess
9 +
10 +def replace_tag(tag_name, spec, new_tag_content):
11 + print("Fixing tag %s in %s" % (tag_name, spec))
12 +
13 + ifp = open(spec, "r")
14 + config = ifp.readlines()
15 + ifp.close()
16 +
17 + source_line = -1
18 + for line in config:
19 + if str(line).count(tag_name + ":") > 0:
20 + source_line = config.index(line)
21 + print("Found line: %s in item %d" % (line, source_line))
22 + break
23 +
24 + if source_line >= 0:
25 + print("Replacing line %s with %s in spec file" %(config[source_line], new_tag_content))
26 + config[source_line] = "%s: %s\n" % (tag_name, new_tag_content)
27 + config_str = ''.join(config)
28 + ofp = open(spec, 'w')
29 + ofp.write(config_str)
30 + ofp.close()
31 +
32 +def run_command(container, command):
33 + print("Running command: %s" % command)
34 + command_result = container.attach_wait(lxc.attach_run_command, command)
35 +
36 + if command_result != 0:
37 + raise Exception("Command failed with exit code %d" % command_result)
38 +
39 +def run_command_in_host(cmd):
40 + print("Issue command in host: %s" % str(cmd))
41 +
42 + proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
43 + o, e = proc.communicate()
44 + print('Output: ' + o.decode('ascii'))
45 + print('Error: ' + e.decode('ascii'))
46 + print('code: ' + str(proc.returncode))
.travis/package_management/configure_deb_lxc_environment.py new
+65
@@ -0,0 +1,65 @@
1 +#!/usr/bin/env python3
2 +#
3 +# Prepare the build environment within the container
4 +# The script attaches to the running container and does the following:
5 +# 1) Create the container
6 +# 2) Start the container up
7 +# 3) Create the builder user
8 +# 4) Prepare the environment for DEB build
9 +#
10 +# Copyright: SPDX-License-Identifier: GPL-3.0-or-later
11 +#
12 +# Author : Pavlos Emm. Katsoulakis <paul@netdata.cloud>
13 +
14 +import common
15 +import os
16 +import sys
17 +import lxc
18 +
19 +if len(sys.argv) != 2:
20 + print('You need to provide a container name to get things started')
21 + sys.exit(1)
22 +container_name=sys.argv[1]
23 +
24 +# Setup the container object
25 +print("Defining container %s" % container_name)
26 +container = lxc.Container(container_name)
27 +if not container.defined:
28 + raise Exception("Container %s not defined!" % container_name)
29 +
30 +# Start the container
31 +if not container.start():
32 + raise Exception("Failed to start the container")
33 +
34 +if not container.running or not container.state == "RUNNING":
35 + raise Exception('Container %s is not running, configuration process aborted ' % container_name)
36 +
37 +# Wait for connectivity
38 +print("Waiting for container connectivity to start configuration sequence")
39 +if not container.get_ips(timeout=30):
40 + raise Exception("Timeout while waiting for container")
41 +
42 +# Run the required activities now
43 +# 1. Create the builder user
44 +print("1. Adding user %s" % os.environ['BUILDER_NAME'])
45 +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"])
55 +
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])
61 +
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']])
64 +
65 +print("Done!")
.travis/package_management/configure_rpm_lxc_environment.py new
+159
@@ -0,0 +1,159 @@
1 +#!/usr/bin/env python3
2 +#
3 +#
4 +# Prepare the build environment within the container
5 +# The script attaches to the running container and does the following:
6 +# 1) Create the container
7 +# 2) Start the container up
8 +# 3) Create the builder user
9 +# 4) Prepare the environment for RPM build
10 +#
11 +# Copyright: SPDX-License-Identifier: GPL-3.0-or-later
12 +#
13 +# Author : Pavlos Emm. Katsoulakis <paul@netdata.cloud>
14 +
15 +import common
16 +import os
17 +import sys
18 +import lxc
19 +
20 +if len(sys.argv) != 2:
21 + print('You need to provide a container name to get things started')
22 + sys.exit(1)
23 +container_name=sys.argv[1]
24 +
25 +# Setup the container object
26 +print("Defining container %s" % container_name)
27 +container = lxc.Container(container_name)
28 +if not container.defined:
29 + raise Exception("Container %s not defined!" % container_name)
30 +
31 +# Start the container
32 +if not container.start():
33 + raise Exception("Failed to start the container")
34 +
35 +if not container.running or not container.state == "RUNNING":
36 + raise Exception('Container %s is not running, configuration process aborted ' % container_name)
37 +
38 +# Wait for connectivity
39 +print("Waiting for container connectivity to start configuration sequence")
40 +if not container.get_ips(timeout=30):
41 + raise Exception("Timeout while waiting for container")
42 +
43 +# Run the required activities now
44 +# Create the builder user
45 +print("1. Adding user %s" % os.environ['BUILDER_NAME'])
46 +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"])
69 +
70 +# Exceptional cases, not available everywhere
71 +#
72 +
73 +# Not on Centos-7
74 +if os.environ["BUILD_STRING"].count("el/7") <= 0:
75 + common.run_command(container, [os.environ["REPO_TOOL"], "install", "-y", "libnetfilter_acct-devel"])
76 +
77 +# Not on Centos-6
78 +if os.environ["BUILD_STRING"].count("el/6") <= 0:
79 + common.run_command(container, [os.environ["REPO_TOOL"], "install", "-y", "autoconf-archive"])
80 +
81 +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"])
82 +common.run_command(container, ["bash", "/home/%s/.install-required-packages.sh" % (os.environ['BUILDER_NAME']), "netdata", "--dont-wait", "--non-interactive"])
83 +
84 +print("3. Setting up macros")
85 +common.run_command(container, ["sudo", "-u", os.environ['BUILDER_NAME'], "/bin/echo", "'%_topdir %(echo /home/" + os.environ['BUILDER_NAME'] + ")/rpmbuild' > /home/" + os.environ['BUILDER_NAME'] + "/.rpmmacros"])
86 +
87 +print("4. Create rpmbuild directory")
88 +common.run_command(container, ["sudo", "-u", os.environ['BUILDER_NAME'], "mkdir", "-p", "/home/" + os.environ['BUILDER_NAME'] + "/rpmbuild/BUILD"])
89 +common.run_command(container, ["sudo", "-u", os.environ['BUILDER_NAME'], "mkdir", "-p", "/home/" + os.environ['BUILDER_NAME'] + "/rpmbuild/RPMS"])
90 +common.run_command(container, ["sudo", "-u", os.environ['BUILDER_NAME'], "mkdir", "-p", "/home/" + os.environ['BUILDER_NAME'] + "/rpmbuild/SOURCES"])
91 +common.run_command(container, ["sudo", "-u", os.environ['BUILDER_NAME'], "mkdir", "-p", "/home/" + os.environ['BUILDER_NAME'] + "/rpmbuild/SPECS"])
92 +common.run_command(container, ["sudo", "-u", os.environ['BUILDER_NAME'], "mkdir", "-p", "/home/" + os.environ['BUILDER_NAME'] + "/rpmbuild/SRPMS"])
93 +common.run_command(container, ["sudo", "-u", os.environ['BUILDER_NAME'], "ls", "-ltrR", "/home/" + os.environ['BUILDER_NAME'] + "/rpmbuild"])
94 +
95 +# Download the source
96 +rpm_friendly_version=""
97 +dest_archive=""
98 +download_url=""
99 +spec_file="/home/%s/rpmbuild/SPECS/netdata.spec" % os.environ['BUILDER_NAME']
100 +
101 +# TODO: Checksum validations
102 +if str(os.environ['BUILD_VERSION']).count(".latest") == 1:
103 + version_list=str(os.environ['BUILD_VERSION']).replace('v', '').split('.')
104 + 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)
141 +else:
142 + rpm_friendly_version = os.environ['BUILD_VERSION']
143 +
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'])
147 +
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])
151 +
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']])
154 +
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)
158 +
159 +print('Done!')
.travis/package_management/create_lxc_for_build.sh
+4 -4
@@ -62,7 +62,7 @@ case "${BUILD_ARCH}" in
62 lxc-create -n "${CONTAINER_NAME}" -t "download" -- --dist "${BUILD_DISTRO}" --release "${BUILD_RELEASE}" --arch "i386" --no-validate
63
64 echo "Container(s) ready. Configuring container(s).."
65 - .travis/package_management/"${PACKAGE_TYPE}"/configure_lxc_environment.py "${CONTAINER_NAME}"
65 + .travis/package_management/configure_${PACKAGE_TYPE}_lxc_environment.py "${CONTAINER_NAME}"
66
67 # amd64
68 echo "Creating LXC Container for amd64.."
@@ -71,7 +71,7 @@ case "${BUILD_ARCH}" in
71 lxc-create -n "${CONTAINER_NAME}" -t "download" -- --dist "${BUILD_DISTRO}" --release "${BUILD_RELEASE}" --arch "amd64" --no-validate
72
73 echo "Container(s) ready. Configuring container(s).."
74 - .travis/package_management/"${PACKAGE_TYPE}"/configure_lxc_environment.py "${CONTAINER_NAME}"
74 + .travis/package_management/configure_${PACKAGE_TYPE}_lxc_environment.py "${CONTAINER_NAME}"
75
76 # arm64
77 echo "Creating LXC Container for arm64.."
@@ -80,7 +80,7 @@ case "${BUILD_ARCH}" in
80 lxc-create -n "${CONTAINER_NAME}" -t "download" -- --dist "${BUILD_DISTRO}" --release "${BUILD_RELEASE}" --arch "arm64" --no-validate
81
82 echo "Container(s) ready. Configuring container(s).."
83 - .travis/package_management/"${PACKAGE_TYPE}"/configure_lxc_environment.py "${CONTAINER_NAME}"
83 + .travis/package_management/configure_${PACKAGE_TYPE}_lxc_environment.py "${CONTAINER_NAME}"
84 ;;
85 "i386"|"amd64"|"arm64")
86 # AMD64 or i386
@@ -90,7 +90,7 @@ case "${BUILD_ARCH}" in
90 lxc-create -n "${CONTAINER_NAME}" -t "download" -- --dist "${BUILD_DISTRO}" --release "${BUILD_RELEASE}" --arch "${BUILD_ARCH}" --no-validate
91
92 echo "Container(s) ready. Configuring container(s).."
93 - .travis/package_management/"${PACKAGE_TYPE}"/configure_lxc_environment.py "${CONTAINER_NAME}"
93 + .travis/package_management/configure_${PACKAGE_TYPE}_lxc_environment.py "${CONTAINER_NAME}"
94 ;;
95 *)
96 echo "Unknown BUILD_ARCH value '${BUILD_ARCH}' given, process failed"
.travis/package_management/deb/configure_lxc_environment.py deleted
-71
@@ -1,71 +0,0 @@
1 -#!/usr/bin/env python3
2 -#
3 -# Prepare the build environment within the container
4 -# The script attaches to the running container and does the following:
5 -# 1) Create the container
6 -# 2) Start the container up
7 -# 3) Create the builder user
8 -# 4) Prepare the environment for DEB build
9 -#
10 -# Copyright: SPDX-License-Identifier: GPL-3.0-or-later
11 -#
12 -# Author : Pavlos Emm. Katsoulakis <paul@netdata.cloud>
13 -
14 -import os
15 -import sys
16 -import lxc
17 -
18 -def run_command(command):
19 - print ("Running command: %s" % command)
20 - command_result = container.attach_wait(lxc.attach_run_command, command)
21 -
22 - if command_result != 0:
23 - raise Exception("Command failed with exit code %d" % command_result)
24 -
25 -if len(sys.argv) != 2:
26 - print ('You need to provide a container name to get things started')
27 - sys.exit(1)
28 -container_name=sys.argv[1]
29 -
30 -# Setup the container object
31 -print ("Defining container %s" % container_name)
32 -container = lxc.Container(container_name)
33 -if not container.defined:
34 - raise Exception("Container %s not defined!" % container_name)
35 -
36 -# Start the container
37 -if not container.start():
38 - raise Exception("Failed to start the container")
39 -
40 -if not container.running or not container.state == "RUNNING":
41 - raise Exception('Container %s is not running, configuration process aborted ' % container_name)
42 -
43 -# Wait for connectivity
44 -print ("Waiting for container connectivity to start configuration sequence")
45 -if not container.get_ips(timeout=30):
46 - raise Exception("Timeout while waiting for container")
47 -
48 -# Run the required activities now
49 -# 1. Create the builder user
50 -print ("1. Adding user %s" % os.environ['BUILDER_NAME'])
51 -run_command(["useradd", "-m", os.environ['BUILDER_NAME']])
52 -
53 -# Fetch package dependencies for the build
54 -print ("2. Installing package dependencies within LXC container")
55 -run_command(["apt-get", "update", "-y"])
56 -run_command(["apt-get", "install", "-y", "sudo"])
57 -run_command(["apt-get", "install", "-y", "wget"])
58 -run_command(["apt-get", "install", "-y", "bash"])
59 -run_command(["wget", "-T", "15", "-O", "~/.install-required-packages.sh", "https://raw.githubusercontent.com/netdata/netdata-demo-site/master/install-required-packages.sh"])
60 -run_command(["bash", "~/.install-required-packages.sh", "netdata", "--dont-wait", "--non-interactive"])
61 -
62 -# Download the source
63 -dest_archive="/home/%s/netdata-%s.tar.gz" % (os.environ['BUILDER_NAME'],os.environ['BUILD_VERSION'])
64 -release_url="https://github.com/netdata/netdata/releases/download/%s/netdata-%s.tar.gz" % (os.environ['BUILD_VERSION'], os.environ['BUILD_VERSION'])
65 -print ("3. Fetch netdata source (%s -> %s)" % (release_url, dest_archive))
66 -run_command(["sudo", "-u", os.environ['BUILDER_NAME'], "wget", "-T", "15", "--output-document=" + dest_archive, release_url])
67 -
68 -print ("4. Extracting directory contents to /home " + os.environ['BUILDER_NAME'])
69 -run_command(["sudo", "-u", os.environ['BUILDER_NAME'], "tar", "xf", dest_archive, "-C", "/home/" + os.environ['BUILDER_NAME']])
70 -
71 -print ('Done!')
.travis/package_management/rpm/configure_lxc_environment.py deleted
-89
@@ -1,89 +0,0 @@
1 -#!/usr/bin/env python3
2 -#
3 -# Prepare the build environment within the container
4 -# The script attaches to the running container and does the following:
5 -# 1) Create the container
6 -# 2) Start the container up
7 -# 3) Create the builder user
8 -# 4) Prepare the environment for RPM build
9 -#
10 -# Copyright: SPDX-License-Identifier: GPL-3.0-or-later
11 -#
12 -# Author : Pavlos Emm. Katsoulakis <paul@netdata.cloud>
13 -
14 -import os
15 -import sys
16 -import lxc
17 -
18 -def run_command(command):
19 - print ("Running command: %s" % command)
20 - command_result = container.attach_wait(lxc.attach_run_command, command)
21 -
22 - if command_result != 0:
23 - raise Exception("Command failed with exit code %d" % command_result)
24 -
25 -if len(sys.argv) != 2:
26 - print ('You need to provide a container name to get things started')
27 - sys.exit(1)
28 -container_name=sys.argv[1]
29 -
30 -# Setup the container object
31 -print ("Defining container %s" % container_name)
32 -container = lxc.Container(container_name)
33 -if not container.defined:
34 - raise Exception("Container %s not defined!" % container_name)
35 -
36 -# Start the container
37 -if not container.start():
38 - raise Exception("Failed to start the container")
39 -
40 -if not container.running or not container.state == "RUNNING":
41 - raise Exception('Container %s is not running, configuration process aborted ' % container_name)
42 -
43 -# Wait for connectivity
44 -print ("Waiting for container connectivity to start configuration sequence")
45 -if not container.get_ips(timeout=30):
46 - raise Exception("Timeout while waiting for container")
47 -
48 -# Run the required activities now
49 -# Create the builder user
50 -print ("1. Adding user %s" % os.environ['BUILDER_NAME'])
51 -run_command(["useradd", "-m", os.environ['BUILDER_NAME']])
52 -
53 -# Fetch package dependencies for the build
54 -print ("2. Installing package dependencies within LXC container")
55 -if str(os.environ["REPO_TOOL"]).count("zypper") == 1:
56 - run_command([os.environ["REPO_TOOL"], "clean", "-a"])
57 - run_command([os.environ["REPO_TOOL"], "--no-gpg-checks", "update", "-y"])
58 -else:
59 - run_command([os.environ["REPO_TOOL"], "update", "-y"])
60 -
61 -run_command([os.environ["REPO_TOOL"], "install", "-y", "sudo"])
62 -run_command([os.environ["REPO_TOOL"], "install", "-y", "wget"])
63 -run_command([os.environ["REPO_TOOL"], "install", "-y", "bash"])
64 -run_command(["wget", "-T", "15", "-O", "~/.install-required-packages.sh", "https://raw.githubusercontent.com/netdata/netdata-demo-site/master/install-required-packages.sh"])
65 -run_command(["bash", "~/.install-required-packages.sh", "netdata", "--dont-wait", "--non-interactive"])
66 -
67 -print ("3. Setting up macros")
68 -run_command(["sudo", "-u", os.environ['BUILDER_NAME'], "/bin/echo", "'%_topdir %(echo /home/" + os.environ['BUILDER_NAME'] + ")/rpmbuild' > /home/" + os.environ['BUILDER_NAME'] + "/.rpmmacros"])
69 -
70 -print ("4. Create rpmbuild directory")
71 -run_command(["sudo", "-u", os.environ['BUILDER_NAME'], "mkdir", "-p", "/home/" + os.environ['BUILDER_NAME'] + "/rpmbuild/BUILD"])
72 -run_command(["sudo", "-u", os.environ['BUILDER_NAME'], "mkdir", "-p", "/home/" + os.environ['BUILDER_NAME'] + "/rpmbuild/RPMS"])
73 -run_command(["sudo", "-u", os.environ['BUILDER_NAME'], "mkdir", "-p", "/home/" + os.environ['BUILDER_NAME'] + "/rpmbuild/SOURCES"])
74 -run_command(["sudo", "-u", os.environ['BUILDER_NAME'], "mkdir", "-p", "/home/" + os.environ['BUILDER_NAME'] + "/rpmbuild/SPECS"])
75 -run_command(["sudo", "-u", os.environ['BUILDER_NAME'], "mkdir", "-p", "/home/" + os.environ['BUILDER_NAME'] + "/rpmbuild/SRPMS"])
76 -run_command(["sudo", "-u", os.environ['BUILDER_NAME'], "ls", "-ltrR", "/home/" + os.environ['BUILDER_NAME'] + "/rpmbuild"])
77 -
78 -# Download the source
79 -dest_archive="/home/%s/rpmbuild/SOURCES/netdata-%s.tar.gz" % (os.environ['BUILDER_NAME'],os.environ['BUILD_VERSION'])
80 -release_url="https://github.com/netdata/netdata/releases/download/%s/netdata-%s.tar.gz" % (os.environ['BUILD_VERSION'], os.environ['BUILD_VERSION'])
81 -print ("5. Fetch netdata source into the repo structure(%s -> %s)" % (release_url, dest_archive))
82 -run_command(["sudo", "-u", os.environ['BUILDER_NAME'], "wget", "-T", "15", "--output-document=" + dest_archive, release_url])
83 -
84 -# Extract the spec file in place
85 -print ("6. Extract spec file from the source")
86 -spec_file="/home/%s/rpmbuild/SPECS/netdata.spec" % os.environ['BUILDER_NAME']
87 -run_command(["sudo", "-u", os.environ['BUILDER_NAME'], "tar", "--to-command=cat > %s" % spec_file, "-xvf", dest_archive, "netdata-%s/netdata.spec" % os.environ['BUILD_VERSION']])
88 -
89 -print ('Done!')
.travis/package_management/rpm/trigger_lxc_build.py deleted
-62
@@ -1,62 +0,0 @@
1 -#!/usr/bin/env python3
2 -#
3 -# This script is responsible for running the RPM build on the running container
4 -#
5 -# Copyright: SPDX-License-Identifier: GPL-3.0-or-later
6 -#
7 -# Author : Pavlos Emm. Katsoulakis <paul@netdata.cloud>
8 -
9 -import os
10 -import sys
11 -import lxc
12 -
13 -def run_command(command):
14 - print ("Running command: %s" % command)
15 - command_result = container.attach_wait(lxc.attach_run_command, command)
16 -
17 - if command_result != 0:
18 - raise Exception("Command failed with exit code %d" % command_result)
19 -
20 -print (sys.argv)
21 -if len(sys.argv) != 2:
22 - print ('You need to provide a container name to get things started')
23 - sys.exit(1)
24 -container_name=sys.argv[1]
25 -
26 -# Load the container, break if its not there
27 -print ("Starting up container %s" % container_name)
28 -container = lxc.Container(container_name)
29 -if not container.defined:
30 - raise Exception("Container %s does not exist!" % container_name)
31 -
32 -# Check if the container is running, attempt to start it up in case its not running
33 -if not container.running or not container.state == "RUNNING":
34 - print ('Container %s is not running, attempt to start it up' % container_name)
35 -
36 - # Start the container
37 - if not container.start():
38 - raise Exception("Failed to start the container")
39 -
40 - if not container.running or not container.state == "RUNNING":
41 - raise Exception('Container %s is not running, configuration process aborted ' % container_name)
42 -
43 -# Wait for connectivity
44 -if not container.get_ips(timeout=30):
45 - raise Exception("Timeout while waiting for container")
46 -
47 -print ("Adding builder specific dependencies to the LXC container")
48 -run_command([os.environ["REPO_TOOL"], "install", "-y", "rpm-build"])
49 -run_command([os.environ["REPO_TOOL"], "install", "-y", "rpm-devel"])
50 -run_command([os.environ["REPO_TOOL"], "install", "-y", "rpmlint"])
51 -run_command([os.environ["REPO_TOOL"], "install", "-y", "make"])
52 -run_command([os.environ["REPO_TOOL"], "install", "-y", "python"])
53 -run_command([os.environ["REPO_TOOL"], "install", "-y", "bash"])
54 -run_command([os.environ["REPO_TOOL"], "install", "-y", "diffutils"])
55 -run_command([os.environ["REPO_TOOL"], "install", "-y", "patch"])
56 -run_command([os.environ["REPO_TOOL"], "install", "-y", "rpmdevtools"])
57 -
58 -# Run the build process on the container
59 -print ("Starting RPM build process")
60 -run_command(["sudo", "-u", os.environ['BUILDER_NAME'], "rpmbuild", "-ba", "--rebuild", "/home/%s/rpmbuild/SPECS/netdata.spec" % os.environ['BUILDER_NAME']])
61 -
62 -print ('Done!')
.travis/package_management/trigger_deb_lxc_build.py renamed
+9 -16
@@ -6,32 +6,25 @@
6 #
7 # Author : Pavlos Emm. Katsoulakis <paul@netdata.cloud>
8
9 +import common
10 import os
11 import sys
12 import lxc
13
13 -def run_command(command):
14 - print ("Running command: %s" % command)
15 - command_result = container.attach_wait(lxc.attach_run_command, command)
16 -
17 - if command_result != 0:
18 - raise Exception("Command failed with exit code %d" % command_result)
19 -
20 -print (sys.argv)
14 if len(sys.argv) != 2:
22 - print ('You need to provide a container name to get things started')
15 + print('You need to provide a container name to get things started')
16 sys.exit(1)
17 container_name=sys.argv[1]
18
19 # Load the container, break if its not there
27 -print ("Starting up container %s" % container_name)
20 +print("Starting up container %s" % container_name)
21 container = lxc.Container(container_name)
22 if not container.defined:
23 raise Exception("Container %s does not exist!" % container_name)
24
25 # Check if the container is running, attempt to start it up in case its not running
26 if not container.running or not container.state == "RUNNING":
34 - print ('Container %s is not running, attempt to start it up' % container_name)
27 + print('Container %s is not running, attempt to start it up' % container_name)
28
29 # Start the container
30 if not container.start():
@@ -44,15 +37,15 @@ if not container.running or not container.state == "RUNNING":
37 if not container.get_ips(timeout=30):
38 raise Exception("Timeout while waiting for container")
39
47 -print ("Setting up EMAIL and DEBFULLNAME variables required by the build tools")
40 +print("Setting up EMAIL and DEBFULLNAME variables required by the build tools")
41 os.environ["EMAIL"] = "bot@netdata.cloud"
42 os.environ["DEBFULLNAME"] = "Netdata builder"
43
44 # Run the build process on the container
52 -print ("Starting DEB build process, running dh-make")
45 +print("Starting DEB build process, running dh-make")
46 new_version = os.environ["BUILD_VERSION"].replace('v', '')
47
55 -print ("Building the package")
56 -run_command(["sudo", "-u", os.environ['BUILDER_NAME'], "dpkg-buildpackage", "--host-arch", "amd64", "--target-arch", "amd64", "--post-clean", "--pre-clean", "--build=binary", "--release-by=\"Netdata Builder\"", "--build-by=\"Netdata Builder\""])
48 +print("Building the package")
49 +common.run_command(container, ["sudo", "-u", os.environ['BUILDER_NAME'], "dpkg-buildpackage", "--host-arch", "amd64", "--target-arch", "amd64", "--post-clean", "--pre-clean", "--build=binary", "--release-by=\"Netdata Builder\"", "--build-by=\"Netdata Builder\""])
50
58 -print ('Done!')
51 +print('Done!')
.travis/package_management/trigger_rpm_lxc_build.py new
+55
@@ -0,0 +1,55 @@
1 +#!/usr/bin/env python3
2 +#
3 +# This script is responsible for running the RPM build on the running container
4 +#
5 +# Copyright: SPDX-License-Identifier: GPL-3.0-or-later
6 +#
7 +# Author : Pavlos Emm. Katsoulakis <paul@netdata.cloud>
8 +
9 +import common
10 +import os
11 +import sys
12 +import lxc
13 +
14 +if len(sys.argv) != 2:
15 + print('You need to provide a container name to get things started')
16 + sys.exit(1)
17 +container_name=sys.argv[1]
18 +
19 +# Load the container, break if its not there
20 +print("Starting up container %s" % container_name)
21 +container = lxc.Container(container_name)
22 +if not container.defined:
23 + raise Exception("Container %s does not exist!" % container_name)
24 +
25 +# Check if the container is running, attempt to start it up in case its not running
26 +if not container.running or not container.state == "RUNNING":
27 + print('Container %s is not running, attempt to start it up' % container_name)
28 +
29 + # Start the container
30 + if not container.start():
31 + raise Exception("Failed to start the container")
32 +
33 + if not container.running or not container.state == "RUNNING":
34 + raise Exception('Container %s is not running, configuration process aborted ' % container_name)
35 +
36 +# Wait for connectivity
37 +if not container.get_ips(timeout=30):
38 + raise Exception("Timeout while waiting for container")
39 +
40 +print("Adding builder specific dependencies to the LXC container")
41 +common.run_command(container, [os.environ["REPO_TOOL"], "install", "-y", "rpm-build"])
42 +common.run_command(container, [os.environ["REPO_TOOL"], "install", "-y", "rpm-devel"])
43 +common.run_command(container, [os.environ["REPO_TOOL"], "install", "-y", "rpmlint"])
44 +common.run_command(container, [os.environ["REPO_TOOL"], "install", "-y", "make"])
45 +common.run_command(container, [os.environ["REPO_TOOL"], "install", "-y", "python"])
46 +common.run_command(container, [os.environ["REPO_TOOL"], "install", "-y", "bash"])
47 +common.run_command(container, [os.environ["REPO_TOOL"], "install", "-y", "diffutils"])
48 +common.run_command(container, [os.environ["REPO_TOOL"], "install", "-y", "patch"])
49 +common.run_command(container, [os.environ["REPO_TOOL"], "install", "-y", "rpmdevtools"])
50 +
51 +# Run the build process on the container
52 +print("Starting RPM build process")
53 +common.run_command(container, ["sudo", "-u", os.environ['BUILDER_NAME'], "rpmbuild", "-ba", "--rebuild", "/home/%s/rpmbuild/SPECS/netdata.spec" % os.environ['BUILDER_NAME']])
54 +
55 +print('Done!')
.travis/package_management/yank_stale_rpm.sh
+1 -1
@@ -30,6 +30,6 @@ fi
30
31 for pkg in ${PACKAGES_LIST[@]}; do
32 echo "Attempting yank on ${pkg}.."
33 - .travis/package_management/package_cloud_wrapper.sh yank "${TRAVIS_REPO_SLUG}/${DISTRO}" "${pkg}" || echo "Nothing to yank or error on ${pkg}"
33 + .travis/package_management/package_cloud_wrapper.sh yank "${PACKAGING_USER}/${DEPLOY_REPO}/${DISTRO}" "${pkg}" || echo "Nothing to yank or error on ${pkg}"
34 done
35
netdata.spec.in
+296 -69
@@ -6,11 +6,15 @@
6 # error.
7 %global __os_install_post %{nil}
8
9 +# Mitigate the cross-distro mayhem by strictly defining the libexec destination
10 +%define _prefix /usr
11 +%define _sysconfdir /etc
12 +%define _localstatedir /var
13 +%define _libexecdir /usr/libexec
14 +
15 #
16 # Conditional build:
17 %bcond_without systemd # systemd
12 -%bcond_with nfacct # build with nfacct plugin
13 -%bcond_with freeipmi # build with freeipmi plugin
18 %bcond_with netns # build with netns support (cgroup-network)
19
20 %if 0%{?fedora} || 0%{?rhel} >= 7 || 0%{?suse_version} >= 1140
@@ -27,8 +31,12 @@ BuildRequires: systemd-rpm-macros \
31 %global netdata_initd_requires \
32 %{?systemd_requires} \
33 %{nil}
30 -%global netdata_init_post %service_add_post netdata.service
31 -%global netdata_init_preun %service_del_preun netdata.service
34 +%global netdata_init_post %service_add_post netdata.service \
35 +/sbin/service netdata restart > /dev/null 2>&1 \
36 +%{nil}
37 +%global netdata_init_preun %service_del_preun netdata.service \
38 +/sbin/service netdata stop > /dev/null 2>&1 \
39 +%{nil}
40 %global netdata_init_postun %service_del_postun netdata.service
41 %else
42 %global netdata_initd_buildrequires \
@@ -38,7 +46,11 @@ Requires(preun): systemd-units \
46 Requires(postun): systemd-units \
47 Requires(post): systemd-units \
48 %{nil}
41 -%global netdata_init_post %systemd_post netdata.service
49 +%global netdata_init_post %systemd_post netdata.service \
50 +/usr/bin/systemctl enable netdata.service \
51 +/usr/bin/systemctl daemon-reload \
52 +/usr/bin/systemctl restart netdata.service \
53 +%{nil}
54 %global netdata_init_preun %systemd_preun netdata.service
55 %global netdata_init_postun %systemd_postun_with_restart netdata.service
56 %endif
@@ -49,6 +61,7 @@ Requires(post): chkconfig \
61 %{nil}
62 %global netdata_init_post \
63 /sbin/chkconfig --add netdata \
64 +/sbin/service netdata restart > /dev/null 2>&1 \
65 %{nil}
66 %global netdata_init_preun %{nil} \
67 if [ $1 = 0 ]; then \
@@ -63,23 +76,7 @@ fi \
76 %{nil}
77 %endif
78
66 -%if 0%{?_fedora}
67 -%global netdata_recommends \
68 -Recommends: curl \
69 -Recommends: iproute-tc \
70 -Recommends: lm_sensors \
71 -Recommends: nmap-ncat \
72 -Recommends: nodejs \
73 -Recommends: python \
74 -Recommends: PyYAML \
75 -Recommends: python2-PyMySQL \
76 -Recommends: python2-psycopg2 \
77 -%{nil}
78 -%else
79 -%global netdata_recommends %{nil}
80 -%endif
81 -
82 -Summary: Real-time performance monitoring, done right
79 +Summary: Real-time performance monitoring, done right!
80 Name: netdata
81 Version: @PACKAGE_VERSION@
82 Release: 1%{?dist}
@@ -87,43 +84,122 @@ License: GPLv3+
84 Group: Applications/System
85 Source0: https://github.com/netdata/%{name}/releases/download/%{version}/%{name}-%{version}.tar.gz
86 URL: http://my-netdata.io
90 -BuildRequires: pkgconfig
91 -BuildRequires: xz
92 -BuildRequires: zlib-devel
93 -BuildRequires: libuuid-devel
94 -BuildRequires: autoconf
95 -BuildRequires: automake
96 -Requires: zlib
97 -Requires: libuuid
98 -
99 -# Packages can be found in the EPEL repo
100 -%if %{with nfacct}
101 -BuildRequires: libmnl-devel
102 -BuildRequires: libnetfilter_acct-devel
103 -Requires: libmnl
104 -Requires: libnetfilter_acct
87 +
88 +# #####################################################################
89 +# Core build/install/runtime dependencies
90 +# #####################################################################
91 +
92 +# Build dependencies
93 +#
94 +BuildRequires: gcc
95 +BuildRequires: make
96 +BuildRequires: git
97 +BuildRequires: autoconf
98 +%if 0%{?fedora} || 0%{?rhel} >= 7 || 0%{?suse_version} >= 1140
99 +BuildRequires: autoconf-archive
100 +BuildRequires: autogen
101 +%endif
102 +BuildRequires: automake
103 +BuildRequires: pkgconfig
104 +BuildRequires: curl
105 +BuildRequires: findutils
106 +BuildRequires: zlib-devel
107 +BuildRequires: libuuid-devel
108 +BuildRequires: libuv-devel >= 1
109 +BuildRequires: openssl-devel
110 +%if 0%{?suse_version}
111 +BuildRequires: judy-devel
112 +BuildRequires: liblz4-devel
113 +BuildRequires: netcat-openbsd
114 +BuildRequires: json-glib-devel
115 +%else
116 +BuildRequires: Judy-devel
117 +BuildRequires: lz4-devel
118 +BuildRequires: nc
119 +BuildRequires: json-c-devel
120 %endif
121
107 -%if %{with freeipmi}
108 -BuildRequires: freeipmi-devel
109 -Requires: freeipmi
122 +# Core build requirements for service install
123 +%{netdata_initd_buildrequires}
124 +
125 +# Runtime dependencies
126 +#
127 +Requires: python
128 +Requires: zlib
129 +%if 0%{?suse_version}
130 +# for libuv, Requires version >= 1
131 +Requires: libuv1
132 +Requires: libJudy1
133 +Requires: json-glib
134 +Requires: libuuid1
135 +%else
136 +# for libuv, Requires version >= 1
137 +Requires: libuv >= 1
138 +Requires: Judy
139 +Requires: json-c
140 +Requires: libuuid
141 %endif
142 +Requires: openssl
143 +Requires: lz4
144
145 +# Core requirements for the install to succeed
146 Requires(pre): /usr/sbin/groupadd
147 Requires(pre): /usr/sbin/useradd
148 +%if 0%{?suse_version} >= 1140
149 +Requires(post): libcap1
150 +%else
151 Requires(post): libcap
152 +%endif
153
116 -%{netdata_initd_buildrequires}
117 -%{netdata_recommends}
154 %{netdata_initd_requires}
155
156 +# #####################################################################
157 +# Functionality-dependent package dependencies
158 +# #####################################################################
159 +# Note: Some or all of the Packages may be found in the EPEL repo,
160 +# rather than the standard ones
161 +
162 +# nfacct plugin dependencies
163 +BuildRequires: libmnl-devel
164 +%if 0%{?fedora} || 0%{?suse_version} >= 1140
165 +BuildRequires: libnetfilter_acct-devel
166 +%endif
167 +
168 +%if 0%{?suse_version}
169 +Requires: libmnl0
170 +%else
171 +Requires: libmnl
172 +%endif
173 +
174 +%if 0%{?fedora}
175 +Requires: libnetfilter_acct
176 +%else
177 +%if 0%{?suse_version} >= 1140
178 +Requires: libnetfilter_acct1
179 +%endif
180 +%endif
181 +# end nfacct plugin dependencies
182 +
183 +# freeipmi plugin dependencies
184 +BuildRequires: freeipmi-devel
185 +Requires: freeipmi
186 +# end - freeipmi plugin dependencies
187 +
188 +# CUPS plugin dependencies
189 +BuildRequires: cups-devel
190 +Requires: cups
191 +# end - cups plugin dependencies
192 +
193 +# #####################################################################
194 +# End of dependency management configuration
195 +# #####################################################################
196 +
197 %description
121 -netdata is the fastest way to visualize metrics. It is a resource
198 + netdata is the fastest way to visualize metrics. It is a resource
199 efficient, highly optimized system for collecting and visualizing any
200 type of realtime timeseries data, from CPU usage, disk activity, SQL
201 queries, API calls, web site visitors, etc.
125 -
126 -netdata tries to visualize the truth of now, in its greatest detail,
202 + netdata tries to visualize the truth of now, in its greatest detail,
203 so that you can get insights of what is happening now and what just
204 happened, on your systems and applications.
205
@@ -131,25 +207,57 @@ happened, on your systems and applications.
207 %setup -q -n %{name}-%{version}
208
209 %build
134 -autoreconf -i
210 +# Conf step
211 +autoreconf -ivf
212 %configure \
213 + --prefix="%{_prefix}" \
214 + --sysconfdir="%{_sysconfdir}" \
215 + --localstatedir="%{_localstatedir}" \
216 + --libexecdir="%{_libexecdir}" \
217 --with-zlib \
218 --with-math \
138 - %{?with_nfacct:--enable-plugin-nfacct} \
139 - %{?with_freeipmi:--enable-plugin-freeipmi} \
140 - --with-user=netdata
219 + --with-user=netdata \
220 +
221 +# Build step
222 %{__make} %{?_smp_mflags}
223
224 %install
225 +
226 +# ###########################################################
227 +# Clear the directory, if already exists and install
228 rm -rf "${RPM_BUILD_ROOT}"
229 %{__make} %{?_smp_mflags} DESTDIR="${RPM_BUILD_ROOT}" install
230
231 find "${RPM_BUILD_ROOT}" -name .keep -delete
232
233 install -m 644 -p system/netdata.conf "${RPM_BUILD_ROOT}%{_sysconfdir}/%{name}"
234 +
235 +# ###########################################################
236 +# logrotate settings
237 install -m 755 -d "${RPM_BUILD_ROOT}%{_sysconfdir}/logrotate.d"
238 install -m 644 -p system/netdata.logrotate "${RPM_BUILD_ROOT}%{_sysconfdir}/logrotate.d/%{name}"
239
240 +# ###########################################################
241 +# Install freeipmi
242 +install -m 4750 -p freeipmi.plugin "${RPM_BUILD_ROOT}%{_libexecdir}/%{name}/plugins.d/freeipmi.plugin"
243 +
244 +# ###########################################################
245 +# Install apps.plugin
246 +install -m 4750 -p apps.plugin "${RPM_BUILD_ROOT}%{_libexecdir}/%{name}/plugins.d/apps.plugin"
247 +
248 +# ###########################################################
249 +# Install perf.plugin
250 +install -m 4750 -p perf.plugin "${RPM_BUILD_ROOT}%{_libexecdir}/%{name}/plugins.d/perf.plugin"
251 +
252 +# ###########################################################
253 +# Install registry directory
254 +install -m 755 -d "${RPM_BUILD_ROOT}%{_localstatedir}/lib/%{name}/registry"
255 +install -m 755 -d "${RPM_BUILD_ROOT}%{_sysconfdir}/%{name}/custom-plugins.d"
256 +install -m 755 -d "${RPM_BUILD_ROOT}%{_sysconfdir}/%{name}/go.d"
257 +install -m 755 -d "${RPM_BUILD_ROOT}%{_sysconfdir}/%{name}/ssl"
258 +
259 +# ###########################################################
260 +# Install netdata service
261 %if %{with systemd}
262 install -m 755 -d "${RPM_BUILD_ROOT}%{_unitdir}"
263 install -m 644 -p system/netdata.service "${RPM_BUILD_ROOT}%{_unitdir}/netdata.service"
@@ -160,7 +268,100 @@ install -m 755 system/netdata-init-d \
268 "${RPM_BUILD_ROOT}/etc/rc.d/init.d/netdata"
269 %endif
270
271 +# ############################################################
272 +# Package Go within netdata (TBD: Package it separately)
273 +safe_sha256sum() {
274 + # Within the contexct of the installer, we only use -c option that is common between the two commands
275 + # We will have to reconsider if we start non-common options
276 + if command -v sha256sum >/dev/null 2>&1; then
277 + sha256sum $@
278 + elif command -v shasum >/dev/null 2>&1; then
279 + shasum -a 256 $@
280 + else
281 + fatal "I could not find a suitable checksum binary to use"
282 + fi
283 +}
284 +
285 +download_go() {
286 + url="${1}"
287 + dest="${2}"
288 +
289 + if command -v curl >/dev/null 2>&1; then
290 + curl -sSL --connect-timeout 10 --retry 3 "${url}" > "${dest}"
291 + elif command -v wget >/dev/null 2>&1; then
292 + wget -T 15 -O - "${url}" > "${dest}"
293 + else
294 + echo >&2
295 + echo >&2 "Downloading go.d plugin from '${url}' failed because of missing mandatory packages."
296 + echo >&2 "Either add packages or disable it by issuing '--disable-go' in the installer"
297 + echo >&2
298 + exit 1
299 + fi
300 +}
301 +
302 +install_go() {
303 + # When updating this value, ensure correct checksums in packaging/go.d.checksums
304 + GO_PACKAGE_VERSION="v0.7.0"
305 + ARCH_MAP=(
306 + 'i386::386'
307 + 'i686::386'
308 + 'x86_64::amd64'
309 + 'aarch64::arm64'
310 + 'armv64::arm64'
311 + 'armv6l::arm'
312 + 'armv7l::arm'
313 + 'armv5tel::arm'
314 + )
315 +
316 + if [ -z "${NETDATA_DISABLE_GO+x}" ]; then
317 + echo >&2 "Install go.d.plugin"
318 + ARCH=$(uname -m)
319 + OS=$(uname -s | tr '[:upper:]' '[:lower:]')
320 +
321 + for index in "${ARCH_MAP[@]}" ; do
322 + KEY="${index%%::*}"
323 + VALUE="${index##*::}"
324 + if [ "$KEY" = "$ARCH" ]; then
325 + ARCH="${VALUE}"
326 + break
327 + fi
328 + done
329 + tmp=$(mktemp -d /tmp/netdata-go-XXXXXX)
330 + GO_PACKAGE_BASENAME="go.d.plugin-${GO_PACKAGE_VERSION}.${OS}-${ARCH}"
331 + download_go "https://github.com/netdata/go.d.plugin/releases/download/${GO_PACKAGE_VERSION}/${GO_PACKAGE_BASENAME}" "${tmp}/${GO_PACKAGE_BASENAME}"
332 + download_go "https://github.com/netdata/go.d.plugin/releases/download/${GO_PACKAGE_VERSION}/config.tar.gz" "${tmp}/config.tar.gz"
333 +
334 + if [ ! -f "${tmp}/${GO_PACKAGE_BASENAME}" ] || [ ! -f "${tmp}/config.tar.gz" ] || [ ! -s "${tmp}/config.tar.gz" ] || [ ! -s "${tmp}/${GO_PACKAGE_BASENAME}" ]; then
335 + echo >&2 "Either check the error or consider disabling it by issuing '--disable-go' in the installer"
336 + echo >&2
337 + return 1
338 + fi
339 +
340 + grep "${GO_PACKAGE_BASENAME}\$" "packaging/go.d.checksums" > "${tmp}/sha256sums.txt" 2>/dev/null
341 + grep "config.tar.gz" "packaging/go.d.checksums" >> "${tmp}/sha256sums.txt" 2>/dev/null
342 +
343 + # Checksum validation
344 + if ! (cd "${tmp}" && safe_sha256sum -c "sha256sums.txt"); then
345 +
346 + echo >&2 "go.d plugin checksum validation failure."
347 + echo >&2 "Either check the error or consider disabling it by issuing '--disable-go' in the installer"
348 + echo >&2
349 +
350 + echo "go.d.plugin package files checksum validation failed."
351 + exit 1
352 + fi
353 +
354 + # Install files
355 + tar -xf "${tmp}/config.tar.gz" -C "${RPM_BUILD_ROOT}%{_libdir}/%{name}/conf.d/"
356 + mv "${tmp}/$GO_PACKAGE_BASENAME" "${RPM_BUILD_ROOT}%{_libexecdir}/%{name}/plugins.d/go.d.plugin"
357 + fi
358 + return 0
359 +}
360 +install_go
361 +
362 %pre
363 +
364 +# User/Group creations, as needed
365 getent group netdata >/dev/null || groupadd -r netdata
366 getent group docker >/dev/null || groupadd -r docker
367 getent passwd netdata >/dev/null || \
@@ -181,24 +382,28 @@ rm -rf "${RPM_BUILD_ROOT}"
382
383 %files
384 %doc README.md
184 -%defattr(-,root,root)
385 +%defattr(-,root,netdata)
386
387 %dir %{_sysconfdir}/%{name}
388 %dir %{_libdir}/%{name}
389
189 -%config %{_sysconfdir}/%{name}/*.conf
190 -#%config %{_sysconfdir}/%{name}/charts.d/*.conf
191 -#%config %{_sysconfdir}/%{name}/health.d/*.conf
192 -#%config %{_sysconfdir}/%{name}/node.d/*.conf
193 -#%config %{_sysconfdir}/%{name}/python.d/*.conf
194 -#%config %{_sysconfdir}/%{name}/statsd.d/*.conf
195 -%config %{_sysconfdir}/logrotate.d/%{name}
390 +%config(noreplace) %{_sysconfdir}/%{name}/*.conf
391 +%config(noreplace) %{_sysconfdir}/logrotate.d/%{name}
392
393 %{_libdir}/%{name}
394 +
395 +%defattr(0755,netdata,netdata,0755)
396 %{_libexecdir}/%{name}
397 %{_sbindir}/%{name}
398 %{_sysconfdir}/%{name}/edit-config
399
400 +%defattr(4750,root,netdata,0750)
401 +
402 +%dir %{_libexecdir}/%{name}/python.d
403 +%dir %{_libexecdir}/%{name}/charts.d
404 +%dir %{_libexecdir}/%{name}/plugins.d
405 +%dir %{_libexecdir}/%{name}/node.d
406 +
407 %caps(cap_dac_read_search,cap_sys_ptrace=ep) %attr(0550,root,netdata) %{_libexecdir}/%{name}/plugins.d/apps.plugin
408
409 %if %{with netns}
@@ -209,27 +414,25 @@ rm -rf "${RPM_BUILD_ROOT}"
414 %attr(0550,root,root) %{_libexecdir}/%{name}/plugins.d/cgroup-network-helper.sh
415 %endif
416
212 -%if %{with freeipmi}
213 -%caps(cap_setuid=ep) %attr(4550,root,netdata) %{_libexecdir}/%{name}/plugins.d/freeipmi.plugin
214 -%endif
417 +# perf plugin
418 +%caps(cap_setuid=ep) %attr(4750,root,netdata) %{_libexecdir}/%{name}/plugins.d/perf.plugin
419
216 -%attr(0770,netdata,netdata) %dir %{_localstatedir}/cache/%{name}
217 -%attr(0755,netdata,root) %dir %{_localstatedir}/log/%{name}
218 -%attr(0770,netdata,netdata) %dir %{_localstatedir}/lib/%{name}
420
421 +# freeipmi files
422 +%caps(cap_setuid=ep) %attr(4550,root,netdata) %{_libexecdir}/%{name}/plugins.d/freeipmi.plugin
423 %dir %{_datadir}/%{name}
424
425 +%defattr(0750,netdata,netdata,0755)
426 +
427 %dir %{_sysconfdir}/%{name}/health.d
428 %dir %{_sysconfdir}/%{name}/python.d
429 %dir %{_sysconfdir}/%{name}/charts.d
430 +%dir %{_sysconfdir}/%{name}/custom-plugins.d
431 +%dir %{_sysconfdir}/%{name}/go.d
432 +%dir %{_sysconfdir}/%{name}/ssl
433 %dir %{_sysconfdir}/%{name}/node.d
434 %dir %{_sysconfdir}/%{name}/statsd.d
227 -
228 -%dir %{_libdir}/%{name}/conf.d/health.d
229 -%dir %{_libdir}/%{name}/conf.d/python.d
230 -%dir %{_libdir}/%{name}/conf.d/charts.d
231 -#%dir %{_libdir}/%{name}/conf.d/node.d
232 -%dir %{_libdir}/%{name}/conf.d/statsd.d
435 +%{_libdir}/%{name}/conf.d/
436
437 %if %{with systemd}
438 %{_unitdir}/netdata.service
@@ -242,7 +445,31 @@ rm -rf "${RPM_BUILD_ROOT}"
445 %defattr(0644,root,netdata,0755)
446 %{_datadir}/%{name}/web
447
448 +# Enforce 0660 for files and 0770 for directories
449 +# for the netdata lib, cache and log dirs
450 +%defattr(0660,root,netdata,0770)
451 +%attr(0770,netdata,netdata) %dir %{_localstatedir}/cache/%{name}
452 +%attr(0755,netdata,root) %dir %{_localstatedir}/log/%{name}
453 +%attr(0770,netdata,netdata) %dir %{_localstatedir}/lib/%{name}
454 +%attr(0770,netdata,netdata) %dir %{_localstatedir}/lib/%{name}/registry
455 +
456 +
457 %changelog
458 +* Fri Jun 28 2019 Pavlos Emm. Katsoulakis <paul@netdata.cloud> - 0.0.0-7
459 +- Raise the path overrides to the spec file level, not just the configure.
460 +- Adjust tighter permissions on some folders, based on what we did on our installer
461 +- Introduce go.d plugin download and install, to include it on the package (Temporarily, to become separate package on next iteration)
462 +* Tue Jun 25 2019 Pavlos Emm. Katsoulakis <paul@netdata.cloud> - 0.0.0-6
463 +- Adjust dependency list: Some packages are missing on some distros, adopt to build successfully
464 +* Mon Jun 24 2019 Pavlos Emm. Katsoulakis <paul@netdata.cloud> - 0.0.0-5
465 +Another pass on cleaning up pre/post installation steps
466 +- Sync permission and ownership on files and directories
467 +* Sun Jun 16 2019 Pavlos Emm. Katsoulakis <paul@netdata.cloud> - 0.0.0-4
468 +First draft refactor on package dependencies section
469 +- Remove freeipmi/nfacct plugin flags. We auto-detect all plugins by decision
470 +- Start refactor of package dependencies
471 +- Add missing dependencies, with respect to distro peculiarities
472 +- Adjust existing dependencies, so that distro-specific package names is applied
473 * Wed Jan 02 2019 Pawel Krupa <pkrupa@redhat.com> - 0.0.0-3
474 - Temporary set version statically
475 - Fix changelog ordering