From 6a02d8bdc24c8dd56a78c455c570cd4bc1181529 Mon Sep 17 00:00:00 2001 From: Nicolas Chaulet Date: Thu, 6 Jun 2024 13:39:50 -0400 Subject: [PATCH] Add otelcol shortcut to `elastic-agent otel` (#4816) --- .../1717077736-otelcol-shortcut.yaml | 31 +++++++++++++++++++ dev-tools/packaging/files/darwin/otelcol.sh | 5 +++ dev-tools/packaging/files/linux/otelcol.sh | 5 +++ dev-tools/packaging/files/windows/otelcol.ps1 | 2 ++ dev-tools/packaging/packages.yml | 21 +++++++++++++ 5 files changed, 64 insertions(+) create mode 100644 changelog/fragments/1717077736-otelcol-shortcut.yaml create mode 100755 dev-tools/packaging/files/darwin/otelcol.sh create mode 100644 dev-tools/packaging/files/linux/otelcol.sh create mode 100644 dev-tools/packaging/files/windows/otelcol.ps1 diff --git a/changelog/fragments/1717077736-otelcol-shortcut.yaml b/changelog/fragments/1717077736-otelcol-shortcut.yaml new file mode 100644 index 00000000000..67d623679b2 --- /dev/null +++ b/changelog/fragments/1717077736-otelcol-shortcut.yaml @@ -0,0 +1,31 @@ +# Kind can be one of: +# - breaking-change: a change to previously-documented behavior +# - deprecation: functionality that is being removed in a later release +# - bug-fix: fixes a problem in a previous version +# - enhancement: extends functionality but does not break or fix existing behavior +# - feature: new functionality +# - known-issue: problems that we are aware of in a given version +# - security: impacts on the security of a product or a user’s deployment. +# - upgrade: important information for someone upgrading from a prior version +# - other: does not fit into any of the other categories +kind: feature + +# Change summary; a 80ish characters long description of the change. +summary: Add otelcol shortuct to elastic-agent otel + +# Long description; in case the summary is not enough to describe the change +# this field accommodate a description without length limits. +# NOTE: This field will be rendered only for breaking-change and known-issue kinds at the moment. +#description: + +# Affected component; usually one of "elastic-agent", "fleet-server", "filebeat", "metricbeat", "auditbeat", "all", etc. +component: elastic-agent + +# PR URL; optional; the PR number that added the changeset. +# If not present is automatically filled by the tooling finding the PR where this changelog fragment has been added. +# NOTE: the tooling supports backports, so it's able to fill the original PR number instead of the backport PR number. +# Please provide it if you are adding a fragment for a different PR. +pr: https://github.com/elastic/elastic-agent/pull/4816 +# Issue URL; optional; the GitHub issue related to this changeset (either closes or is part of). +# If not present is automatically filled by the tooling with the issue linked to the PR number. +#issue: https://github.com/owner/repo/1234 diff --git a/dev-tools/packaging/files/darwin/otelcol.sh b/dev-tools/packaging/files/darwin/otelcol.sh new file mode 100755 index 00000000000..e64176e1019 --- /dev/null +++ b/dev-tools/packaging/files/darwin/otelcol.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +BASEDIR=$(dirname "$0") + +exec "$BASEDIR/elastic-agent" otel "$@" \ No newline at end of file diff --git a/dev-tools/packaging/files/linux/otelcol.sh b/dev-tools/packaging/files/linux/otelcol.sh new file mode 100644 index 00000000000..e64176e1019 --- /dev/null +++ b/dev-tools/packaging/files/linux/otelcol.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +BASEDIR=$(dirname "$0") + +exec "$BASEDIR/elastic-agent" otel "$@" \ No newline at end of file diff --git a/dev-tools/packaging/files/windows/otelcol.ps1 b/dev-tools/packaging/files/windows/otelcol.ps1 new file mode 100644 index 00000000000..39348528b4c --- /dev/null +++ b/dev-tools/packaging/files/windows/otelcol.ps1 @@ -0,0 +1,2 @@ +$workdir = Split-Path $MyInvocation.MyCommand.Path +& "$workdir\elastic-agent" otel $args \ No newline at end of file diff --git a/dev-tools/packaging/packages.yml b/dev-tools/packaging/packages.yml index 45fea66cc08..55d0e537d9d 100644 --- a/dev-tools/packaging/packages.yml +++ b/dev-tools/packaging/packages.yml @@ -134,6 +134,14 @@ shared: mode: 0755 config_mode: 0644 skip_on_missing: true + + - &linux_otel_files + 'otelcol': + source: '{{ repo.RootDir }}/dev-tools/packaging/files/linux/otelcol.sh' + mode: 0755 + 'data/{{.BeatName}}-{{ commit_short }}/otelcol': + source: '{{ repo.RootDir }}/dev-tools/packaging/files/linux/otelcol.sh' + mode: 0755 - &agent_binary_common_files LICENSE.txt: @@ -201,6 +209,12 @@ shared: content: > {{ agent_package_version }} mode: 0644 + 'otelcol': + source: '{{ repo.RootDir }}/dev-tools/packaging/files/darwin/otelcol.sh' + mode: 0755 + 'data/{{.BeatName}}-{{ commit_short }}/otelcol': + source: '{{ repo.RootDir }}/dev-tools/packaging/files/darwin/otelcol.sh' + mode: 0755 <<: *agent_darwin_app_bundle_files <<: *agent_binary_common_files @@ -217,6 +231,7 @@ shared: files: <<: *agent_binary_files <<: *agent_components + <<: *linux_otel_files - &agent_darwin_binary_spec @@ -235,6 +250,12 @@ shared: mode: 0755 config_mode: 0644 skip_on_missing: true + 'otelcol.ps1': + source: '{{ repo.RootDir }}/dev-tools/packaging/files/windows/otelcol.ps1' + mode: 0755 + 'data/{{.BeatName}}-{{ commit_short }}/otelcol.ps1': + source: '{{ repo.RootDir }}/dev-tools/packaging/files/windows/otelcol.ps1' + mode: 0755 - &agent_docker_spec <<: *agent_binary_spec