From 1bdb52640e3ff88f8831a49a851ab404fd32ff76 Mon Sep 17 00:00:00 2001 From: Bryan Aguilar Date: Mon, 1 May 2023 16:42:21 -0700 Subject: [PATCH 1/6] Add cp-utility --- tools/cp-utility/.cargo/config.toml | 3 + tools/cp-utility/Cargo.lock | 262 ++++++++++++++++++++ tools/cp-utility/Cargo.toml | 22 ++ tools/cp-utility/README.md | 51 ++++ tools/cp-utility/src/main.rs | 354 ++++++++++++++++++++++++++++ 5 files changed, 692 insertions(+) create mode 100644 tools/cp-utility/.cargo/config.toml create mode 100644 tools/cp-utility/Cargo.lock create mode 100644 tools/cp-utility/Cargo.toml create mode 100644 tools/cp-utility/README.md create mode 100644 tools/cp-utility/src/main.rs diff --git a/tools/cp-utility/.cargo/config.toml b/tools/cp-utility/.cargo/config.toml new file mode 100644 index 0000000000..5f92a1de43 --- /dev/null +++ b/tools/cp-utility/.cargo/config.toml @@ -0,0 +1,3 @@ +# Use git CLI to fetch the source code instead of relying on the rust git implementation +[net] +git-fetch-with-cli = true diff --git a/tools/cp-utility/Cargo.lock b/tools/cp-utility/Cargo.lock new file mode 100644 index 0000000000..558f0bfd67 --- /dev/null +++ b/tools/cp-utility/Cargo.lock @@ -0,0 +1,262 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "cc" +version = "1.0.79" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "cp-utility" +version = "0.1.0" +dependencies = [ + "tempfile", + "uuid", +] + +[[package]] +name = "errno" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50d6a0976c999d473fe89ad888d5a284e55366d9dc9038b1ba2aa15128c4afa0" +dependencies = [ + "errno-dragonfly", + "libc", + "windows-sys", +] + +[[package]] +name = "errno-dragonfly" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" +dependencies = [ + "cc", + "libc", +] + +[[package]] +name = "fastrand" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e51093e27b0797c359783294ca4f0a911c270184cb10f85783b118614a1501be" +dependencies = [ + "instant", +] + +[[package]] +name = "getrandom" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31" +dependencies = [ + "cfg-if", + "libc", + "wasi", +] + +[[package]] +name = "hermit-abi" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286" + +[[package]] +name = "instant" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "io-lifetimes" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09270fd4fa1111bc614ed2246c7ef56239a3063d5be0d1ec3b589c505d400aeb" +dependencies = [ + "hermit-abi", + "libc", + "windows-sys", +] + +[[package]] +name = "libc" +version = "0.2.140" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c" + +[[package]] +name = "linux-raw-sys" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d59d8c75012853d2e872fb56bc8a2e53718e2cafe1a4c823143141c6d90c322f" + +[[package]] +name = "ppv-lite86" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" + +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "libc", + "rand_chacha", + "rand_core", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom", +] + +[[package]] +name = "redox_syscall" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" +dependencies = [ + "bitflags", +] + +[[package]] +name = "rustix" +version = "0.37.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d097081ed288dfe45699b72f5b5d648e5f15d64d900c7080273baa20c16a6849" +dependencies = [ + "bitflags", + "errno", + "io-lifetimes", + "libc", + "linux-raw-sys", + "windows-sys", +] + +[[package]] +name = "tempfile" +version = "3.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9fbec84f381d5795b08656e4912bec604d162bff9291d6189a78f4c8ab87998" +dependencies = [ + "cfg-if", + "fastrand", + "redox_syscall", + "rustix", + "windows-sys", +] + +[[package]] +name = "uuid" +version = "1.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b55a3fef2a1e3b3a00ce878640918820d3c51081576ac657d23af9fc7928fdb" +dependencies = [ + "getrandom", + "rand", +] + +[[package]] +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + +[[package]] +name = "windows-sys" +version = "0.45.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-targets" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" + +[[package]] +name = "windows_i686_gnu" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" + +[[package]] +name = "windows_i686_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" diff --git a/tools/cp-utility/Cargo.toml b/tools/cp-utility/Cargo.toml new file mode 100644 index 0000000000..6e5cb81b2e --- /dev/null +++ b/tools/cp-utility/Cargo.toml @@ -0,0 +1,22 @@ +[package] +name = "cp-utility" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +# No dependencies here + +[dev-dependencies] +# dependencies only used during tests +tempfile = "3.5.0" +uuid = { version = "1.3.1", features = ["v4", "fast-rng"] } + +[profile.release] +# Levers to optimize the binary for size +strip = true # Strip symbols +opt-level = "z" # Size optimization +lto = true # linking time optimizations + + diff --git a/tools/cp-utility/README.md b/tools/cp-utility/README.md new file mode 100644 index 0000000000..3b64f9626d --- /dev/null +++ b/tools/cp-utility/README.md @@ -0,0 +1,51 @@ +# Introduction + +This copy utility is intended to be used as a base image for OpenTelemetry Operator +autoinstrumentation images. The copy utility will allow autoinstrumentation packages to be +copied from the init container to the final destination volume. + +## Development + +### Pre-requirements +* Install rust + +``` +curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh +``` + +* Install rustfmt + +``` +rustup component add rustfmt +``` + +### Development + +* Auto formatting the code + +This step is important and it might fail the build if the files are not properly +formatted. + +``` +cargo fmt +``` + +* Testing the code +``` +cargo test +``` + +* Building the code + +``` +cargo build +``` + +NOTE: this will build the code for tests locally. It will not statically link the libc used by it. + + +* Building the code statically linked + +``` +cargo build --target x86_64-unknown-linux-musl +``` diff --git a/tools/cp-utility/src/main.rs b/tools/cp-utility/src/main.rs new file mode 100644 index 0000000000..2aa807cb3b --- /dev/null +++ b/tools/cp-utility/src/main.rs @@ -0,0 +1,354 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +use std::collections::VecDeque; +use std::env; +use std::fs; +use std::io; +use std::os::unix; +use std::path::Path; +use std::path::PathBuf; +use std::process; + +/// A type of copy operation +#[derive(Debug, PartialEq)] +enum CopyType { + /// equivalent to cp + SingleFile, + /// equivalent to cp -a + Archive, +} + +/// Encapsulate a copy operation +struct CopyOperation { + /// The source path + source: PathBuf, + /// The destination path + destination: PathBuf, + /// The type of copy being performed + copy_type: CopyType, +} + +/// Parse command line arguments and transform into `CopyOperation` +fn parse_args(args: Vec<&str>) -> io::Result { + if !(args.len() == 3 || args.len() == 4 && args[1].eq("-a")) { + return Err(io::Error::new( + io::ErrorKind::InvalidInput, + "Invalid parameters. Expected cp [-a] ", + )); + } + + if args.len() == 4 { + return Ok(CopyOperation { + source: PathBuf::from(args[2]), + destination: PathBuf::from(args[3]), + copy_type: CopyType::Archive, + }); + } + + Ok(CopyOperation { + source: PathBuf::from(args[1]), + destination: PathBuf::from(args[2]), + copy_type: CopyType::SingleFile, + }) +} + +/// Execute the copy operation +fn do_copy(operation: CopyOperation) -> io::Result<()> { + match operation.copy_type { + CopyType::Archive => copy_archive(&operation.source, &operation.destination)?, + CopyType::SingleFile => fs::copy(&operation.source, &operation.destination).map(|_| ())?, + }; + Ok(()) +} + +/// Execute the recursive type of copy operation +fn copy_archive(source: &Path, dest: &Path) -> io::Result<()> { + // This will cover the case in which the destination exists + let sanitized_dest: PathBuf = if dest.exists() { + dest.to_path_buf() + .join(source.file_name().ok_or(io::Error::new( + io::ErrorKind::InvalidInput, + "Invalid source file", + ))?) + } else { + dest.to_path_buf() + }; + + let mut stack = VecDeque::new(); + stack.push_back((source.to_path_buf(), sanitized_dest)); + + while let Some((current_source, current_dest)) = stack.pop_back() { + if current_source.is_symlink() { + let target = current_source.read_link()?; + unix::fs::symlink(target, ¤t_dest)?; + } else if current_source.is_dir() { + fs::create_dir(¤t_dest)?; + for entry in fs::read_dir(current_source)? { + let next_source = entry?.path(); + let next_dest = + current_dest + .clone() + .join(next_source.file_name().ok_or(io::Error::new( + io::ErrorKind::InvalidInput, + "Invalid source file", + ))?); + stack.push_back((next_source, next_dest)); + } + } else if current_source.is_file() { + fs::copy(current_source, current_dest)?; + } + } + Ok(()) +} + +fn main() { + let original_args: Vec = env::args().collect(); + let args = original_args.iter().map(|x| x.as_str()).collect(); + + let operation = parse_args(args).unwrap_or_else(|err| { + eprintln!("Error parsing arguments: {err}"); + process::exit(1); + }); + + do_copy(operation).unwrap_or_else(|err| { + eprintln!("Error copying files: {err}"); + process::exit(2); + }); +} + +#[cfg(test)] +mod tests { + use std::{ + fs, + io::Write, + os::unix, + path::{Path, PathBuf}, + }; + + use crate::{do_copy, parse_args, CopyOperation, CopyType}; + use uuid; + + #[test] + fn test_parser_archive() { + // prepare + let input = vec!["cp", "-a", "foo.txt", "dest.txt"]; + + // act + let result = parse_args(input).unwrap(); + + // assert + assert_eq!(result.source, PathBuf::from("foo.txt")); + assert_eq!(result.destination, PathBuf::from("dest.txt")); + assert_eq!(result.copy_type, CopyType::Archive) + } + + #[test] + fn test_parser_single() { + // prepare + let input: Vec<&str> = vec!["cp", "foo.txt", "dest.txt"]; + + // act + let result = parse_args(input).unwrap(); + + // assert + assert_eq!(result.source, PathBuf::from("foo.txt")); + assert_eq!(result.destination, PathBuf::from("dest.txt")); + assert_eq!(result.copy_type, CopyType::SingleFile) + } + + #[test] + fn parser_failure() { + // prepare + let inputs = vec![ + vec!["cp", "-r", "foo.txt", "bar.txt"], + vec!["cp", "-a", "param1", "param2", "param3"], + vec!["cp", "param1", "param2", "param3"], + ]; + + for input in inputs.into_iter() { + // act + let result = parse_args(input.clone()); + + // assert + assert!(result.is_err(), "input should fail {:?}", input); + } + } + + #[test] + fn test_copy_single() { + // prepare + let tempdir = tempfile::tempdir().unwrap(); + let test_base = tempdir.path().to_path_buf(); + + create_file(&test_base, "foo.txt"); + + let source = test_base.join("foo.txt"); + let dest = test_base.join("bar.txt"); + let single_copy = CopyOperation { + copy_type: CopyType::SingleFile, + source: source.clone(), + destination: dest.clone(), + }; + + // act + do_copy(single_copy).unwrap(); + + // assert + assert_same_file(&source, &dest) + } + + #[test] + fn single_cannot_copy_directory() { + // prepare + let tempdir = tempfile::tempdir().unwrap(); + let test_base = tempdir.path().to_path_buf(); + + create_dir(&test_base, "somedir"); + + // act + let single_copy = CopyOperation { + copy_type: CopyType::SingleFile, + source: test_base.join("somedir"), + destination: test_base.join("somewhereelse"), + }; + let result = do_copy(single_copy); + + // assert + assert!(result.is_err()); + } + + #[test] + fn test_copy_archive() { + // prepare + let tempdir = tempfile::tempdir().unwrap(); + let test_base = tempdir.path().to_path_buf(); + ["foo", "foo/foo0", "foo/foo1", "foo/bar"] + .iter() + .for_each(|x| create_dir(&test_base, x)); + let files = [ + "foo/file1.txt", + "foo/file2.txt", + "foo/foo1/file3.txt", + "foo/bar/file4.txt", + ]; + files.iter().for_each(|x| create_file(&test_base, x)); + [("foo/symlink1.txt", "./file1.txt")] + .iter() + .for_each(|(x, y)| create_symlink(&test_base, x, y)); + + // act + let recursive_copy = CopyOperation { + copy_type: CopyType::Archive, + source: test_base.join("foo"), + destination: test_base.join("bar"), + }; + do_copy(recursive_copy).unwrap(); + + // assert + files.iter().for_each(|x| { + assert_same_file( + &test_base.join(x), + &test_base.join(x.replace("foo/", "bar/")), + ) + }); + assert_same_file( + &test_base.join("foo/symlink1.txt"), + &test_base.join("bar/symlink1.txt"), + ); + + assert_same_link( + &test_base.join("foo/symlink1.txt"), + &test_base.join("bar/symlink1.txt"), + ) + } + + #[test] + fn test_copy_archive_destination_exists() { + // prepare + let tempdir = tempfile::tempdir().unwrap(); + let test_base = tempdir.path().to_path_buf(); + ["foo", "foo/foo0", "foo/foo1", "foo/bar"] + .iter() + .for_each(|x| create_dir(&test_base, x)); + let files = [ + "foo/file1.txt", + "foo/file2.txt", + "foo/foo1/file3.txt", + "foo/bar/file4.txt", + ]; + files.iter().for_each(|x| create_file(&test_base, x)); + [("foo/symlink1.txt", "./file1.txt")] + .iter() + .for_each(|(x, y)| create_symlink(&test_base, x, y)); + create_dir(&test_base, "bar"); + + // act + let recursive_copy = CopyOperation { + copy_type: CopyType::Archive, + source: test_base.join("foo"), + destination: test_base.join("bar"), + }; + do_copy(recursive_copy).unwrap(); + + // assert + files.iter().for_each(|x| { + assert_same_file( + &test_base.join(x), + &test_base.join(x.replace("foo/", "bar/foo/")), + ) + }); + + assert_same_link( + &test_base.join("foo/symlink1.txt"), + &test_base.join("bar/foo/symlink1.txt"), + ) + } + + // Utility functions used in the tests + fn create_dir(base: &Path, dir: &str) { + fs::create_dir_all(base.to_path_buf().join(dir)).unwrap(); + } + + fn create_file(base: &Path, file: &str) { + let mut file = fs::File::create(base.to_path_buf().join(file)).unwrap(); + file.write_fmt(format_args!("{}", uuid::Uuid::new_v4().to_string())) + .unwrap(); + } + + fn create_symlink(base: &Path, file: &str, target: &str) { + unix::fs::symlink(Path::new(target), &base.to_path_buf().join(file)).unwrap(); + } + + fn assert_same_file(source: &Path, dest: &Path) { + assert!(source.exists()); + assert!(dest.exists()); + assert!(source.is_file()); + assert!(dest.is_file()); + + assert_eq!( + fs::read_to_string(source).unwrap(), + fs::read_to_string(dest).unwrap() + ); + } + + fn assert_same_link(source: &Path, dest: &Path) { + assert!(source.exists()); + assert!(dest.exists()); + assert!(source.is_symlink()); + assert!(dest.is_symlink()); + + assert_eq!(fs::read_link(source).unwrap(), fs::read_link(dest).unwrap()); + } +} From f9033f147fcd01ea485ecd4ab496ff5d1eb58dea Mon Sep 17 00:00:00 2001 From: Bryan Aguilar Date: Mon, 1 May 2023 16:46:09 -0700 Subject: [PATCH 2/6] Modify java agent dockerfile --- autoinstrumentation/java/Dockerfile | 39 ++++++++++++++++++++++++++--- 1 file changed, 36 insertions(+), 3 deletions(-) diff --git a/autoinstrumentation/java/Dockerfile b/autoinstrumentation/java/Dockerfile index 41941402f7..6ef9f9b4a4 100644 --- a/autoinstrumentation/java/Dockerfile +++ b/autoinstrumentation/java/Dockerfile @@ -4,10 +4,43 @@ # - Grant the necessary access to the jar. `chmod -R go+r /javaagent.jar` # - For auto-instrumentation by container injection, the Linux command cp is # used and must be availabe in the image. -FROM busybox + +# Stage 1: Build the cp-utility binary +FROM rust:1.69 as builder + +WORKDIR /usr/src/cp-utility +COPY ./tools/cp-utility . + +## TARGETARCH is defined by buildx +# https://docs.docker.com/engine/reference/builder/#automatic-platform-args-in-the-global-scope +ARG TARGETARCH + +# Run validations and audit only on amd64 bacause it is faster and those two steps +# are only used to validate the source code and don't require anything that is +# architecture specific. + +# Validations +## Validate formatting +RUN if [ $TARGETARCH = "amd64" ]; then rustup component add rustfmt && cargo fmt --check ; fi + +## Audit dependencies +RUN if [ $TARGETARCH = "amd64" ]; then cargo install cargo-audit && cargo audit ; fi + + +# Cross-compile based on the target platform. +RUN if [ $TARGETARCH = "amd64" ]; then export ARCH="x86_64" ; \ + elif [ $TARGETARCH = "arm64" ]; then export ARCH="aarch64" ; \ + else false; \ + fi \ + && rustup target add ${ARCH}-unknown-linux-musl \ + && cargo test --target ${ARCH}-unknown-linux-musl \ + && cargo install --target ${ARCH}-unknown-linux-musl --path . --root . + +# Stage 2: Create distribution +FROM scratch ARG version -ADD https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/download/v$version/opentelemetry-javaagent.jar /javaagent.jar +COPY --from=builder /usr/src/cp-utility/bin/cp-utility /bin/cp -RUN chmod -R go+r /javaagent.jar +ADD --chmod=go+r https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/download/v$version/opentelemetry-javaagent.jar /javaagent.jar From 515324a7b8b6d4880aa80554d6a6c1dba0bf5d64 Mon Sep 17 00:00:00 2001 From: Bryan Aguilar Date: Mon, 1 May 2023 16:49:57 -0700 Subject: [PATCH 3/6] Modify docker util path --- autoinstrumentation/java/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autoinstrumentation/java/Dockerfile b/autoinstrumentation/java/Dockerfile index 6ef9f9b4a4..601414307d 100644 --- a/autoinstrumentation/java/Dockerfile +++ b/autoinstrumentation/java/Dockerfile @@ -9,7 +9,7 @@ FROM rust:1.69 as builder WORKDIR /usr/src/cp-utility -COPY ./tools/cp-utility . +COPY ./cp-utility . ## TARGETARCH is defined by buildx # https://docs.docker.com/engine/reference/builder/#automatic-platform-args-in-the-global-scope From 6c4b6e74696804d15e33cb1698593cc8b1d7d628 Mon Sep 17 00:00:00 2001 From: Bryan Aguilar Date: Mon, 1 May 2023 16:50:08 -0700 Subject: [PATCH 4/6] Modify github workflow --- .github/workflows/publish-autoinstrumentation-java.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/publish-autoinstrumentation-java.yaml b/.github/workflows/publish-autoinstrumentation-java.yaml index 04f313ed6e..d8ce90bf95 100644 --- a/.github/workflows/publish-autoinstrumentation-java.yaml +++ b/.github/workflows/publish-autoinstrumentation-java.yaml @@ -19,6 +19,10 @@ jobs: steps: - uses: actions/checkout@v3 + + # this is required so that the cp-utility binary is in included in the docker context. + - name: copy cp-utility + run: cp -r tools/cp-utility autoinstrumentation/java/ - name: Read version run: echo "VERSION=$(cat autoinstrumentation/java/version.txt)" >> $GITHUB_ENV From 95c38fdd795bae5d600d7bbc2b3c5b642cc3f1ae Mon Sep 17 00:00:00 2001 From: Bryan Aguilar Date: Mon, 1 May 2023 17:00:28 -0700 Subject: [PATCH 5/6] Add changelog --- .chloggen/cputil.yaml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100755 .chloggen/cputil.yaml diff --git a/.chloggen/cputil.yaml b/.chloggen/cputil.yaml new file mode 100755 index 0000000000..6849ea3536 --- /dev/null +++ b/.chloggen/cputil.yaml @@ -0,0 +1,16 @@ +# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' +change_type: 'enhancement' + +# The name of the component, or a single word describing the area of concern, (e.g. operator, target allocator, github action) +component: autoinstrumentation + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: Replace busybox base image with cp binary in java autoinstrumentation dockerfile + +# One or more tracking issues related to the change +issues: [1600] + +# (Optional) One or more lines of additional information to render under the primary note. +# These lines will be padded with 2 spaces and then inserted directly into the document. +# Use pipe (|) for multiline entries. +subtext: From 83106e8cd787a324c825a1992a090d3a90c8dfe4 Mon Sep 17 00:00:00 2001 From: Bryan Aguilar Date: Mon, 1 May 2023 17:24:59 -0700 Subject: [PATCH 6/6] Update codeowners --- .github/CODEOWNERS | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 209e0fe34b..0cfac2376a 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -20,3 +20,6 @@ # Target Allocator owners cmd/otel-allocator @open-telemetry/operator-ta-maintainers + +# cp-utility tool +tools/cp-utility @rapphil @bryan-aguilar