From b4371e401c749d27eb28acd43635448b9a017f96 Mon Sep 17 00:00:00 2001 From: "Dr. Christoph \"Schorsch\" Jung" Date: Thu, 25 Jul 2024 12:57:50 +0200 Subject: [PATCH] fix: curl was upgraded in alpine. Correct way of interpreting a skill request body. --- .../agents/edc/http/transfer/AgentSource.java | 13 +++++++++---- .../src/main/docker/Dockerfile | 2 +- .../agentplane-hashicorp/src/main/docker/Dockerfile | 2 +- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/agent-plane/agent-plane-protocol/src/main/java/org/eclipse/tractusx/agents/edc/http/transfer/AgentSource.java b/agent-plane/agent-plane-protocol/src/main/java/org/eclipse/tractusx/agents/edc/http/transfer/AgentSource.java index 84d465d..db48b10 100644 --- a/agent-plane/agent-plane-protocol/src/main/java/org/eclipse/tractusx/agents/edc/http/transfer/AgentSource.java +++ b/agent-plane/agent-plane-protocol/src/main/java/org/eclipse/tractusx/agents/edc/http/transfer/AgentSource.java @@ -20,6 +20,7 @@ import okhttp3.OkHttpClient; import okhttp3.Request; import okhttp3.Response; +import okio.Buffer; import org.eclipse.edc.connector.dataplane.http.params.HttpRequestFactory; import org.eclipse.edc.connector.dataplane.http.spi.HttpRequestParams; import org.eclipse.edc.connector.dataplane.spi.pipeline.DataSource; @@ -137,10 +138,12 @@ protected StreamResult> openMatchmakingInternal() { } String query = skillText.get(); okhttp3.Request tempRequest = this.requestFactory.toRequest(this.params); - if (tempRequest.body() != null && tempRequest.body().contentType().toString() == AgentHttpAction.RESULTSET_CONTENT_TYPE) { + if (tempRequest.body() != null && AgentHttpAction.RESULTSET_CONTENT_TYPE.equals(tempRequest.body().contentType().toString())) { TupleSet bindings = new TupleSet(); try { - AgentHttpAction.parseBinding(typeManager.getMapper().readTree(tempRequest.body().toString()), bindings); + Buffer buffer = new Buffer(); + tempRequest.body().writeTo(buffer); + AgentHttpAction.parseBinding(typeManager.getMapper().readTree(buffer.readByteArray()), bindings); query = AgentHttpAction.bind(query, bindings); } catch (Exception e) { return StreamResult.error(String.format("The query could not be bound to the given input tupleset.", e)); @@ -219,10 +222,12 @@ protected StreamResult> openMatchmakingRest() { } String query = skillText.get(); okhttp3.Request tempRequest = this.requestFactory.toRequest(this.params); - if (tempRequest.body() != null && tempRequest.body().contentType().toString() == AgentHttpAction.RESULTSET_CONTENT_TYPE) { + if (tempRequest.body() != null && AgentHttpAction.RESULTSET_CONTENT_TYPE.equals(tempRequest.body().contentType().toString())) { TupleSet bindings = new TupleSet(); try { - AgentHttpAction.parseBinding(typeManager.getMapper().readTree(tempRequest.body().toString()), bindings); + Buffer buffer = new Buffer(); + tempRequest.body().writeTo(buffer); + AgentHttpAction.parseBinding(typeManager.getMapper().readTree(buffer.readByteArray()), bindings); query = AgentHttpAction.bind(query, bindings); } catch (Exception e) { return StreamResult.error(String.format("The query could not be bound to the given input tupleset.", e)); diff --git a/agent-plane/agentplane-azure-vault/src/main/docker/Dockerfile b/agent-plane/agentplane-azure-vault/src/main/docker/Dockerfile index 5ca2d89..78ef4d5 100644 --- a/agent-plane/agentplane-azure-vault/src/main/docker/Dockerfile +++ b/agent-plane/agentplane-azure-vault/src/main/docker/Dockerfile @@ -22,7 +22,7 @@ ENV OTEL_AGENT_LOCATION "https://github.com/open-telemetry/opentelemetry-java-in HEALTHCHECK NONE -RUN apk update && apk add curl=8.5.0-r0 --no-cache +RUN apk update && apk add curl=8.9.0-r0 --no-cache RUN curl -L --proto "=https" -sSf ${OTEL_AGENT_LOCATION} --output /tmp/opentelemetry-javaagent.jar FROM eclipse-temurin:22-jre-alpine diff --git a/agent-plane/agentplane-hashicorp/src/main/docker/Dockerfile b/agent-plane/agentplane-hashicorp/src/main/docker/Dockerfile index b9f63f0..81d4969 100644 --- a/agent-plane/agentplane-hashicorp/src/main/docker/Dockerfile +++ b/agent-plane/agentplane-hashicorp/src/main/docker/Dockerfile @@ -21,7 +21,7 @@ ENV OTEL_AGENT_LOCATION "https://github.com/open-telemetry/opentelemetry-java-in HEALTHCHECK NONE -RUN apk update && apk add curl=8.5.0-r0 --no-cache +RUN apk update && apk add curl=8.9.0-r0 --no-cache RUN curl -L --proto "=https" -sSf ${OTEL_AGENT_LOCATION} --output /tmp/opentelemetry-javaagent.jar FROM eclipse-temurin:22-jre-alpine