Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion tests/e2e/opentelemetry-common/collector.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Wrapper around the official OpenTelemetry Collector image which lacks all basic utils which we want for debugging.
ARG CONFIG_COLLECTOR_VERSION=latest
FROM otel/opentelemetry-collector-contrib:${CONFIG_COLLECTOR_VERSION} AS upstream
ARG CONFIG_COLLECTOR_DIGEST
FROM otel/opentelemetry-collector-contrib:${CONFIG_COLLECTOR_VERSION}@${CONFIG_COLLECTOR_DIGEST} AS upstream

FROM alpine:3.20 AS base
COPY --from=upstream /otelcol-contrib /otelcol-contrib
Expand Down
3 changes: 2 additions & 1 deletion tests/e2e/opentelemetry-logs/config/compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: opentelemetry-vector-e2e
services:
otel-collector-source:
container_name: otel-collector-source
image: otel/opentelemetry-collector-contrib:${CONFIG_COLLECTOR_VERSION}
image: otel/opentelemetry-collector-contrib:${CONFIG_COLLECTOR_VERSION}@${CONFIG_COLLECTOR_DIGEST}
init: true
volumes:
- type: bind
Expand Down Expand Up @@ -47,6 +47,7 @@ services:
dockerfile: ./tests/e2e/opentelemetry-common/collector.Dockerfile
args:
CONFIG_COLLECTOR_VERSION: ${CONFIG_COLLECTOR_VERSION}
CONFIG_COLLECTOR_DIGEST: ${CONFIG_COLLECTOR_DIGEST}
init: true
user: "0:0" # test only, override special user with root
command: [ "--config", "/etc/otelcol-contrib/config.yaml" ]
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/opentelemetry-logs/config/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ runner:

matrix:
# Determines which `otel/opentelemetry-collector-contrib` version to use
collector_version: [ 'latest' ]
collector_version: [ 'latest@sha256:e7c92c715f28ff142f3bcaccd4fc5603cf4c71276ef09954a38eb4038500a5a5' ]
vector_config: [ 'vector_default.yaml', 'vector_otlp.yaml' ]

# Only trigger this integration test if relevant OTEL source/sink files change
Expand Down
3 changes: 2 additions & 1 deletion tests/e2e/opentelemetry-metrics/config/compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: opentelemetry-vector-e2e
services:
otel-collector-source:
container_name: otel-collector-source
image: otel/opentelemetry-collector-contrib:${CONFIG_COLLECTOR_VERSION}
image: otel/opentelemetry-collector-contrib:${CONFIG_COLLECTOR_VERSION}@${CONFIG_COLLECTOR_DIGEST}
init: true
volumes:
- type: bind
Expand Down Expand Up @@ -84,6 +84,7 @@ services:
dockerfile: ./tests/e2e/opentelemetry-common/collector.Dockerfile
args:
CONFIG_COLLECTOR_VERSION: ${CONFIG_COLLECTOR_VERSION}
CONFIG_COLLECTOR_DIGEST: ${CONFIG_COLLECTOR_DIGEST}
init: true
user: "0:0" # test only, override special user with root
command: [ "--config", "/etc/otelcol-contrib/config.yaml" ]
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/opentelemetry-metrics/config/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ runner:

matrix:
# Determines which `otel/opentelemetry-collector-contrib` version to use
collector_version: [ 'latest' ]
collector_version: [ 'latest@sha256:e7c92c715f28ff142f3bcaccd4fc5603cf4c71276ef09954a38eb4038500a5a5' ]

# Only trigger this integration test if relevant OTEL source/sink files change
paths:
Expand Down
5 changes: 4 additions & 1 deletion vdev/src/testing/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,10 @@ impl ComposeTestConfig {
.values()
.multi_cartesian_product()
.map(|product| {
let key = product.iter().join("-");
let key = product
.iter()
.map(|v| v.replace("@", "-").replace(":", "-"))
.join("-");
let config: Environment = self
.matrix
.keys()
Expand Down
31 changes: 22 additions & 9 deletions vdev/src/utils/environment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,28 @@ cfg_if! {
pub type Environment = BTreeMap<String, Option<String>>;

pub(crate) fn rename_environment_keys(environment: &Environment) -> Environment {
environment
.iter()
.map(|(var, value)| {
(
format!("CONFIG_{}", var.replace('-', "_").to_uppercase()),
value.clone(),
)
})
.collect()
let mut result = Environment::new();
for (var, value) in environment {
let normalized = var.replace('-', "_");
let config_key = format!("CONFIG_{}", normalized.to_uppercase());

// If the key contains "version" and the value contains `@`, split into version and digest.
if normalized.contains("version")
&& let Some(val) = value
&& let Some((version_part, digest_part)) = val.split_once('@')
{
let digest_key = format!(
"CONFIG_{}",
normalized.replace("version", "digest").to_uppercase()
);
result.insert(config_key, Some(version_part.to_string()));
result.insert(digest_key, Some(digest_part.to_string()));
continue;
}

result.insert(config_key, value.clone());
}
result
}

pub(crate) fn extract_present(environment: &Environment) -> BTreeMap<String, String> {
Expand Down
Loading