diff options
author | Austin S. Hemmelgarn <austin@netdata.cloud> | 2024-02-14 07:01:52 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-14 07:01:52 -0500 |
commit | 12306a3e05ba5778447c26f2e80a4c71da5bee0c (patch) | |
tree | c25df4359ed40c8fe43b6b3a12b1c90ba85615c8 | |
parent | 2d64790f8c6c8be091ae6a68a64ba7176096681a (diff) |
Assorted cleanup of CI/packaging related code. (#16938)
* Drop unused Dockerfile.test.
It’s not been used for years, and it doesn’t even work at this point for
it’s intended purpose.
* Remove CodeClimate configuration.
We’re not using it anymore, so there is no point to keeping the
configuration around.
* Remove the build_external directory.
This isn’t used by any of our code AFAICT, and if it _is_ needed, it
should actually be in some sub-directory of `tests` instead of a
top-level directory whose name doesn’t even describe what it does.
* Remove .gitattributes
If there's any objection we can reinstate it.
* Move coverity-scan.sh under packaging/utils
* Move cmake files under packaging/cmake
* Remove devcontainer
* Fix up coverity script to run correctly from new location.
---------
Co-authored-by: vkalintiris <vasilis@netdata.cloud>
56 files changed, 20 insertions, 9168 deletions
diff --git a/.codeclimate.yml b/.codeclimate.yml deleted file mode 100644 index c7ae689e2c..0000000000 --- a/.codeclimate.yml +++ /dev/null @@ -1,93 +0,0 @@ -version: "2" -checks: - argument-count: - enabled: false - config: - threshold: 10 - complex-logic: - enabled: false - config: - threshold: 10 - file-lines: - enabled: false - config: - threshold: 5000 - method-complexity: - enabled: false - config: - threshold: 20 - method-count: - enabled: false - config: - threshold: 50 - method-lines: - enabled: false - config: - threshold: 250 - nested-control-flow: - enabled: false - config: - threshold: 4 - return-statements: - enabled: false - config: - threshold: 4 - similar-code: - enabled: false - identical-code: - enabled: false -plugins: - csslint: - enabled: true - duplication: - enabled: false - config: - languages: - - javascript: - mass_threshold: 100 - - python: - python_version: 3 - mass_threshold: 100 - checks: - Similar code: - enabled: false - Identical code: - enabled: false - eslint: - enabled: true - checks: - max-statements: - enabled: false - complexity: - enabled: false - no-eval: - enabled: false - no-extend-native: - enabled: false - no-void: - enabled: false - no-alert: - enabled: false - no-undef-init: - enabled: false - fixme: - enabled: false - phpmd: - enabled: true - radon: - enabled: true - checks: - Complexity: - enabled: false -exclude_patterns: - - ".gitignore" - - ".githooks/" - - "tests/" - - "m4/" - - "src/web/css/" - - "src/web/lib/" - - "src/web/fonts/" - - "src/web/old/" - - "collectors/python.d.plugin/python_modules/pyyaml2/" - - "collectors/python.d.plugin/python_modules/pyyaml3/" - - "collectors/python.d.plugin/python_modules/urllib3/" diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json deleted file mode 100644 index 0f1be69da7..0000000000 --- a/.devcontainer/devcontainer.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "image": "netdata/devenv", - "extensions":[ - "golang.go", - "exiasr.hadolint", - "ms-python.python", - "timonwong.shellcheck", - "redhat.vscode-yaml", - "dbaeumer.vscode-eslint", - "jasonnutter.search-node-modules", - "mgmcdermott.vscode-language-babel", - ], - "forwardPorts": [19999] -}
\ No newline at end of file diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index e594b59f86..0000000000 --- a/.gitattributes +++ /dev/null @@ -1,3 +0,0 @@ -*.c diff=cpp -*.h diff=cpp -*.ksy.in linguist-language=ksy diff --git a/.github/labeler.yml b/.github/labeler.yml index 30ebf663ca..d7c357509f 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -277,7 +277,7 @@ area/tests: - any-glob-to-any-file: - tests/** - src/daemon/unit_test* - - coverity-scan.sh + - packaging/utils/coverity-scan.sh area/web: - any: diff --git a/.github/workflows/coverity.yml b/.github/workflows/coverity.yml index 4f5010a5c6..9113e179ed 100644 --- a/.github/workflows/coverity.yml +++ b/.github/workflows/coverity.yml @@ -7,7 +7,7 @@ on: pull_request: paths: - .github/workflows/coverity.yml - - coverity-scan.sh + - packaging/utils/coverity-scan.sh env: DISABLE_TELEMETRY: 1 concurrency: @@ -42,7 +42,7 @@ jobs: COVERITY_SCAN_TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }} COVERITY_SCAN_SUBMIT_MAIL: ${{ secrets.COVERITY_SCAN_SUBMIT_MAIL }} run: | - bash -x ./coverity-scan.sh --with-install + bash -x ./packaging/utils/coverity-scan.sh --with-install - name: Failure Notification uses: rtCamp/action-slack-notify@v2 env: diff --git a/CMakeLists.txt b/CMakeLists.txt index 6945ebdc71..ef9f438587 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1522,7 +1522,7 @@ set_source_files_properties(JudyLTables.c PROPERTIES COMPILE_OPTIONS "-I${CMAKE_ # build libnetdata # -include(systemd.cmake) +include(packaging/cmake/systemd.cmake) add_library(libnetdata STATIC ${LIBNETDATA_FILES}) @@ -2229,7 +2229,7 @@ if (NOT NETDATA_USER) endif() set(VERSION "${GIT_DESCRIBE_OUTPUT}") -configure_file(config.cmake.h.in config.h) +configure_file(packaging/cmake/config.cmake.h.in config.h) # # install diff --git a/Dockerfile.test b/Dockerfile.test deleted file mode 100644 index ef087d8297..0000000000 --- a/Dockerfile.test +++ /dev/null @@ -1,74 +0,0 @@ -# NOTE: This Dockerfile (`Dockerfile.test`) should only be used for dev/testing -# and *NOT* in production. Use the top-level `Dockerfile` which points to -# `./packaging/docker/Dockerfile`. -# -# TODO: Create a netdata/package-builder:alpine9 -#FROM netdata/package-builder:alpine AS build -FROM alpine:3.9 AS build - -# Install Dependencies -RUN apk add --no-cache -U alpine-sdk bash curl libuv-dev zlib-dev \ - util-linux-dev libmnl-dev gcc make git autoconf \ - automake pkgconfig python logrotate openssl-dev \ - cmake - -# Pass optional ./netdata-installer.sh args with --build-arg INSTALLER_ARGS=... -ARG INSTALLER_ARGS="" - -# Copy Sources -# Can also bind-mount sources with: -# $ docker run -v $PWD:/netdata - -WORKDIR /netdata -COPY . . - -# Build -RUN ./netdata-installer.sh --dont-wait --dont-start-it --disable-go "${INSTALLER_ARGS}" - -FROM alpine:3.9 AS runtime - -# Install runtime dependencies -RUN apk --no-cache -U add curl bash libuv zlib util-linux libmnl python - -# Create netdata user/group -RUN addgroup -S netdata && \ - adduser -D -S -h /var/empty -s /bin/false -G netdata netdata - -# Copy binary from build layer -COPY --from=build /usr/sbin/netdata /usr/sbin/netdata - -# Copy configuration files from build layer -COPY --from=build /etc/netdata/ /etc/netdata/ -COPY --from=build /usr/lib/netdata/ /usr/lib/netdata/ - -# Copy assets from build layer -COPY --from=build /usr/share/netdata/ /usr/share/netdata/ - -# Create some directories netdata needs -RUN mkdir -p \ - /etc/netdata \ - /var/log/netdata \ - /var/lib/netdata \ - /var/cache/netdata \ - /usr/lib/netdata/conf.d \ - /usr/libexec/netdata/plugins.d - -# Fix permissions/ownerships -RUN chown -R netdata:netdata \ - /etc/netdata/ \ - /usr/lib/netdata/ \ - /usr/share/netdata/ \ - /var/log/netdata \ - /var/lib/netdata \ - /var/cache/netdata \ - /usr/libexec/netdata - -VOLUME /etc/netdata -VOLUME /var/lib/netdata -VOLUME /var/log/netdata - -EXPOSE 19999/tcp - -USER netdata - -CMD ["/usr/sbin/netdata", "-D"] diff --git a/build_external/README.md b/build_external/README.md deleted file mode 100644 index 9905bddf39..0000000000 --- a/build_external/README.md +++ /dev/null @@ -1,131 +0,0 @@ -<!-- -title: "External build-system" -custom_edit_url: https://github.com/netdata/netdata/edit/master/build_external/README.md -sidebar_label: "External build-system" -learn_status: "Published" -learn_topic_type: "References" -learn_rel_path: "Installation/Package maintainers" ---> - -# External build-system - -This wraps the build-system in Docker so that the host system and the target system are -decoupled. This allows: - -- Cross-compilation (e.g. linux development from macOS) -- Cross-distro (e.g. using CentOS user-land while developing on Debian) -- Multi-host scenarios (e.g. parent-child configurations) -- Bleeding-edge scenarios (e.g. using the ACLK (**currently for internal-use only**)) - -The advantage of these scenarios is that they allow **reproducible** builds and testing -for developers. This is the first iteration of the build-system to allow the team to use -it and get used to it. - -For configurations that involve building and running the agent alone, we still use -`docker-compose` for consistency with more complex configurations. The more complex -configurations allow the agent to be run in conjunction with parts of the cloud -infrastructure (these parts of the code are not public), or with external brokers -(such as VerneMQ for MQTT), or with other external tools (such as TSDB to allow the agent to -export metrics). Note: no external TSDB scenarios are available in the first iteration, -they will be added in subsequent iterations. - -This differs from the packaging dockerfiles as it designed to be used for local development. -The main difference is that these files are designed to support incremental compilation in -the following way: - -1. The initial build should be performed using `bin/clean-install.sh` to create a docker - image with the agent built from the source tree and installed into standard system paths - using `netdata-installer.sh`. In addition to the steps performed by the standard packaging - builds a manifest is created to allow subsequent builds to be made incrementally using - `make` inside the container. Any libraries that are required for 'bleeding-edge' development - are added on top of the standard install. -2. When the `bin/make-install.sh` script is used the docker container will be updated with - a sanitized version of the current build-tree. The manifest will be used to line up the - state of the incoming docker cache with `make`'s view of the file-system according to the - manifest. This means the `make install` inside the container will only rebuild changes - since the last time the disk image was created. - -The exact improvement on the compile-cycle depends on the speed of the network connection -to pull the netdata dependencies, but should shrink the time considerably. For example, -on a macbook pro the initial install takes about 1min + network delay [Note: there is -something bad happening with the standard installer at the end of the container build as -it tries to kill the running agent - this is very slow and bad] and the incremental -step only takes 15s. On a debian host with a fast network this reduces 1m30 -> 13s. - -## Examples - -1. Simple cross-compilation / cross-distro builds. - -```bash -build_external/bin/clean-install.sh arch current -docker run -it --rm arch_current_dev -echo >>daemon/main.c # Simulate edit by touching file -build_external/bin/make-install.sh arch current -docker run -it --rm arch_current_dev -``` - -Currently there is no detection of when the installer needs to be rerun (really this is -when the `autoreconf` / `configure` step must be rerun). Netdata was not written with -multi-stage builds in mind and we need to work out how to do this in the future. For now -it is up to you to know when you need to rerun the clean build step. - -```bash -build_external/bin/clean-install.sh arch current -build_external/bin/clean-install.sh ubuntu 19.10 -docker run -it --rm arch_current_dev -echo >>daemon/main.c # Simulate edit by touching file -build_external/bin/make-install.sh arch current -docker run -it --rm arch_current_dev -echo >>daemon/daemon.c # Simulate second edit step -build_external/bin/make-install.sh arch current # Observe a single file is rebuilt -build_external/bin/make-install.sh arch current # Observe both files are rebuilt -``` - -The state of the build in the two containers is independent. - -2. Single agent config in docker-compose - -This functions the same as the previous example but is wrapped in docker-compose to -allow injection into more complex test configurations. - -```bash -Distro=debian Version=10 docker-compose -f projects/only-agent/docker-compose.yml up -``` - -Note: it is possible to run multiple copies of the agent using the `--scale` option for -`docker-compose up`. - -```bash -Distro=debian Version=10 docker-compose -f projects/only-agent/docker-compose.yml up --scale agent=3 -``` - -3. A simple parent-child scenario - -```bash -# Need to call clean-install on the configs used in the parent-child containers -docker-compose -f parent-child/docker-compose.yml up --scale agent_child1=2 -``` - -Note: this is not production ready yet, but it is left in so that we can see how it behaves -and improve it. Currently it produces the following problems: - * Only the base-configuration in the compose without scaling works. - * The containers are hard-coded in the compose. - * There is no way to separate the agent configurations, so running multiple agent child nodes with the same GUID kills - the parent which exits with a fatal condition. - -4. The ACLK - -This is for internal use only as it requires access to a private repo. Clone the vernemq-docker -repo and follow the instructions within to build an image called `vernemq`. - -```bash -build_external/bin/clean-install.sh arch current # Only needed first time -docker-compose -f build_external/projects/aclk-testing/vernemq-compose.yml -f build_external/projects/aclk-testing/agent-compose.yml up --build -``` - -Notes: -* We are currently limited to arch because of restrictions on libwebsockets -* There is not yet a good way to configure the target agent container from the docker-compose command line. -* Several other containers should be in this compose (a paho client, tshark etc). - - diff --git a/build_external/bin/clean-install.sh b/build_external/bin/clean-install.sh deleted file mode 100755 index 78d1f325fe..0000000000 --- a/build_external/bin/clean-install.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/usr/bin/env bash - -DISTRO="$1" -VERSION="$2" -BuildBase="$(cd "$(dirname "$0")" && cd .. && pwd)" - -# This is temporary - not all of the package-builder images from the helper-images repo -# are available on Docker Hub. When everything falls under the "happy case" below this -# can be deleted in a future iteration. This is written in a weird way for portability, -# can't rely on bash 4.0+ to allow case fall-through with ;& - -if cat <<HAPPY_CASE | grep "$DISTRO-$VERSION" - opensuse-15.1 - fedora-29 - debian-9 - debian-8 - fedora-30 - opensuse-15.0 - ubuntu-19.04 - centos-7 - fedora-31 - ubuntu-16.04 - ubuntu-18.04 - ubuntu-19.10 - debian-10 - centos-8 - ubuntu-1804 - ubuntu-1904 - ubuntu-1910 - debian-stretch - debian-jessie - debian-buster -HAPPY_CASE -then - docker build -f "$BuildBase/clean-install.Dockerfile" -t "${DISTRO}_${VERSION}_dev" "$BuildBase/.." \ - --build-arg "DISTRO=$DISTRO" --build-arg "VERSION=$VERSION" \ - --build-arg EXTRA_CFLAGS="-DACLK_SSL_ALLOW_SELF_SIGNED" -else - case "$DISTRO-$VERSION" in - arch-current) - docker build -f "$BuildBase/clean-install-arch.Dockerfile" -t "${DISTRO}_${VERSION}_dev" "$BuildBase/.." \ - --build-arg "DISTRO=$DISTRO" --build-arg "VERSION=$VERSION" \ - --build-arg EXTRA_CFLAGS="-DACLK_SSL_ALLOW_SELF_SIGNED" # --no-cache - ;; - arch-extras) # Add valgrind to the container - docker build -f "$BuildBase/clean-install-arch-extras.Dockerfile" -t "${DISTRO}_${VERSION}_dev" "$BuildBase/.." \ - --build-arg "DISTRO=$DISTRO" --build-arg "VERSION=$VERSION" \ - --build-arg EXTRA_CFLAGS="-DACLK_SSL_ALLOW_SELF_SIGNED" # --no-cache - ;; - *) - echo "Unknown $DISTRO-$VERSION" - ;; - esac -fi diff --git a/build_external/bin/make-install.sh b/build_external/bin/make-install.sh deleted file mode 100755 index fe4f7c9e83..0000000000 --- a/build_external/bin/make-install.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env bash - -DISTRO="$1" -VERSION="$2" -BuildBase="$(cd "$(dirname "$0")" && cd .. && pwd)" - -docker build -f "$BuildBase/make-install.Dockerfile" -t "${DISTRO}_${VERSION}_dev:latest" "$BuildBase/.." \ - --build-arg "DISTRO=${DISTRO}" --build-arg "VERSION=${VERSION}" diff --git a/build_external/clean-install-arch-debug.Dockerfile b/build_external/clean-install-arch-debug.Dockerfile deleted file mode 100644 index a3080ea693..0000000000 --- a/build_external/clean-install-arch-debug.Dockerfile +++ /dev/null @@ -1,63 +0,0 @@ -FROM archlinux/base:latest - -# There is some redundancy between this file and the archlinux Dockerfile in the helper images -# repo and also with the clean-install.Dockerfile. Once the help image is available on Docker -# Hub this file can be deleted. -RUN echo sdlsjdkls -RUN pacman -Syyu --noconfirm -RUN pacman --noconfirm --needed -S autoconf \ - autoconf-archive \ - autogen \ - automake \ - gcc \ - make \ - git \ - libuv \ - lz4 \ - netcat \ - openssl \ - pkgconfig \ - python \ - libvirt \ - cmake \ - valgrind \ - gdb - -ARG EXTRA_CFLAGS -COPY . /opt/netdata/source -WORKDIR /opt/netdata/source - -RUN git config --global user.email "root@container" -RUN git config --global user.name "Fake root" - |