-
Notifications
You must be signed in to change notification settings - Fork 166
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
move package tests from contrib repo
Signed-off-by: Moritz Wiesinger <[email protected]> add shellcheck option to follow other files Signed-off-by: Moritz Wiesinger <[email protected]> use shellcheck directive Signed-off-by: Moritz Wiesinger <[email protected]> make shellcheck happy Signed-off-by: Moritz Wiesinger <[email protected]> fix shellcheck things Signed-off-by: Moritz Wiesinger <[email protected]> move dockerfiles, remove unneeded files Signed-off-by: Moritz Wiesinger <[email protected]> also test rpm package Signed-off-by: Moritz Wiesinger <[email protected]> add missing variable Signed-off-by: Moritz Wiesinger <[email protected]> only build linux amd64 for now Signed-off-by: Moritz Wiesinger <[email protected]> only build linux amd64 for now Signed-off-by: Moritz Wiesinger <[email protected]> fix service unit name Signed-off-by: Moritz Wiesinger <[email protected]> add missing files Signed-off-by: Moritz Wiesinger <[email protected]> remove unneeded variables and files Signed-off-by: Moritz Wiesinger <[email protected]> add checkout step Signed-off-by: Moritz Wiesinger <[email protected]> fix if conditionals Signed-off-by: Moritz Wiesinger <[email protected]> add demo config, add script run Signed-off-by: Moritz Wiesinger <[email protected]> copy over package test scripts Signed-off-by: Moritz Wiesinger <[email protected]> add job dependency Signed-off-by: Moritz Wiesinger <[email protected]> move package test steps for testing Signed-off-by: Moritz Wiesinger <[email protected]> revert goreleaser change Signed-off-by: Moritz Wiesinger <[email protected]> fix if statement Signed-off-by: Moritz Wiesinger <[email protected]> test commit Signed-off-by: Moritz Wiesinger <[email protected]> run package tests as part of core ci workflow Signed-off-by: Moritz Wiesinger <[email protected]> download artifacts in new workflow Signed-off-by: Moritz Wiesinger <[email protected]> defuse package tests for now Signed-off-by: Moritz Wiesinger <[email protected]> upload linux/amd64 service packages after building a snapshot Signed-off-by: Moritz Wiesinger <[email protected]> update goreleaser-pro to latest version, add version field to config files to remove warning Signed-off-by: Moritz Wiesinger <[email protected]> add package test workflow Signed-off-by: Moritz Wiesinger <[email protected]>
- Loading branch information
Showing
18 changed files
with
300 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
name: Package Tests | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
type: | ||
required: true | ||
type: string | ||
distribution: | ||
required: true | ||
type: string | ||
|
||
jobs: | ||
package-tests: | ||
name: Package Tests | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
type: ${{ fromJSON(inputs.type) }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | ||
|
||
- name: Download built artifacts | ||
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 | ||
with: | ||
name: linux-packages | ||
|
||
- name: Test ${{ matrix.type }} package | ||
run: ./scripts/package-tests/package-tests.sh ./otelcol*-SNAPSHOT-*_linux_amd64.${{ matrix.type }} ${{ inputs.distribution }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
version: 2 | ||
release: | ||
header: | | ||
Check the [v{{.Version}} contrib changelog](https://github.com/open-telemetry/opentelemetry-collector-contrib/releases/tags/v{{.Version}}) and the [v{{.Version}} core changelog](https://github.com/open-telemetry/opentelemetry-collector/releases/tags/v{{.Version}}) for changelogs on specific components. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
partial: | ||
by: target | ||
version: 2 | ||
project_name: opentelemetry-collector-releases | ||
env: | ||
- COSIGN_YES=true | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
partial: | ||
by: target | ||
version: 2 | ||
project_name: opentelemetry-collector-releases | ||
env: | ||
- COSIGN_YES=true | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
partial: | ||
by: target | ||
version: 2 | ||
project_name: opentelemetry-collector-releases | ||
env: | ||
- COSIGN_YES=true | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# 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"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# 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"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Build and test deb/rpm/apk packages | ||
|
||
## Prerequisites | ||
|
||
Tools: | ||
|
||
- [Go](https://go.dev/) | ||
- [GoReleaser](https://goreleaser.com/) | ||
- [Podman](https://podman.io/) | ||
- make | ||
|
||
## How to build and test | ||
|
||
To build the collector linux packages, a few steps are required: | ||
|
||
- Run `make generate` to (re-)generate sources and goreleaser files | ||
- Go to the distribution folder that you want to build (under the `distributions` folder) | ||
- Run `goreleaser release --snapshot --clean --skip sbom,sign,archive,docker` | ||
- This will build a full release with all architectures and packaging types into the `dist` folder inside your | ||
current folder. (We can skip many parts of the release build that we don't need) | ||
- If you run into `unmarshal` errors, start to remove the parts that goreleaser complains about. This likely happens | ||
due to a missing goreleaser pro license and therefore feature that you can't use. | ||
- Go back to the root of the repo | ||
- To start the package tests, | ||
run: `./scripts/package-tests/package-tests.sh ./distributions/<otelcol|otelcol-contrib>/dist/<otelcol|otelcol-contrib>_*-SNAPSHOT-*_linux_amd64.<deb|rpm> <otelcol|otelcol-contrib>` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#!/bin/bash | ||
|
||
# Copyright The OpenTelemetry Authors | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
podman_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 ..." | ||
podman_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" | ||
|
||
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 | ||
} |
Oops, something went wrong.