-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Don't duplicate agent builds for OTEL collector #34304
Open
chouquette
wants to merge
15
commits into
main
Choose a base branch
from
chouquette/refactor_otel_builds
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+224
−32
Open
Changes from 14 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
4d2b2ff
[omnibus] Add standalone OTel Agent build
KSerrania 359942a
Add config
KSerrania 683ea13
otel: use a specific name for version manifests
chouquette ea3c2ee
update omnibus-ruby
chouquette b85b0e4
omnibus: package-artifact: support merging multiple version-manifest
chouquette 23fa1ab
add new otel jobs to JOBOWNERS
chouquette 4a66673
container_build: exclude debug symbols
chouquette f02aade
rename otel agent jobs for consistency
chouquette fea8277
otel: cleanup os checks
chouquette d9ea081
fix typo
chouquette 1f76ca0
Update .gitlab/package_build/linux.yml
chouquette 7e1955d
omnibus: cleanup
chouquette ff44688
use FileUtils.rm instead of delete
chouquette 01959c9
name blocks & use shellout! instead of command
chouquette e22cf46
allow usage of the builder DSL
chouquette File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,81 @@ | ||
# Unless explicitly stated otherwise all files in this repository are licensed | ||
# under the Apache License Version 2.0. | ||
# This product includes software developed at Datadog (https:#www.datadoghq.com/). | ||
# Copyright 2016-present Datadog, Inc. | ||
require "./lib/ostools.rb" | ||
require "./lib/project_helpers.rb" | ||
output_config_dir = ENV["OUTPUT_CONFIG_DIR"] | ||
|
||
name 'otel-agent' | ||
package_name 'datadog-otel-agent' | ||
|
||
license "Apache-2.0" | ||
license_file "../LICENSE" | ||
|
||
third_party_licenses "../LICENSE-3rdparty.csv" | ||
|
||
homepage 'http://www.datadoghq.com' | ||
|
||
if ENV.has_key?("OMNIBUS_WORKERS_OVERRIDE") | ||
COMPRESSION_THREADS = ENV["OMNIBUS_WORKERS_OVERRIDE"].to_i | ||
else | ||
COMPRESSION_THREADS = 1 | ||
end | ||
if ENV.has_key?("DEPLOY_AGENT") && ENV["DEPLOY_AGENT"] == "true" | ||
COMPRESSION_LEVEL = 9 | ||
else | ||
COMPRESSION_LEVEL = 5 | ||
end | ||
|
||
if ENV.has_key?("OMNIBUS_GIT_CACHE_DIR") | ||
Omnibus::Config.use_git_caching true | ||
Omnibus::Config.git_cache_dir ENV["OMNIBUS_GIT_CACHE_DIR"] | ||
end | ||
|
||
unless linux_target? | ||
raise UnknownPlatform | ||
end | ||
|
||
INSTALL_DIR = ENV["INSTALL_DIR"] || '/opt/datadog-agent' | ||
|
||
install_dir INSTALL_DIR | ||
|
||
json_manifest_path File.join(install_dir, "version-manifest.otel-agent.json") | ||
text_manifest_path File.join(install_dir, "version-manifest.otel-agent.txt") | ||
|
||
# build_version is computed by an invoke command/function. | ||
# We can't call it directly from there, we pass it through the environment instead. | ||
build_version ENV['PACKAGE_VERSION'] | ||
|
||
build_iteration 1 | ||
|
||
description '' | ||
|
||
# ------------------------------------ | ||
# Generic package information | ||
# ------------------------------------ | ||
|
||
package :deb do | ||
skip_packager true | ||
end | ||
|
||
package :xz do | ||
compression_threads COMPRESSION_THREADS | ||
compression_level COMPRESSION_LEVEL | ||
end | ||
|
||
# ------------------------------------ | ||
# Dependencies | ||
# ------------------------------------ | ||
dependency 'datadog-otel-agent' | ||
|
||
extra_package_file "#{output_config_dir}/etc/datadog-agent/" | ||
|
||
exclude '\.git*' | ||
exclude 'bundler\/git' | ||
|
||
# the stripper will drop the symbols in a `.debug` folder in the installdir | ||
# we want to make sure that directory is not in the main build, while present | ||
# in the debug package. | ||
strip_build true | ||
debug_path ".debug" # the strip symbols will be in here |
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,49 @@ | ||
# Unless explicitly stated otherwise all files in this repository are licensed | ||
# under the Apache License Version 2.0. | ||
# This product includes software developed at Datadog (https:#www.datadoghq.com/). | ||
# Copyright 2016-present Datadog, Inc. | ||
|
||
require './lib/ostools.rb' | ||
require './lib/project_helpers.rb' | ||
require 'pathname' | ||
|
||
name 'datadog-otel-agent' | ||
|
||
source path: '..' | ||
relative_path 'src/github.com/DataDog/datadog-agent' | ||
|
||
always_build true | ||
|
||
build do | ||
license :project_license | ||
|
||
# set GOPATH on the omnibus source dir for this software | ||
gopath = Pathname.new(project_dir) + '../../../..' | ||
|
||
env = { | ||
'GOPATH' => gopath.to_path, | ||
'PATH' => "#{gopath.to_path}/bin:#{ENV['PATH']}", | ||
"LDFLAGS" => "-Wl,-rpath,#{install_dir}/embedded/lib -L#{install_dir}/embedded/lib", | ||
"CGO_CFLAGS" => "-I. -I#{install_dir}/embedded/include", | ||
"CGO_LDFLAGS" => "-Wl,-rpath,#{install_dir}/embedded/lib -L#{install_dir}/embedded/lib" | ||
} | ||
|
||
unless ENV["OMNIBUS_GOMODCACHE"].nil? || ENV["OMNIBUS_GOMODCACHE"].empty? | ||
gomodcache = Pathname.new(ENV["OMNIBUS_GOMODCACHE"]) | ||
env["GOMODCACHE"] = gomodcache.to_path | ||
end | ||
|
||
# include embedded path (mostly for `pkg-config` binary) | ||
env = with_standard_compiler_flags(with_embedded_path(env)) | ||
|
||
conf_dir = "/etc/datadog-agent" | ||
embedded_bin_dir = "#{install_dir}/embedded/bin" | ||
|
||
mkdir conf_dir | ||
mkdir embedded_bin_dir | ||
|
||
command "invoke -e otel-agent.build", :env => env | ||
copy 'bin/otel-agent/otel-agent', embedded_bin_dir | ||
|
||
move 'bin/otel-agent/dist/otel-config.yaml', "#{conf_dir}/otel-config.yaml.example" | ||
end |
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit - we could have a matrix to avoid some cpy/paste
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given that we have 3 values to modify (the image name, the tag, a the compiler prefix) for a 7 lines job, I'm not sure a matrix would improve the readability/maintainability here