File tree 6 files changed +109
-0
lines changed
smoke-tests/images/security-manager
java/io/opentelemetry/smoketest/securitymanager 6 files changed +109
-0
lines changed Original file line number Diff line number Diff line change
1
+ name : PR build Security Manager test app images for smoke tests
2
+
3
+ on :
4
+ pull_request :
5
+ paths :
6
+ - ' smoke-tests/images/security-manager/**'
7
+ - ' .github/workflows/pr-smoke-test-security-manager-images.yml'
8
+
9
+ jobs :
10
+ build :
11
+ uses : ./.github/workflows/reusable-smoke-test-images.yml
12
+ with :
13
+ project : " :smoke-tests:images:security-manager"
14
+ cache-read-only : true
Original file line number Diff line number Diff line change
1
+ name : Publish Security Manager test app images for smoke tests
2
+
3
+ on :
4
+ push :
5
+ paths :
6
+ - ' smoke-tests/images/security-manager/**'
7
+ - ' .github/workflows/publish-smoke-test-security-manager-images.yml'
8
+ branches :
9
+ - main
10
+ workflow_dispatch :
11
+
12
+ jobs :
13
+ publish :
14
+ uses : ./.github/workflows/reusable-smoke-test-images.yml
15
+ with :
16
+ project : " :smoke-tests:images:security-manager"
17
+ publish : true
18
+
19
+ open-issue-on-failure :
20
+ needs :
21
+ - publish
22
+ if : failure() && github.run_attempt == 1
23
+ uses : ./.github/workflows/reusable-open-issue-on-failure.yml
Original file line number Diff line number Diff line change @@ -124,6 +124,7 @@ include(":smoke-tests:images:fake-backend")
124
124
include(" :smoke-tests:images:grpc" )
125
125
include(" :smoke-tests:images:play" )
126
126
include(" :smoke-tests:images:quarkus" )
127
+ include(" :smoke-tests:images:security-manager" )
127
128
include(" :smoke-tests:images:servlet" )
128
129
hideFromDependabot(" :smoke-tests:images:servlet:servlet-3.0" )
129
130
hideFromDependabot(" :smoke-tests:images:servlet:servlet-5.0" )
Original file line number Diff line number Diff line change
1
+ import java.time.LocalDateTime
2
+ import java.time.format.DateTimeFormatter
3
+
4
+ plugins {
5
+ id(" otel.java-conventions" )
6
+
7
+ id(" com.google.cloud.tools.jib" )
8
+ }
9
+
10
+ dependencies {
11
+ implementation(platform(" io.opentelemetry:opentelemetry-bom:1.0.0" ))
12
+
13
+ implementation(" io.opentelemetry:opentelemetry-api" )
14
+ }
15
+
16
+ val targetJDK = project.findProperty(" targetJDK" ) ? : " 11"
17
+
18
+ val tag = findProperty(" tag" )
19
+ ? : DateTimeFormatter .ofPattern(" yyyyMMdd.HHmmSS" ).format(LocalDateTime .now())
20
+
21
+ java {
22
+ // needed by jib to detect java version used in project
23
+ // for jdk9+ jib uses an entrypoint that doesn't work with jdk8
24
+ sourceCompatibility = JavaVersion .VERSION_1_8
25
+ targetCompatibility = JavaVersion .VERSION_1_8
26
+ }
27
+
28
+ jib {
29
+ from.image = " openjdk:$targetJDK "
30
+ to.image = " ghcr.io/open-telemetry/opentelemetry-java-instrumentation/smoke-test-security-manager:jdk$targetJDK -$tag "
31
+ container.mainClass = " io.opentelemetry.smoketest.securitymanager.Main"
32
+ container.jvmFlags = listOf (" -Djava.security.manager" , " -Djava.security.policy=/app/resources/security.policy" )
33
+ }
Original file line number Diff line number Diff line change
1
+ /*
2
+ * Copyright The OpenTelemetry Authors
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */
5
+
6
+ package io .opentelemetry .smoketest .securitymanager ;
7
+
8
+ import io .opentelemetry .api .GlobalOpenTelemetry ;
9
+ import io .opentelemetry .api .trace .Span ;
10
+ import io .opentelemetry .api .trace .Tracer ;
11
+ import io .opentelemetry .context .Scope ;
12
+
13
+ public class Main {
14
+
15
+ private Main () {}
16
+
17
+ @ SuppressWarnings ("SystemOut" )
18
+ public static void main (String [] args ) {
19
+ Tracer tracer = GlobalOpenTelemetry .get ().getTracer ("test-tracer" );
20
+ Span span = tracer .spanBuilder ("test" ).startSpan ();
21
+ try (Scope ignore = span .makeCurrent ()) {
22
+ // empty
23
+ } finally {
24
+ span .end ();
25
+ }
26
+ System .out .println ("completed successfully" );
27
+ }
28
+ }
Original file line number Diff line number Diff line change
1
+ // io.opentelemetry.context.LazyStorage reads system properties
2
+ // grant permission to read these to test application code, but not the agent code
3
+ grant codeBase "file:/app/classes/" {
4
+ permission java.util.PropertyPermission "io.opentelemetry.context.contextStorageProvider", "read";
5
+ permission java.util.PropertyPermission "io.opentelemetry.context.enableStrictContext", "read";
6
+ };
7
+ grant codeBase "file:/app/libs/-" {
8
+ permission java.util.PropertyPermission "io.opentelemetry.context.contextStorageProvider", "read";
9
+ permission java.util.PropertyPermission "io.opentelemetry.context.enableStrictContext", "read";
10
+ };
You can’t perform that action at this time.
0 commit comments