summaryrefslogtreecommitdiffstats
path: root/controller-api
diff options
context:
space:
mode:
authorjonmv <venstad@gmail.com>2022-08-15 14:11:23 +0200
committerjonmv <venstad@gmail.com>2022-08-15 14:11:23 +0200
commit02c03d29a12123c68302d66a7e47f0c97f0f2aa5 (patch)
tree0412c3e0771f0e53e81c705fc3c4629592972036 /controller-api
parent11296c9e4b4e8ca2749ff9713f31fc17ea7b7462 (diff)
Store Vespa logs in S3 for non-prod-deployment jobs
Diffstat (limited to 'controller-api')
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/RunDataStore.java7
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/stubs/MockRunDataStore.java16
2 files changed, 23 insertions, 0 deletions
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/RunDataStore.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/RunDataStore.java
index 9cf508d37c9..3558d18f721 100644
--- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/RunDataStore.java
+++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/RunDataStore.java
@@ -4,6 +4,7 @@ package com.yahoo.vespa.hosted.controller.api.integration;
import com.yahoo.config.provision.ApplicationId;
import com.yahoo.vespa.hosted.controller.api.integration.deployment.RunId;
+import java.io.InputStream;
import java.util.Optional;
/**
@@ -29,4 +30,10 @@ public interface RunDataStore {
/** Deletes all data associated with the given application. */
void delete(ApplicationId id);
+ /** Stores Vespa logs for the run. */
+ void putLogs(RunId id, boolean tester, InputStream logs);
+
+ /** Fetches Vespa logs for the run. */
+ InputStream getLogs(RunId id, boolean tester);
+
}
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/stubs/MockRunDataStore.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/stubs/MockRunDataStore.java
index 32591cfe4e2..cc1e084de8e 100644
--- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/stubs/MockRunDataStore.java
+++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/stubs/MockRunDataStore.java
@@ -5,10 +5,14 @@ import com.yahoo.config.provision.ApplicationId;
import com.yahoo.vespa.hosted.controller.api.integration.RunDataStore;
import com.yahoo.vespa.hosted.controller.api.integration.deployment.RunId;
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
import java.util.Map;
import java.util.Optional;
import java.util.concurrent.ConcurrentHashMap;
+import static com.yahoo.yolean.Exceptions.uncheck;
+
/**
* @author jonmv
*/
@@ -16,6 +20,8 @@ public class MockRunDataStore implements RunDataStore {
private final Map<RunId, byte[]> logs = new ConcurrentHashMap<>();
private final Map<RunId, byte[]> reports = new ConcurrentHashMap<>();
+ private final Map<RunId, byte[]> vespaLogs = new ConcurrentHashMap<>();
+ private final Map<RunId, byte[]> testerLogs = new ConcurrentHashMap<>();
@Override
public Optional<byte[]> get(RunId id) {
@@ -49,4 +55,14 @@ public class MockRunDataStore implements RunDataStore {
reports.keySet().removeIf(runId -> runId.application().equals(id));
}
+ @Override
+ public void putLogs(RunId id, boolean tester, InputStream logs) {
+ (tester ? testerLogs : vespaLogs).put(id, uncheck(logs::readAllBytes));
+ }
+
+ @Override
+ public InputStream getLogs(RunId id, boolean tester) {
+ return new ByteArrayInputStream((tester ? testerLogs : vespaLogs).get(id));
+ }
+
}