forked from open-telemetry/opentelemetry-collector-contrib
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CI] add shellcheck-workflow (open-telemetry#32052)
**Description:** <Describe what has changed.> <!--Ex. Fixing a bug - Describe the bug and how this fixes the issue. Ex. Adding a feature - Explain what this achieves.--> So i fixed the issues which shellcheck displayed, which were only 3 double quote issues and the `read -r` issue. After looking into the closed PR i also replaced `printf`-statements with `echo`. For the shellcheck-worfklow I used [https://github.com/ludeeus/action-shellcheck](url) I didn't find a way to check multiple directories at once, so we just use 2 steps here. I added the disabled checks provided by the intentional issue, but i'm not quite sure if we need to add `-x` here. Couldn't find anything in the documentation so far. On top of that i'm not quite sure if we should run the shellcheck in dependency of any other workflows or just on its own. Edit: I added the option `ignore_paths` so that shellcheck-action is only run in specified paths and ignores subpaths of this directory. **Link to tracking Issue:** <Issue number if applicable> - open-telemetry#17279 **Testing:** <Describe what testing was performed and which tests were added.> **Documentation:** <Describe the documentation added.> --------- Co-authored-by: Evan Bradley <[email protected]>
- Loading branch information
1 parent
6107b19
commit 520cade
Showing
11 changed files
with
107 additions
and
71 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
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,32 @@ | ||
name: shellcheck | ||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
permissions: {} | ||
|
||
jobs: | ||
shellcheck: | ||
name: shellcheck | ||
runs-on: ubuntu-latest | ||
env: | ||
VERSION: v0.10.0 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: shellcheck workflow-scripts | ||
uses: ludeeus/[email protected] | ||
env: | ||
SHELLCHECK_OPTS: -x -e SC2059 -e SC2086 | ||
with: | ||
scandir: ".github/workflows/scripts" | ||
severity: warning | ||
version: ${{ env.VERSION }} | ||
- name: shellcheck buildscripts | ||
uses: ludeeus/[email protected] | ||
env: | ||
SHELLCHECK_OPTS: -x -e SC2059 -e SC2086 | ||
with: | ||
scandir: "internal/buildscripts" | ||
severity: warning | ||
version: ${{ env.VERSION }} |
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 |
---|---|---|
|
@@ -3,49 +3,52 @@ | |
# Copyright The OpenTelemetry Authors | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
FPM_DIR="$( cd "$( dirname ${BASH_SOURCE[0]} )" && pwd )" | ||
|
||
PKG_NAME="otel-contrib-collector" | ||
PKG_VENDOR="OpenTelemetry Community" | ||
PKG_MAINTAINER="OpenTelemetry Community <[email protected]>" | ||
PKG_DESCRIPTION="OpenTelemetry Contrib Collector" | ||
PKG_LICENSE="Apache 2.0" | ||
PKG_URL="https://github.com/open-telemetry/opentelemetry-collector-contrib" | ||
PKG_USER="otel" | ||
PKG_GROUP="otel" | ||
|
||
SERVICE_NAME="otel-contrib-collector" | ||
PROCESS_NAME="otelcontribcol" | ||
|
||
CONFIG_PATH="$REPO_DIR/examples/demo/otel-collector-config.yaml" | ||
SERVICE_PATH="$FPM_DIR/$SERVICE_NAME.service" | ||
ENVFILE_PATH="$FPM_DIR/$SERVICE_NAME.conf" | ||
PREINSTALL_PATH="$FPM_DIR/preinstall.sh" | ||
POSTINSTALL_PATH="$FPM_DIR/postinstall.sh" | ||
PREUNINSTALL_PATH="$FPM_DIR/preuninstall.sh" | ||
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 <[email protected]>" | ||
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="$( dirname "$dest" )" | ||
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" | ||
podman exec "$container" mkdir -p "$dest_dir" | ||
podman cp "$src" "$container":"$dest" | ||
} | ||
|
||
install_pkg() { | ||
local container="$1" | ||
local pkg_path="$2" | ||
local pkg_base=$( basename "$pkg_path" ) | ||
local pkg_base | ||
pkg_base=$( basename "$pkg_path" ) | ||
|
||
echo "Installing $pkg_base ..." | ||
docker_cp $container "$pkg_path" /tmp/$pkg_base | ||
docker_cp "$container" "$pkg_path" /tmp/"$pkg_base" | ||
if [[ "${pkg_base##*.}" = "deb" ]]; then | ||
podman exec $container dpkg -i /tmp/$pkg_base | ||
podman exec "$container" dpkg -i /tmp/"$pkg_base" | ||
else | ||
podman exec $container rpm -ivh /tmp/$pkg_base | ||
podman exec "$container" rpm -ivh /tmp/"$pkg_base" | ||
fi | ||
} | ||
|
||
|
@@ -56,8 +59,8 @@ uninstall_pkg() { | |
|
||
echo "Uninstalling $pkg_name ..." | ||
if [[ "$pkg_type" = "deb" ]]; then | ||
podman exec $container dpkg -r $pkg_name | ||
podman exec "$container" dpkg -r "$pkg_name" | ||
else | ||
podman exec $container rpm -e $pkg_name | ||
podman exec "$container" rpm -e "$pkg_name" | ||
fi | ||
} |
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