Skip to content

Commit e4a047a

Browse files
traskotelbot[bot]
andauthored
Alternate strategy for pinning collector images (#7586)
Co-authored-by: otelbot <[email protected]>
1 parent 20f0a3a commit e4a047a

File tree

7 files changed

+19
-32
lines changed

7 files changed

+19
-32
lines changed

.github/renovate.json5

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
extends: [
44
'config:best-practices',
55
'helpers:pinGitHubActionDigestsToSemver',
6-
'customManagers:githubActionsVersions'
76
],
7+
ignorePaths: [], // overwrite default ignore which includes **/test/**
8+
// used to update docker image versions used in Java test files
89
packageRules: [
910
{
1011
// this is to reduce the number of renovate PRs
@@ -95,5 +96,17 @@
9596
],
9697
depNameTemplate: 'java',
9798
},
99+
{
100+
customType: 'regex',
101+
datasourceTemplate: 'docker',
102+
managerFilePatterns: [
103+
'**/*.java'
104+
],
105+
matchStrings: [
106+
'"(?<depName>otel/opentelemetry-collector-contrib):(?<currentValue>[^@"]+)(?:@(?<currentDigest>sha256:[a-f0-9]+))?"',
107+
],
108+
autoReplaceStringTemplate: '"{{depName}}:{{newValue}}{{#if newDigest}}@{{newDigest}}{{/if}}"',
109+
versioningTemplate: 'docker',
110+
},
98111
],
99112
}

.github/workflows/build.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,6 @@ on:
88
pull_request:
99
workflow_dispatch:
1010

11-
env:
12-
# renovate: datasource=github-releases depName=opentelemetry-collector packageName=open-telemetry/opentelemetry-collector-releases
13-
OTEL_COLLECTOR_VERSION: v0.132.4
14-
1511
concurrency:
1612
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
1713
cancel-in-progress: true

exporters/prometheus/src/test/java/io/opentelemetry/exporter/prometheus/CollectorIntegrationTest.java

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -59,18 +59,7 @@
5959
@SuppressWarnings("NonFinalStaticField")
6060
class CollectorIntegrationTest {
6161

62-
private static final String COLLECTOR_IMAGE =
63-
"otel/opentelemetry-collector-contrib" + collectorVersion();
64-
65-
private static String collectorVersion() {
66-
String otelCollectorVersion = System.getenv("OTEL_COLLECTOR_VERSION");
67-
if (otelCollectorVersion != null) {
68-
// strip the leading 'v'
69-
return ":" + otelCollectorVersion.substring(1);
70-
}
71-
// Default to latest if not set
72-
return ":latest";
73-
}
62+
private static final String COLLECTOR_IMAGE = "otel/opentelemetry-collector-contrib:0.132.2";
7463

7564
private static final Integer COLLECTOR_HEALTH_CHECK_PORT = 13133;
7665

integration-tests/otlp/src/main/java/io/opentelemetry/integrationtest/OtlpExporterIntegrationTest.java

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -114,18 +114,7 @@ abstract class OtlpExporterIntegrationTest {
114114

115115
private static final AttributeKey<String> SERVICE_NAME = AttributeKey.stringKey("service.name");
116116

117-
private static final String COLLECTOR_IMAGE =
118-
"otel/opentelemetry-collector-contrib" + collectorVersion();
119-
120-
private static String collectorVersion() {
121-
String otelCollectorVersion = System.getenv("OTEL_COLLECTOR_VERSION");
122-
if (otelCollectorVersion != null) {
123-
// strip the leading 'v'
124-
return ":" + otelCollectorVersion.substring(1);
125-
}
126-
// Default to latest if not set
127-
return ":latest";
128-
}
117+
private static final String COLLECTOR_IMAGE = "otel/opentelemetry-collector-contrib:0.132.2";
129118

130119
private static final Integer COLLECTOR_OTLP_GRPC_PORT = 4317;
131120
private static final Integer COLLECTOR_OTLP_HTTP_PORT = 4318;

perf-harness/src/test/java/io/opentelemetry/perf/OtlpPipelineStressTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public class OtlpPipelineStressTest {
6868

6969
@Container
7070
public static final GenericContainer<?> collectorContainer =
71-
new GenericContainer<>(DockerImageName.parse("otel/opentelemetry-collector-contrib:latest"))
71+
new GenericContainer<>(DockerImageName.parse("otel/opentelemetry-collector-contrib:0.132.2"))
7272
.withImagePullPolicy(PullPolicy.alwaysPull())
7373
.withNetwork(network)
7474
.withNetworkAliases("otel-collector")

sdk/trace/src/jmh/java/io/opentelemetry/sdk/trace/ExporterBenchmark.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ private ExporterBenchmark() {}
3636
@State(Scope.Benchmark)
3737
public abstract static class AbstractProcessorBenchmark {
3838
private static final DockerImageName OTLP_COLLECTOR_IMAGE =
39-
DockerImageName.parse("otel/opentelemetry-collector-contrib:latest");
39+
DockerImageName.parse("otel/opentelemetry-collector-contrib:0.132.2");
4040
protected static final int OTLP_PORT = 5678;
4141
private static final int HEALTH_CHECK_PORT = 13133;
4242
protected SdkSpanBuilder sdkSpanBuilder;

sdk/trace/src/jmh/java/io/opentelemetry/sdk/trace/SpanPipelineBenchmark.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ private SpanPipelineBenchmark() {}
3838
@State(Scope.Benchmark)
3939
public abstract static class AbstractProcessorBenchmark {
4040
private static final DockerImageName OTLP_COLLECTOR_IMAGE =
41-
DockerImageName.parse("otel/opentelemetry-collector-contrib:latest");
41+
DockerImageName.parse("otel/opentelemetry-collector-contrib:0.132.2");
4242
private static final int EXPOSED_PORT = 5678;
4343
private static final int HEALTH_CHECK_PORT = 13133;
4444
private Tracer tracer;

0 commit comments

Comments
 (0)