diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 6a19f81815af..f51f79d6cb81 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -528,57 +528,9 @@ jobs: name: collector-binaries-${{ matrix.os }}-${{ matrix.arch }} path: ./bin/* - build-package: - runs-on: ubuntu-latest - needs: [cross-compile] - strategy: - fail-fast: false - matrix: - package_type: ["deb", "rpm"] - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - name: Install Ruby - uses: ruby/setup-ruby@v1 - with: - ruby-version: "3.3" - - name: Install fpm - run: gem install --no-document fpm -v 1.15.1 - - name: Download Collector Binaries - uses: actions/download-artifact@v4 - with: - merge-multiple: true - path: bin/ - pattern: collector-binaries-* - - run: chmod +x bin/* - - name: Set Release Tag - id: github_tag - run: ./.github/workflows/scripts/set_release_tag.sh - - name: Build ${{ matrix.package_type }} amd64 package - run: ./internal/buildscripts/packaging/fpm/${{ matrix.package_type }}/build.sh "${{ steps.github_tag.outputs.tag }}" "amd64" "./dist/" - - name: Build ${{ matrix.package_type }} arm64 package - run: ./internal/buildscripts/packaging/fpm/${{ matrix.package_type }}/build.sh "${{ steps.github_tag.outputs.tag }}" "arm64" "./dist/" - - name: Build ${{ matrix.package_type }} ppc64le package - run: ./internal/buildscripts/packaging/fpm/${{ matrix.package_type }}/build.sh "${{ steps.github_tag.outputs.tag }}" "ppc64le" "./dist/" - - name: Build ${{ matrix.package_type }} s390x package - run: ./internal/buildscripts/packaging/fpm/${{ matrix.package_type }}/build.sh "${{ steps.github_tag.outputs.tag }}" "s390x" "./dist/" - - name: Test ${{ matrix.package_type }} package - run: | - if [[ "${{ matrix.package_type }}" = "deb" ]]; then - ./internal/buildscripts/packaging/fpm/test.sh dist/otel-contrib-collector*amd64.deb examples/demo/otel-collector-config.yaml - else - ./internal/buildscripts/packaging/fpm/test.sh dist/otel-contrib-collector*x86_64.rpm examples/demo/otel-collector-config.yaml - fi - - name: Upload Packages - uses: actions/upload-artifact@v4 - with: - name: collector-packages-${{ matrix.package_type }} - path: ./dist/* - publish-check: runs-on: ubuntu-latest - needs: [lint, unittest, integration-tests, build-package] + needs: [lint, unittest, integration-tests] steps: - uses: actions/checkout@v4 - name: Download Binaries @@ -587,18 +539,12 @@ jobs: merge-multiple: true path: ./bin/ pattern: collector-binaries-* - - name: Download Packages - uses: actions/download-artifact@v4 - with: - merge-multiple: true - path: ./dist/ - pattern: collector-packages-* - name: Verify Distribution Files Exist id: check run: ./.github/workflows/scripts/verify-dist-files-exist.sh publish-dev: runs-on: ubuntu-latest - needs: [lint, unittest, integration-tests, build-package] + needs: [lint, unittest, integration-tests] if: (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')) && github.repository == 'open-telemetry/opentelemetry-collector-contrib' steps: - uses: actions/checkout@v4 @@ -631,12 +577,6 @@ jobs: path: ./bin/ pattern: collector-binaries-* - run: chmod +x bin/* - - name: Download Packages - uses: actions/download-artifact@v4 - with: - merge-multiple: true - path: ./dist/ - pattern: collector-packages-* - name: Add Permissions to Tool Binaries run: chmod -R +x ./dist - name: Verify Distribution Files Exist @@ -665,7 +605,7 @@ jobs: docker push otel/opentelemetry-collector-contrib-dev:latest publish-stable: runs-on: ubuntu-latest - needs: [lint, unittest, integration-tests, build-package] + needs: [lint, unittest, integration-tests] if: startsWith(github.ref, 'refs/tags/v') && github.repository == 'open-telemetry/opentelemetry-collector-contrib' steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/scripts/verify-dist-files-exist.sh b/.github/workflows/scripts/verify-dist-files-exist.sh index 4db111a94c7a..06b07e8e4bca 100755 --- a/.github/workflows/scripts/verify-dist-files-exist.sh +++ b/.github/workflows/scripts/verify-dist-files-exist.sh @@ -11,14 +11,6 @@ files=( bin/otelcontribcol_linux_amd64 bin/otelcontribcol_linux_s390x bin/otelcontribcol_windows_amd64.exe - dist/otel-contrib-collector-*.aarch64.rpm - dist/otel-contrib-collector_*_amd64.deb - dist/otel-contrib-collector-*.x86_64.rpm - dist/otel-contrib-collector_*_arm64.deb - dist/otel-contrib-collector-*.ppc64le.rpm - dist/otel-contrib-collector_*_ppc64le.deb - dist/otel-contrib-collector_*_s390x.deb - dist/otel-contrib-collector-*.s390x.rpm # skip. See https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/10113 # dist/otel-contrib-collector-*amd64.msi diff --git a/internal/buildscripts/packaging/fpm/Dockerfile b/internal/buildscripts/packaging/fpm/Dockerfile deleted file mode 100644 index 000a4d3e9879..000000000000 --- a/internal/buildscripts/packaging/fpm/Dockerfile +++ /dev/null @@ -1,16 +0,0 @@ -FROM debian:12 - -RUN apt-get update && \ - apt-get install -y ruby ruby-dev rubygems build-essential git rpm - -RUN gem install --no-document fpm -v 1.11.0 - -VOLUME /repo -WORKDIR /repo - -ENV PACKAGE="deb" -ENV VERSION="" -ENV ARCH="amd64" -ENV OUTPUT_DIR="/repo/dist/" - -CMD ./internal/buildscripts/packaging/fpm/$PACKAGE/build.sh "$VERSION" "$ARCH" "$OUTPUT_DIR" \ No newline at end of file diff --git a/internal/buildscripts/packaging/fpm/common.sh b/internal/buildscripts/packaging/fpm/common.sh deleted file mode 100644 index 40d90e362f6b..000000000000 --- a/internal/buildscripts/packaging/fpm/common.sh +++ /dev/null @@ -1,66 +0,0 @@ -#!/bin/bash - -# Copyright The OpenTelemetry Authors -# SPDX-License-Identifier: Apache-2.0 - -FPM_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -export FPM_DIR - -export PKG_NAME="otel-contrib-collector" -export PKG_VENDOR="OpenTelemetry Community" -export PKG_MAINTAINER="OpenTelemetry Community " -export PKG_DESCRIPTION="OpenTelemetry Contrib Collector" -export PKG_LICENSE="Apache 2.0" -export PKG_URL="https://github.com/open-telemetry/opentelemetry-collector-contrib" -export PKG_USER="otel" -export PKG_GROUP="otel" - -export SERVICE_NAME="otel-contrib-collector" -export PROCESS_NAME="otelcontribcol" - -export CONFIG_PATH="$REPO_DIR/examples/demo/otel-collector-config.yaml" -export SERVICE_PATH="$FPM_DIR/$SERVICE_NAME.service" -export ENVFILE_PATH="$FPM_DIR/$SERVICE_NAME.conf" -export PREINSTALL_PATH="$FPM_DIR/preinstall.sh" -export POSTINSTALL_PATH="$FPM_DIR/postinstall.sh" -export PREUNINSTALL_PATH="$FPM_DIR/preuninstall.sh" - -docker_cp() { - local container="$1" - local src="$2" - local dest="$3" - local dest_dir - dest_dir="$( dirname "$dest" )" - - echo "Copying $src to $container:$dest ..." - podman exec "$container" mkdir -p "$dest_dir" - podman cp "$src" "$container":"$dest" -} - -install_pkg() { - local container="$1" - local pkg_path="$2" - local pkg_base - pkg_base=$( basename "$pkg_path" ) - - echo "Installing $pkg_base ..." - docker_cp "$container" "$pkg_path" /tmp/"$pkg_base" - if [[ "${pkg_base##*.}" = "deb" ]]; then - podman exec "$container" dpkg -i /tmp/"$pkg_base" - else - podman exec "$container" rpm -ivh /tmp/"$pkg_base" - fi -} - -uninstall_pkg() { - local container="$1" - local pkg_type="$2" - local pkg_name="${3:-"$PKG_NAME"}" - - echo "Uninstalling $pkg_name ..." - if [[ "$pkg_type" = "deb" ]]; then - podman exec "$container" dpkg -r "$pkg_name" - else - podman exec "$container" rpm -e "$pkg_name" - fi -} diff --git a/internal/buildscripts/packaging/fpm/deb/Dockerfile.test b/internal/buildscripts/packaging/fpm/deb/Dockerfile.test deleted file mode 100644 index 56d482f9d5c0..000000000000 --- a/internal/buildscripts/packaging/fpm/deb/Dockerfile.test +++ /dev/null @@ -1,14 +0,0 @@ -# A debian11 image with systemd enabled. Must be run with: -# `-d --privileged -v /sys/fs/cgroup:/sys/fs/cgroup:ro` flags -FROM debian:12 - -ENV container docker -ENV DEBIAN_FRONTEND noninteractive - -# Enable systemd. -RUN apt-get update ; \ - apt-get install -y systemd systemd-sysv procps; \ - apt-get clean ; \ - rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* - -CMD ["/lib/systemd/systemd"] diff --git a/internal/buildscripts/packaging/fpm/deb/README.md b/internal/buildscripts/packaging/fpm/deb/README.md deleted file mode 100644 index 7620be58c3a6..000000000000 --- a/internal/buildscripts/packaging/fpm/deb/README.md +++ /dev/null @@ -1,14 +0,0 @@ -# Build otel-contrib-collector deb package - -Build the otel-contrib-collector deb package with [fpm](https://github.com/jordansissel/fpm). - -To build the deb package, run `make deb-package` from the repo root directory. The deb package will be written to -`dist/otel-contrib-collector__.deb`. - -By default, `` is `amd64` and `` is the latest git tag with `-post` appended, e.g. `1.2.3-post`. -To override these defaults, set the `ARCH` and `VERSION` environment variables, e.g. -`ARCH=arm64 VERSION=4.5.6 make deb-package`. - -Run `./internal/buildscripts/packaging/fpm/test.sh PATH_TO_DEB_FILE [PATH_TO_CONFIG_FILE]` to run a basic installation -test with the built package. `PATH_TO_CONFIG_FILE` defaults to `examples/demo/otel-collector-config.yaml` if one is -not specified. \ No newline at end of file diff --git a/internal/buildscripts/packaging/fpm/deb/build.sh b/internal/buildscripts/packaging/fpm/deb/build.sh deleted file mode 100755 index b07fff55ea2e..000000000000 --- a/internal/buildscripts/packaging/fpm/deb/build.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/bash - -# Copyright The OpenTelemetry Authors -# SPDX-License-Identifier: Apache-2.0 - -set -euxo pipefail - -SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -REPO_DIR="$( cd "$SCRIPT_DIR/../../../../../" && pwd )" -VERSION="${1:-}" -ARCH="${2:-"amd64"}" -OUTPUT_DIR="${3:-"$REPO_DIR/dist/"}" -OTELCONTRIBCOL_PATH="$REPO_DIR/bin/otelcontribcol_linux_$ARCH" - -. "$SCRIPT_DIR"/../common.sh - -if [[ -z "$VERSION" ]]; then - latest_tag="$( git describe --abbrev=0 --match v[0-9]* )" - VERSION="${latest_tag}-post" -fi - -mkdir -p "$OUTPUT_DIR" - -fpm -s dir -t deb -n "$PKG_NAME" -v "${VERSION#v}" -f -p "$OUTPUT_DIR" \ - --vendor "$PKG_VENDOR" \ - --maintainer "$PKG_MAINTAINER" \ - --description "$PKG_DESCRIPTION" \ - --license "$PKG_LICENSE" \ - --url "$PKG_URL" \ - --architecture "$ARCH" \ - --deb-dist "stable" \ - --deb-user "$PKG_USER" \ - --deb-group "$PKG_GROUP" \ - --before-install "$PREINSTALL_PATH" \ - --after-install "$POSTINSTALL_PATH" \ - --pre-uninstall "$PREUNINSTALL_PATH" \ - "$SERVICE_PATH"=/lib/systemd/system/"$SERVICE_NAME".service \ - "$OTELCONTRIBCOL_PATH"=/usr/bin/otelcontribcol \ - "$CONFIG_PATH"=/etc/otel-contrib-collector/config.yaml \ - "$ENVFILE_PATH"=/etc/otel-contrib-collector/otel-contrib-collector.conf diff --git a/internal/buildscripts/packaging/fpm/otel-contrib-collector.conf b/internal/buildscripts/packaging/fpm/otel-contrib-collector.conf deleted file mode 100644 index b61dd4e0f1cd..000000000000 --- a/internal/buildscripts/packaging/fpm/otel-contrib-collector.conf +++ /dev/null @@ -1,5 +0,0 @@ -# Systemd environment file for the otel-contrib-collector service - -# Command-line options for the otel-contrib-collector service. -# Run `/usr/bin/otelcontribcol --help` to see all available options. -OTELCOL_OPTIONS="--config=/etc/otel-contrib-collector/config.yaml" \ No newline at end of file diff --git a/internal/buildscripts/packaging/fpm/otel-contrib-collector.service b/internal/buildscripts/packaging/fpm/otel-contrib-collector.service deleted file mode 100644 index 7f1a4c4017b2..000000000000 --- a/internal/buildscripts/packaging/fpm/otel-contrib-collector.service +++ /dev/null @@ -1,15 +0,0 @@ -[Unit] -Description=OpenTelemetry Contrib Collector -After=network.target - -[Service] -ExecStart=/usr/bin/otelcontribcol $OTELCOL_OPTIONS -EnvironmentFile=/etc/otel-contrib-collector/otel-contrib-collector.conf -KillMode=mixed -Restart=on-failure -Type=simple -User=otel -Group=otel - -[Install] -WantedBy=multi-user.target \ No newline at end of file diff --git a/internal/buildscripts/packaging/fpm/postinstall.sh b/internal/buildscripts/packaging/fpm/postinstall.sh deleted file mode 100644 index b60b00295adf..000000000000 --- a/internal/buildscripts/packaging/fpm/postinstall.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh - -# Copyright The OpenTelemetry Authors -# SPDX-License-Identifier: Apache-2.0 - -if command -v systemctl >/dev/null 2>&1; then - systemctl enable otel-contrib-collector.service - if [ -f /etc/otel-contrib-collector/config.yaml ]; then - systemctl start otel-contrib-collector.service - fi -fi \ No newline at end of file diff --git a/internal/buildscripts/packaging/fpm/preinstall.sh b/internal/buildscripts/packaging/fpm/preinstall.sh deleted file mode 100644 index 99320ee3b335..000000000000 --- a/internal/buildscripts/packaging/fpm/preinstall.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh - -# Copyright The OpenTelemetry Authors -# SPDX-License-Identifier: Apache-2.0 - -getent passwd otel >/dev/null || useradd --system --user-group --no-create-home --shell /sbin/nologin otel \ No newline at end of file diff --git a/internal/buildscripts/packaging/fpm/preuninstall.sh b/internal/buildscripts/packaging/fpm/preuninstall.sh deleted file mode 100644 index 4faffaac44fc..000000000000 --- a/internal/buildscripts/packaging/fpm/preuninstall.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh - -# Copyright The OpenTelemetry Authors -# SPDX-License-Identifier: Apache-2.0 - -if command -v systemctl >/dev/null 2>&1; then - systemctl stop otel-contrib-collector.service - systemctl disable otel-contrib-collector.service -fi \ No newline at end of file diff --git a/internal/buildscripts/packaging/fpm/rpm/Dockerfile.test b/internal/buildscripts/packaging/fpm/rpm/Dockerfile.test deleted file mode 100644 index 8429e850d73b..000000000000 --- a/internal/buildscripts/packaging/fpm/rpm/Dockerfile.test +++ /dev/null @@ -1,9 +0,0 @@ -# A rockylinux8.5 image with systemd enabled. Must be run with: -# `-d --privileged -v /sys/fs/cgroup:/sys/fs/cgroup:ro` flags -FROM rockylinux:9.3 - -ENV container docker - -RUN dnf install -y initscripts - -CMD ["/usr/sbin/init"] diff --git a/internal/buildscripts/packaging/fpm/rpm/README.md b/internal/buildscripts/packaging/fpm/rpm/README.md deleted file mode 100644 index 8f64d6f70d51..000000000000 --- a/internal/buildscripts/packaging/fpm/rpm/README.md +++ /dev/null @@ -1,14 +0,0 @@ -# Build otel-contrib-collector rpm package - -Build the otel-contrib-collector rpm package with [fpm](https://github.com/jordansissel/fpm). - -To build the rpm package, run `make rpm-package` from the repo root directory. The rpm package will be written to -`dist/otel-contrib-collector-.>.rpm`. - -By default, `` is `amd64` and `` is the latest git tag with `~post` appended, e.g. `1.2.3~post`. -To override these defaults, set the `ARCH` and `VERSION` environment variables, e.g. -`ARCH=arm64 VERSION=4.5.6 make rpm-package`. - -Run `./internal/buildscripts/packaging/fpm/test.sh PATH_TO_RPM_FILE [PATH_TO_CONFIG_FILE]` to run a basic installation -test with the built package. `PATH_TO_CONFIG_FILE` defaults to `examples/demo/otel-collector-config.yaml` if one is -not specified. \ No newline at end of file diff --git a/internal/buildscripts/packaging/fpm/rpm/build.sh b/internal/buildscripts/packaging/fpm/rpm/build.sh deleted file mode 100755 index 4b2d072c62cb..000000000000 --- a/internal/buildscripts/packaging/fpm/rpm/build.sh +++ /dev/null @@ -1,46 +0,0 @@ -#!/bin/bash - -# Copyright The OpenTelemetry Authors -# SPDX-License-Identifier: Apache-2.0 - -set -euxo pipefail - -SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -REPO_DIR="$( cd "$SCRIPT_DIR/../../../../../" && pwd )" -VERSION="${1:-}" -ARCH="${2:-"amd64"}" -OUTPUT_DIR="${3:-"$REPO_DIR/dist/"}" -OTELCONTRIBCOL_PATH="$REPO_DIR/bin/otelcontribcol_linux_$ARCH" - -. "$SCRIPT_DIR"/../common.sh - -if [[ -z "$VERSION" ]]; then - latest_tag="$( git describe --abbrev=0 --match v[0-9]* )" - VERSION="${latest_tag}~post" -fi - -# remap arm64 to aarch64, which is the arch used by Linux distributions -# see https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/6508 -if [[ "$ARCH" == "arm64" ]]; then - ARCH="aarch64" -fi - -mkdir -p "$OUTPUT_DIR" - -fpm -s dir -t rpm -n "$PKG_NAME" -v "${VERSION#v}" -f -p "$OUTPUT_DIR" \ - --vendor "$PKG_VENDOR" \ - --maintainer "$PKG_MAINTAINER" \ - --description "$PKG_DESCRIPTION" \ - --license "$PKG_LICENSE" \ - --url "$PKG_URL" \ - --architecture "$ARCH" \ - --rpm-summary "$PKG_DESCRIPTION" \ - --rpm-user "$PKG_USER" \ - --rpm-group "$PKG_GROUP" \ - --before-install "$PREINSTALL_PATH" \ - --after-install "$POSTINSTALL_PATH" \ - --pre-uninstall "$PREUNINSTALL_PATH" \ - "$SERVICE_PATH"=/lib/systemd/system/"$SERVICE_NAME".service \ - "$OTELCONTRIBCOL_PATH"=/usr/bin/otelcontribcol \ - "$CONFIG_PATH"=/etc/otel-contrib-collector/config.yaml \ - "$ENVFILE_PATH"=/etc/otel-contrib-collector/otel-contrib-collector.conf diff --git a/internal/buildscripts/packaging/fpm/test.sh b/internal/buildscripts/packaging/fpm/test.sh deleted file mode 100755 index e52b3407a4c2..000000000000 --- a/internal/buildscripts/packaging/fpm/test.sh +++ /dev/null @@ -1,90 +0,0 @@ -#!/bin/bash - -# Copyright The OpenTelemetry Authors -# SPDX-License-Identifier: Apache-2.0 - -set -euov pipefail - -SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -REPO_DIR="$( cd "$SCRIPT_DIR/../../../../" && pwd )" -export REPO_DIR -PKG_PATH="${1:-}" - -. "$SCRIPT_DIR"/common.sh - -if [[ -z "$PKG_PATH" ]]; then - echo "usage: ${BASH_SOURCE[0]} DEB_OR_RPM_PATH" >&2 - exit 1 -fi - -if [[ ! -f "$PKG_PATH" ]]; then - echo "$PKG_PATH not found!" >&2 - exit 1 -fi - - -pkg_base="$( basename "$PKG_PATH" )" -pkg_type="${pkg_base##*.}" -if [[ ! "$pkg_type" =~ ^(deb|rpm)$ ]]; then - echo "$PKG_PATH not supported!" >&2 - exit 1 -fi -image_name="otelcontribcol-$pkg_type-test" -container_name="$image_name" -container_exec="podman exec $container_name" - -trap 'podman rm -fv $container_name >/dev/null 2>&1 || true' EXIT - -podman build -t "$image_name" -f "$SCRIPT_DIR/$pkg_type/Dockerfile.test" "$SCRIPT_DIR" -podman rm -fv "$container_name" >/dev/null 2>&1 || true - -# test install -CRUN_VER='1.14.4' -mkdir -p "${HOME}/.local/bin" -curl -L "https://github.com/containers/crun/releases/download/${CRUN_VER}/crun-${CRUN_VER}-linux-amd64" -o "${HOME}/.local/bin/crun" -chmod +x "${HOME}/.local/bin/crun" -mkdir -p "${HOME}/.config/containers" -cat << EOF > "${HOME}/.config/containers/containers.conf" -[engine.runtimes] -crun = [ - "${HOME}/.local/bin/crun", - "/usr/bin/crun" -] -EOF - -echo -podman run --name "$container_name" -d "$image_name" -install_pkg "$container_name" "$PKG_PATH" - -# ensure service has started and still running after 5 seconds -sleep 5 -echo "Checking $SERVICE_NAME service status ..." -$container_exec systemctl --no-pager status $SERVICE_NAME - -echo "Checking $PROCESS_NAME process ..." -$container_exec pgrep -a -u otel $PROCESS_NAME - -# test uninstall -echo -uninstall_pkg "$container_name" "$pkg_type" - -echo "Checking $SERVICE_NAME service status after uninstall ..." -if $container_exec systemctl --no-pager status $SERVICE_NAME; then - echo "$SERVICE_NAME service still running after uninstall" >&2 - exit 1 -fi -echo "$SERVICE_NAME service successfully stopped after uninstall" - -echo "Checking $SERVICE_NAME service existence after uninstall ..." -if $container_exec systemctl list-unit-files --all | grep $SERVICE_NAME; then - echo "$SERVICE_NAME service still exists after uninstall" >&2 - exit 1 -fi -echo "$SERVICE_NAME service successfully removed after uninstall" - -echo "Checking $PROCESS_NAME process after uninstall ..." -if $container_exec pgrep $PROCESS_NAME; then - echo "$PROCESS_NAME process still running after uninstall" - exit 1 -fi -echo "$PROCESS_NAME process successfully killed after uninstall"