diff --git a/build.gradle b/build.gradle index bfc4737f..3db3f297 100644 --- a/build.gradle +++ b/build.gradle @@ -33,6 +33,8 @@ dependencies { implementation 'com.jayway.jsonpath:json-path:2.6.0' implementation 'info.picocli:picocli:4.6.2' implementation 'io.temporal:temporal-sdk:latest.release' + implementation 'io.temporal:temporal-payload-storage-s3driver:latest.release' + implementation 'io.temporal:temporal-payload-storage-s3driver-awssdkv2:latest.release' implementation 'org.junit.jupiter:junit-jupiter-api:5.8.1' implementation 'org.reflections:reflections:0.10.2' } diff --git a/features/external_storage/s3_interop/README.md b/features/external_storage/s3_interop/README.md new file mode 100644 index 00000000..528390cd --- /dev/null +++ b/features/external_storage/s3_interop/README.md @@ -0,0 +1,26 @@ +# External storage S3 interoperability + +Payloads larger than the external storage threshold are stored in S3 by the `aws.s3driver` driver, and the +workflow history contains only references to them. All SDKs must write the same references and objects, and +each SDK must read the references and objects that another SDK wrote. + +The feature: + +* Starts a workflow with a 300 KiB string. The client stores the input, and the worker stores the result. +* Signals the workflow with a reference to an object that the Go SDK wrote. The workflow fails if it does not + read the value `hello` from the object. +* Checks that the client gets the input back as the result. +* Checks that the history contains references with the same driver name, bucket, key and SHA-256 hash in all + SDKs, and that the stored object has the expected hash. + +# Configuration + +The feature is skipped if `TEMPORAL_FEATURES_S3_BUCKET` is not set. It uses these environment variables: + +* `TEMPORAL_FEATURES_S3_BUCKET` - the bucket. It must exist. +* `TEMPORAL_FEATURES_S3_ENDPOINT` - an optional S3-compatible endpoint, for example MinIO. Path-style + addressing is used with it. +* `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`, `AWS_REGION` - the credentials and the region. + +The PHP worker runs in RoadRunner. The PHP harness passes the bucket and the endpoint to the +`temporal.external_storage` section of RoadRunner, so the RoadRunner binary must support this section. diff --git a/features/external_storage/s3_interop/feature.go b/features/external_storage/s3_interop/feature.go new file mode 100644 index 00000000..df80f7be --- /dev/null +++ b/features/external_storage/s3_interop/feature.go @@ -0,0 +1,224 @@ +package s3_interop + +import ( + "context" + "crypto/sha256" + "encoding/base64" + "encoding/hex" + "encoding/json" + "fmt" + "io" + "os" + "strings" + "time" + + "github.com/aws/aws-sdk-go-v2/aws" + awsconfig "github.com/aws/aws-sdk-go-v2/config" + "github.com/aws/aws-sdk-go-v2/service/s3" + "github.com/temporalio/features/harness/go/harness" + commonpb "go.temporal.io/api/common/v1" + historypb "go.temporal.io/api/history/v1" + "go.temporal.io/api/workflowservice/v1" + "go.temporal.io/sdk/client" + "go.temporal.io/sdk/contrib/aws/s3driver" + "go.temporal.io/sdk/contrib/aws/s3driver/awssdkv2" + "go.temporal.io/sdk/converter" + "go.temporal.io/sdk/worker" + "go.temporal.io/sdk/workflow" +) + +const ( + envBucket = "TEMPORAL_FEATURES_S3_BUCKET" + envEndpoint = "TEMPORAL_FEATURES_S3_ENDPOINT" + driverName = "aws.s3driver" + referenceType = "temporal.api.sdk.v1.ExternalStorageReference" + signalName = "foreign" + foreignValue = "hello" + foreignPayload = "ChYKCGVuY29kaW5nEgpqc29uL3BsYWluEgciaGVsbG8i" + foreignHash = "1b8435174847de88db3a8c5a764295d62add152743b3a9a730796a4c090caf8c" + inputHash = "8016abfa3587d601e521edf45b84c3fca4ef12f10d6b470d4c4aa0eab0f82f1a" +) + +var ( + input = strings.Repeat("x", 300*1024) + bucket = os.Getenv(envBucket) + s3Client = newS3Client() +) + +var Feature = harness.Feature{ + Workflows: Workflow, + Execute: execute, + CheckResult: checkResult, + CheckHistory: checkHistory, + ClientOptions: client.Options{ExternalStorage: externalStorage()}, +} + +func Workflow(ctx workflow.Context, value string) (string, error) { + var foreign string + workflow.GetSignalChannel(ctx, signalName).Receive(ctx, &foreign) + if foreign != foreignValue { + return "", fmt.Errorf("foreign payload is %q, expected %q", foreign, foreignValue) + } + return value, nil +} + +func execute(ctx context.Context, r *harness.Runner) (client.WorkflowRun, error) { + if bucket == "" { + return nil, r.Skip(envBucket + " is not set") + } + + data, _ := base64.StdEncoding.DecodeString(foreignPayload) + if err := putObject(ctx, foreignKey(), data); err != nil { + return nil, err + } + + run, err := r.Client.ExecuteWorkflow(ctx, client.StartWorkflowOptions{ + TaskQueue: r.TaskQueue, + WorkflowExecutionTimeout: time.Minute, + }, Workflow, input) + if err != nil { + return nil, err + } + + reference, err := json.Marshal(storageReference{DriverName: driverName, ClaimData: map[string]string{ + "bucket": bucket, + "key": foreignKey(), + "hash_algorithm": "sha256", + "hash_value": foreignHash, + }}) + if err != nil { + return nil, err + } + + _, err = r.Client.WorkflowService().SignalWorkflowExecution(ctx, &workflowservice.SignalWorkflowExecutionRequest{ + Namespace: r.Namespace, + WorkflowExecution: &commonpb.WorkflowExecution{WorkflowId: run.GetID(), RunId: run.GetRunID()}, + SignalName: signalName, + Input: &commonpb.Payloads{Payloads: []*commonpb.Payload{{ + Metadata: map[string][]byte{"encoding": []byte("json/protobuf"), "messageType": []byte(referenceType)}, + Data: reference, + }}}, + }) + return run, err +} + +func checkResult(ctx context.Context, r *harness.Runner, run client.WorkflowRun) error { + var result string + if err := run.Get(ctx, &result); err != nil { + return err + } + r.Require.Equal(input, result) + + response, err := r.Client.WorkflowService().GetWorkflowExecutionHistory(ctx, &workflowservice.GetWorkflowExecutionHistoryRequest{ + Namespace: r.Namespace, + Execution: &commonpb.WorkflowExecution{WorkflowId: run.GetID(), RunId: run.GetRunID()}, + }) + if err != nil { + return err + } + + var started *historypb.WorkflowExecutionStartedEventAttributes + var completed *historypb.WorkflowExecutionCompletedEventAttributes + for _, event := range response.GetHistory().GetEvents() { + if attrs := event.GetWorkflowExecutionStartedEventAttributes(); attrs != nil { + started = attrs + } + if attrs := event.GetWorkflowExecutionCompletedEventAttributes(); attrs != nil { + completed = attrs + } + } + r.Require.NotNil(started) + r.Require.NotNil(completed) + + prefix := "v0/ns/" + r.Namespace + "/wt/" + started.GetWorkflowType().GetName() + "/wi/" + run.GetID() + inputKey := checkReference(r, started.GetInput().GetPayloads()[0], prefix+"/ri/null/d/sha256/"+inputHash) + checkReference(r, completed.GetResult().GetPayloads()[0], prefix+"/ri/"+run.GetRunID()+"/d/sha256/"+inputHash) + + object, err := getObject(ctx, inputKey) + if err != nil { + return err + } + digest := sha256.Sum256(object) + r.Require.Equal(inputHash, hex.EncodeToString(digest[:])) + return nil +} + +func checkHistory(ctx context.Context, r *harness.Runner, run client.WorkflowRun) error { + replayer, err := worker.NewWorkflowReplayerWithOptions(worker.WorkflowReplayerOptions{ExternalStorage: externalStorage()}) + if err != nil { + return err + } + replayer.RegisterWorkflow(Workflow) + return replayer.ReplayWorkflowExecution(ctx, r.Client.WorkflowService(), nil, r.Namespace, workflow.Execution{ + ID: run.GetID(), + RunID: run.GetRunID(), + }) +} + +type storageReference struct { + DriverName string `json:"driverName"` + ClaimData map[string]string `json:"claimData"` +} + +func checkReference(r *harness.Runner, payload *commonpb.Payload, key string) string { + r.Require.Equal("json/protobuf", string(payload.GetMetadata()["encoding"])) + r.Require.Equal(referenceType, string(payload.GetMetadata()["messageType"])) + + var reference storageReference + r.Require.NoError(json.Unmarshal(payload.GetData(), &reference)) + r.Require.Equal(storageReference{DriverName: driverName, ClaimData: map[string]string{ + "bucket": bucket, + "key": key, + "hash_algorithm": "sha256", + "hash_value": inputHash, + }}, reference) + return key +} + +func foreignKey() string { + return "v0/d/sha256/" + foreignHash +} + +func newS3Client() *s3.Client { + if bucket == "" { + return nil + } + cfg, err := awsconfig.LoadDefaultConfig(context.Background()) + if err != nil { + panic(err) + } + return s3.NewFromConfig(cfg, func(o *s3.Options) { + if endpoint := os.Getenv(envEndpoint); endpoint != "" { + o.BaseEndpoint = aws.String(endpoint) + o.UsePathStyle = true + } + }) +} + +func externalStorage() converter.ExternalStorage { + if s3Client == nil { + return converter.ExternalStorage{} + } + driver, err := s3driver.NewDriver(s3driver.Options{ + Client: awssdkv2.NewClient(s3Client), + Bucket: s3driver.StaticBucket(bucket), + }) + if err != nil { + panic(err) + } + return converter.ExternalStorage{Drivers: []converter.StorageDriver{driver}} +} + +func putObject(ctx context.Context, key string, data []byte) error { + _, err := s3Client.PutObject(ctx, &s3.PutObjectInput{Bucket: aws.String(bucket), Key: aws.String(key), Body: strings.NewReader(string(data))}) + return err +} + +func getObject(ctx context.Context, key string) ([]byte, error) { + output, err := s3Client.GetObject(ctx, &s3.GetObjectInput{Bucket: aws.String(bucket), Key: aws.String(key)}) + if err != nil { + return nil, err + } + defer output.Body.Close() + return io.ReadAll(output.Body) +} diff --git a/features/external_storage/s3_interop/feature.java b/features/external_storage/s3_interop/feature.java new file mode 100644 index 00000000..69be1689 --- /dev/null +++ b/features/external_storage/s3_interop/feature.java @@ -0,0 +1,197 @@ +package external_storage.s3_interop; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import com.google.protobuf.ByteString; +import com.google.protobuf.util.JsonFormat; +import io.temporal.api.common.v1.Payload; +import io.temporal.api.common.v1.Payloads; +import io.temporal.api.history.v1.HistoryEvent; +import io.temporal.api.sdk.v1.ExternalStorageReference; +import io.temporal.api.workflowservice.v1.SignalWorkflowExecutionRequest; +import io.temporal.client.WorkflowClientOptions; +import io.temporal.failure.ApplicationFailure; +import io.temporal.payload.storage.ExternalStorage; +import io.temporal.payload.storage.s3driver.S3StorageDriver; +import io.temporal.payload.storage.s3driver.awssdkv2.S3AsyncClientAdapter; +import io.temporal.sdkfeatures.Feature; +import io.temporal.sdkfeatures.Run; +import io.temporal.sdkfeatures.Runner; +import io.temporal.workflow.SignalMethod; +import io.temporal.workflow.Workflow; +import io.temporal.workflow.WorkflowInterface; +import io.temporal.workflow.WorkflowMethod; +import java.math.BigInteger; +import java.net.URI; +import java.nio.charset.StandardCharsets; +import java.security.MessageDigest; +import java.util.Base64; +import java.util.Map; +import software.amazon.awssdk.core.async.AsyncRequestBody; +import software.amazon.awssdk.core.async.AsyncResponseTransformer; +import software.amazon.awssdk.services.s3.S3AsyncClient; + +@WorkflowInterface +public interface feature extends Feature { + String BUCKET = System.getenv("TEMPORAL_FEATURES_S3_BUCKET"); + String ENDPOINT = System.getenv("TEMPORAL_FEATURES_S3_ENDPOINT"); + String DRIVER_NAME = "aws.s3driver"; + String REFERENCE_TYPE = "temporal.api.sdk.v1.ExternalStorageReference"; + String SIGNAL = "foreign"; + String FOREIGN_VALUE = "hello"; + String FOREIGN_PAYLOAD = "ChYKCGVuY29kaW5nEgpqc29uL3BsYWluEgciaGVsbG8i"; + String FOREIGN_HASH = "1b8435174847de88db3a8c5a764295d62add152743b3a9a730796a4c090caf8c"; + String FOREIGN_KEY = "v0/d/sha256/" + FOREIGN_HASH; + String INPUT_HASH = "8016abfa3587d601e521edf45b84c3fca4ef12f10d6b470d4c4aa0eab0f82f1a"; + String INPUT = "x".repeat(300 * 1024); + S3AsyncClient S3 = BUCKET == null ? null : Impl.newS3Client(); + + @WorkflowMethod + String workflow(String value); + + @SignalMethod(name = SIGNAL) + void foreign(String value); + + class Impl implements feature { + private String foreign; + + @Override + public String workflow(String value) { + Workflow.await(() -> foreign != null); + if (!FOREIGN_VALUE.equals(foreign)) { + throw ApplicationFailure.newFailure( + "foreign payload is " + foreign + ", expected " + FOREIGN_VALUE, "Mismatch"); + } + return value; + } + + @Override + public void foreign(String value) { + foreign = value; + } + + @Override + public void workflowClientOptions(WorkflowClientOptions.Builder builder) { + if (S3 == null) { + return; + } + builder.setExternalStorage( + ExternalStorage.newBuilder() + .setDriver( + S3StorageDriver.newBuilder() + .setClient(new S3AsyncClientAdapter(S3)) + .setBucket(BUCKET) + .build()) + .build()); + } + + @Override + public Run execute(Runner runner) throws Exception { + if (S3 == null) { + runner.skip("TEMPORAL_FEATURES_S3_BUCKET is not set"); + } + + S3.putObject( + b -> b.bucket(BUCKET).key(FOREIGN_KEY), + AsyncRequestBody.fromBytes(Base64.getDecoder().decode(FOREIGN_PAYLOAD))) + .get(); + + var run = runner.executeSingleWorkflow(null, INPUT); + + var reference = + ExternalStorageReference.newBuilder() + .setDriverName(DRIVER_NAME) + .putAllClaimData( + Map.of( + "bucket", BUCKET, + "key", FOREIGN_KEY, + "hash_algorithm", "sha256", + "hash_value", FOREIGN_HASH)) + .build(); + var payload = + Payload.newBuilder() + .putMetadata("encoding", ByteString.copyFromUtf8("json/protobuf")) + .putMetadata("messageType", ByteString.copyFromUtf8(REFERENCE_TYPE)) + .setData(ByteString.copyFromUtf8(JsonFormat.printer().print(reference))) + .build(); + runner + .service + .blockingStub() + .signalWorkflowExecution( + SignalWorkflowExecutionRequest.newBuilder() + .setNamespace(runner.config.namespace) + .setWorkflowExecution(run.execution) + .setSignalName(SIGNAL) + .setInput(Payloads.newBuilder().addPayloads(payload)) + .build()); + return run; + } + + @Override + public void checkResult(Runner runner, Run run) throws Exception { + assertEquals(INPUT, runner.waitForRunResult(run, String.class)); + + var history = runner.getWorkflowHistory(run); + var started = + history.getEventsList().stream() + .filter(HistoryEvent::hasWorkflowExecutionStartedEventAttributes) + .findFirst() + .get() + .getWorkflowExecutionStartedEventAttributes(); + var completed = + history.getEventsList().stream() + .filter(HistoryEvent::hasWorkflowExecutionCompletedEventAttributes) + .findFirst() + .get() + .getWorkflowExecutionCompletedEventAttributes(); + + var prefix = + "v0/ns/" + + runner.config.namespace + + "/wt/" + + started.getWorkflowType().getName() + + "/wi/" + + run.execution.getWorkflowId(); + var inputKey = prefix + "/ri/null/d/sha256/" + INPUT_HASH; + checkReference(started.getInput().getPayloads(0), inputKey); + checkReference( + completed.getResult().getPayloads(0), + prefix + "/ri/" + run.execution.getRunId() + "/d/sha256/" + INPUT_HASH); + + var object = + S3.getObject(b -> b.bucket(BUCKET).key(inputKey), AsyncResponseTransformer.toBytes()) + .get() + .asByteArray(); + var digest = MessageDigest.getInstance("SHA-256").digest(object); + assertEquals(INPUT_HASH, String.format("%064x", new BigInteger(1, digest))); + } + + private static void checkReference(Payload payload, String key) throws Exception { + assertEquals("json/protobuf", payload.getMetadataOrThrow("encoding").toStringUtf8()); + assertEquals(REFERENCE_TYPE, payload.getMetadataOrThrow("messageType").toStringUtf8()); + assertTrue(payload.getExternalPayloadsCount() > 0); + + var reference = ExternalStorageReference.newBuilder(); + JsonFormat.parser() + .ignoringUnknownFields() + .merge(payload.getData().toString(StandardCharsets.UTF_8), reference); + assertEquals(DRIVER_NAME, reference.getDriverName()); + assertEquals( + Map.of( + "bucket", BUCKET, + "key", key, + "hash_algorithm", "sha256", + "hash_value", INPUT_HASH), + reference.getClaimDataMap()); + } + + private static S3AsyncClient newS3Client() { + var builder = S3AsyncClient.builder(); + if (ENDPOINT != null && !ENDPOINT.isEmpty()) { + builder.endpointOverride(URI.create(ENDPOINT)).forcePathStyle(true); + } + return builder.build(); + } + } +} diff --git a/features/external_storage/s3_interop/feature.php b/features/external_storage/s3_interop/feature.php new file mode 100644 index 00000000..53be53db --- /dev/null +++ b/features/external_storage/s3_interop/feature.php @@ -0,0 +1,186 @@ + $this->foreign !== null); + if ($this->foreign !== FOREIGN_VALUE) { + throw new ApplicationFailure( + \sprintf('foreign payload is %s, expected %s', $this->foreign, FOREIGN_VALUE), + 'Mismatch', + true, + ); + } + + return $value; + } + + #[SignalMethod(SIGNAL)] + public function foreign(string $value): void + { + $this->foreign = $value; + } +} + +class FeatureChecker +{ + #[Check] + public static function check(ServiceClientInterface $serviceClient, State $runtime, Feature $feature): void + { + $bucket = (string) \getenv('TEMPORAL_FEATURES_S3_BUCKET'); + if ($bucket === '') { + throw new SkipTest('TEMPORAL_FEATURES_S3_BUCKET is not set'); + } + + $s3 = self::s3Client(); + $s3->putObject(['Bucket' => $bucket, 'Key' => FOREIGN_KEY, 'Body' => \base64_decode(FOREIGN_PAYLOAD)]); + + $client = WorkflowClient::create( + $serviceClient, + (new ClientOptions()) + ->withNamespace($runtime->namespace) + ->withExternalStorage(new ExternalStorage([new S3StorageDriver(new AwsS3Client($s3), $bucket)])), + ); + $stub = $client->newUntypedWorkflowStub( + 'Workflow', + WorkflowOptions::new() + ->withTaskQueue($feature->taskQueue) + ->withWorkflowExecutionTimeout('1 minute'), + ); + $client->start($stub, INPUT); + $execution = new WorkflowExecution([ + 'workflow_id' => $stub->getExecution()->getID(), + 'run_id' => (string) $stub->getExecution()->getRunID(), + ]); + + $reference = new ExternalStorageReference([ + 'driver_name' => DRIVER_NAME, + 'claim_data' => [ + 'bucket' => $bucket, + 'key' => FOREIGN_KEY, + 'hash_algorithm' => 'sha256', + 'hash_value' => FOREIGN_HASH, + ], + ]); + $serviceClient->SignalWorkflowExecution( + (new SignalWorkflowExecutionRequest()) + ->setNamespace($runtime->namespace) + ->setWorkflowExecution($execution) + ->setSignalName(SIGNAL) + ->setInput(new Payloads(['payloads' => [new Payload([ + 'metadata' => ['encoding' => 'json/protobuf', 'messageType' => REFERENCE_TYPE], + 'data' => $reference->serializeToJsonString(), + ])]])), + ); + + Assert::same($stub->getResult('string'), INPUT); + + $history = $serviceClient->GetWorkflowExecutionHistory( + (new GetWorkflowExecutionHistoryRequest()) + ->setNamespace($runtime->namespace) + ->setExecution($execution), + )->getHistory(); + $started = $completed = null; + foreach ($history->getEvents() as $event) { + $started ??= $event->getWorkflowExecutionStartedEventAttributes(); + $completed ??= $event->getWorkflowExecutionCompletedEventAttributes(); + } + Assert::notNull($started); + Assert::notNull($completed); + + $prefix = \sprintf( + 'v0/ns/%s/wt/%s/wi/%s', + $runtime->namespace, + $started->getWorkflowType()->getName(), + $execution->getWorkflowId(), + ); + $inputKey = $prefix . '/ri/null/d/sha256/' . INPUT_HASH; + self::checkReference($started->getInput()->getPayloads()[0], $bucket, $inputKey); + self::checkReference( + $completed->getResult()->getPayloads()[0], + $bucket, + $prefix . '/ri/' . $execution->getRunId() . '/d/sha256/' . INPUT_HASH, + ); + + $object = (string) $s3->getObject(['Bucket' => $bucket, 'Key' => $inputKey])['Body']; + Assert::same(\hash('sha256', $object), INPUT_HASH); + } + + private static function checkReference(Payload $payload, string $bucket, string $key): void + { + Assert::same($payload->getMetadata()['encoding'], 'json/protobuf'); + Assert::same($payload->getMetadata()['messageType'], REFERENCE_TYPE); + Assert::count($payload->getExternalPayloads(), 1); + + $reference = new ExternalStorageReference(); + $reference->mergeFromJsonString($payload->getData(), true); + Assert::same($reference->getDriverName(), DRIVER_NAME); + $claimData = \iterator_to_array($reference->getClaimData()); + \ksort($claimData); + Assert::same($claimData, [ + 'bucket' => $bucket, + 'hash_algorithm' => 'sha256', + 'hash_value' => INPUT_HASH, + 'key' => $key, + ]); + } + + private static function s3Client(): S3Client + { + $config = [ + 'region' => \getenv('AWS_REGION') ?: 'us-east-1', + 'version' => 'latest', + ]; + $endpoint = (string) \getenv('TEMPORAL_FEATURES_S3_ENDPOINT'); + if ($endpoint !== '') { + $config['endpoint'] = $endpoint; + $config['use_path_style_endpoint'] = true; + } + + return new S3Client($config); + } +} diff --git a/features/features.go b/features/features.go index 50b45dc0..233b8645 100644 --- a/features/features.go +++ b/features/features.go @@ -33,6 +33,7 @@ import ( deployment_versioning_routing_with_ramp "github.com/temporalio/features/features/deployment_versioning/routing_with_ramp" eager_activity_non_remote_activities_worker "github.com/temporalio/features/features/eager_activity/non_remote_activities_worker" eager_workflow_successful_start "github.com/temporalio/features/features/eager_workflow/successful_start" + external_storage_s3_interop "github.com/temporalio/features/features/external_storage/s3_interop" nexus_async_cancellation "github.com/temporalio/features/features/nexus/async_cancellation" nexus_async_success "github.com/temporalio/features/features/nexus/async_success" nexus_parallel_sync_operations "github.com/temporalio/features/features/nexus/parallel_sync_operations" @@ -110,6 +111,7 @@ func init() { deployment_versioning_routing_with_ramp.Feature, eager_activity_non_remote_activities_worker.Feature, eager_workflow_successful_start.Feature, + external_storage_s3_interop.Feature, nexus_async_cancellation.Feature, nexus_async_success.Feature, nexus_parallel_sync_operations.Feature, diff --git a/features/go.mod b/features/go.mod index 04f61c93..158702fd 100644 --- a/features/go.mod +++ b/features/go.mod @@ -4,6 +4,7 @@ go 1.26.0 require ( cloud.google.com/go/storage v1.57.2 + github.com/aws/aws-sdk-go-v2 v1.41.5 github.com/aws/aws-sdk-go-v2/config v1.32.14 github.com/aws/aws-sdk-go-v2/service/s3 v1.99.0 github.com/google/uuid v1.6.0 @@ -36,7 +37,6 @@ require ( github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.33.0 // indirect github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/metric v0.53.0 // indirect github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/resourcemapping v0.53.0 // indirect - github.com/aws/aws-sdk-go-v2 v1.41.5 // indirect github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.8 // indirect github.com/aws/aws-sdk-go-v2/credentials v1.19.14 // indirect github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.21 // indirect diff --git a/go.mod b/go.mod index c46a7716..a2b2eb88 100644 --- a/go.mod +++ b/go.mod @@ -17,6 +17,25 @@ require ( ) require ( + github.com/aws/aws-sdk-go-v2 v1.41.5 // indirect + github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.8 // indirect + github.com/aws/aws-sdk-go-v2/config v1.32.14 // indirect + github.com/aws/aws-sdk-go-v2/credentials v1.19.14 // indirect + github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.21 // indirect + github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.21 // indirect + github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.21 // indirect + github.com/aws/aws-sdk-go-v2/internal/ini v1.8.6 // indirect + github.com/aws/aws-sdk-go-v2/internal/v4a v1.4.22 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.7 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.9.13 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.21 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.19.21 // indirect + github.com/aws/aws-sdk-go-v2/service/s3 v1.99.0 // indirect + github.com/aws/aws-sdk-go-v2/service/signin v1.0.9 // indirect + github.com/aws/aws-sdk-go-v2/service/sso v1.30.15 // indirect + github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.19 // indirect + github.com/aws/aws-sdk-go-v2/service/sts v1.41.10 // indirect + github.com/aws/smithy-go v1.24.2 // indirect github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/facebookgo/clock v0.0.0-20150410010913-600d898af40a // indirect @@ -33,6 +52,8 @@ require ( github.com/twmb/murmur3 v1.1.8 // indirect github.com/uber-go/tally/v4 v4.1.7 // indirect github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect + go.temporal.io/sdk/contrib/aws/s3driver v0.1.1 // indirect + go.temporal.io/sdk/contrib/aws/s3driver/awssdkv2 v0.1.1 // indirect go.temporal.io/sdk/contrib/tally v0.2.0 // indirect go.uber.org/atomic v1.11.0 // indirect go.uber.org/multierr v1.11.0 // indirect diff --git a/go.sum b/go.sum index c08fa51e..0d32d61d 100644 --- a/go.sum +++ b/go.sum @@ -8,6 +8,44 @@ github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRF github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= +github.com/aws/aws-sdk-go-v2 v1.41.5 h1:dj5kopbwUsVUVFgO4Fi5BIT3t4WyqIDjGKCangnV/yY= +github.com/aws/aws-sdk-go-v2 v1.41.5/go.mod h1:mwsPRE8ceUUpiTgF7QmQIJ7lgsKUPQOUl3o72QBrE1o= +github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.8 h1:eBMB84YGghSocM7PsjmmPffTa+1FBUeNvGvFou6V/4o= +github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.8/go.mod h1:lyw7GFp3qENLh7kwzf7iMzAxDn+NzjXEAGjKS2UOKqI= +github.com/aws/aws-sdk-go-v2/config v1.32.14 h1:opVIRo/ZbbI8OIqSOKmpFaY7IwfFUOCCXBsUpJOwDdI= +github.com/aws/aws-sdk-go-v2/config v1.32.14/go.mod h1:U4/V0uKxh0Tl5sxmCBZ3AecYny4UNlVmObYjKuuaiOo= +github.com/aws/aws-sdk-go-v2/credentials v1.19.14 h1:n+UcGWAIZHkXzYt87uMFBv/l8THYELoX6gVcUvgl6fI= +github.com/aws/aws-sdk-go-v2/credentials v1.19.14/go.mod h1:cJKuyWB59Mqi0jM3nFYQRmnHVQIcgoxjEMAbLkpr62w= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.21 h1:NUS3K4BTDArQqNu2ih7yeDLaS3bmHD0YndtA6UP884g= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.21/go.mod h1:YWNWJQNjKigKY1RHVJCuupeWDrrHjRqHm0N9rdrWzYI= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.21 h1:Rgg6wvjjtX8bNHcvi9OnXWwcE0a2vGpbwmtICOsvcf4= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.21/go.mod h1:A/kJFst/nm//cyqonihbdpQZwiUhhzpqTsdbhDdRF9c= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.21 h1:PEgGVtPoB6NTpPrBgqSE5hE/o47Ij9qk/SEZFbUOe9A= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.21/go.mod h1:p+hz+PRAYlY3zcpJhPwXlLC4C+kqn70WIHwnzAfs6ps= +github.com/aws/aws-sdk-go-v2/internal/ini v1.8.6 h1:qYQ4pzQ2Oz6WpQ8T3HvGHnZydA72MnLuFK9tJwmrbHw= +github.com/aws/aws-sdk-go-v2/internal/ini v1.8.6/go.mod h1:O3h0IK87yXci+kg6flUKzJnWeziQUKciKrLjcatSNcY= +github.com/aws/aws-sdk-go-v2/internal/v4a v1.4.22 h1:rWyie/PxDRIdhNf4DzRk0lvjVOqFJuNnO8WwaIRVxzQ= +github.com/aws/aws-sdk-go-v2/internal/v4a v1.4.22/go.mod h1:zd/JsJ4P7oGfUhXn1VyLqaRZwPmZwg44Jf2dS84Dm3Y= +github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.7 h1:5EniKhLZe4xzL7a+fU3C2tfUN4nWIqlLesfrjkuPFTY= +github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.7/go.mod h1:x0nZssQ3qZSnIcePWLvcoFisRXJzcTVvYpAAdYX8+GI= +github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.9.13 h1:JRaIgADQS/U6uXDqlPiefP32yXTda7Kqfx+LgspooZM= +github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.9.13/go.mod h1:CEuVn5WqOMilYl+tbccq8+N2ieCy0gVn3OtRb0vBNNM= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.21 h1:c31//R3xgIJMSC8S6hEVq+38DcvUlgFY0FM6mSI5oto= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.21/go.mod h1:r6+pf23ouCB718FUxaqzZdbpYFyDtehyZcmP5KL9FkA= +github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.19.21 h1:ZlvrNcHSFFWURB8avufQq9gFsheUgjVD9536obIknfM= +github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.19.21/go.mod h1:cv3TNhVrssKR0O/xxLJVRfd2oazSnZnkUeTf6ctUwfQ= +github.com/aws/aws-sdk-go-v2/service/s3 v1.99.0 h1:hlSuz394kV0vhv9drL5lhuEFbEOEP1VyQpy15qWh1Pk= +github.com/aws/aws-sdk-go-v2/service/s3 v1.99.0/go.mod h1:uoA43SdFwacedBfSgfFSjjCvYe8aYBS7EnU5GZ/YKMM= +github.com/aws/aws-sdk-go-v2/service/signin v1.0.9 h1:QKZH0S178gCmFEgst8hN0mCX1KxLgHBKKY/CLqwP8lg= +github.com/aws/aws-sdk-go-v2/service/signin v1.0.9/go.mod h1:7yuQJoT+OoH8aqIxw9vwF+8KpvLZ8AWmvmUWHsGQZvI= +github.com/aws/aws-sdk-go-v2/service/sso v1.30.15 h1:lFd1+ZSEYJZYvv9d6kXzhkZu07si3f+GQ1AaYwa2LUM= +github.com/aws/aws-sdk-go-v2/service/sso v1.30.15/go.mod h1:WSvS1NLr7JaPunCXqpJnWk1Bjo7IxzZXrZi1QQCkuqM= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.19 h1:dzztQ1YmfPrxdrOiuZRMF6fuOwWlWpD2StNLTceKpys= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.19/go.mod h1:YO8TrYtFdl5w/4vmjL8zaBSsiNp3w0L1FfKVKenZT7w= +github.com/aws/aws-sdk-go-v2/service/sts v1.41.10 h1:p8ogvvLugcR/zLBXTXrTkj0RYBUdErbMnAFFp12Lm/U= +github.com/aws/aws-sdk-go-v2/service/sts v1.41.10/go.mod h1:60dv0eZJfeVXfbT1tFJinbHrDfSJ2GZl4Q//OSSNAVw= +github.com/aws/smithy-go v1.24.2 h1:FzA3bu/nt/vDvmnkg+R8Xl46gmzEDam6mZ1hzmwXFng= +github.com/aws/smithy-go v1.24.2/go.mod h1:YE2RhdIuDbA5E5bTdciG9KrW3+TiEONeUWCqxX9i1Fc= github.com/benbjohnson/clock v1.3.0 h1:ip6w0uFQkncKQ979AypyG0ER7mqUSBdKLOgAle/AT8A= github.com/benbjohnson/clock v1.3.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= @@ -102,6 +140,8 @@ github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFb github.com/grpc-ecosystem/grpc-gateway/v2 v2.22.0 h1:asbCHRVmodnJTuQ3qamDwqVOIjwqUPTYmYuemVOx+Ys= github.com/grpc-ecosystem/grpc-gateway/v2 v2.22.0/go.mod h1:ggCgvZ2r7uOoQjOyu2Y1NhHmEPPzzuhWgcza5M1Ji1I= github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= +github.com/johannesboyne/gofakes3 v0.0.0-20260208201424-4c385a1f6a73 h1:0xkWp+RMC2ImuKacheMHEAtrbOTMOa0kYkxyzM1Z/II= +github.com/johannesboyne/gofakes3 v0.0.0-20260208201424-4c385a1f6a73/go.mod h1:S4S9jGBVlLri0OeqrSSbCGG5vsI6he06UJyuz1WT1EE= github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= @@ -164,6 +204,8 @@ github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDN github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA= github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/ryszard/goskiplist v0.0.0-20150312221310-2dfbae5fcf46 h1:GHRpF1pTW19a8tTFrMLUcfWwyC0pnifVo2ClaLq+hP8= +github.com/ryszard/goskiplist v0.0.0-20150312221310-2dfbae5fcf46/go.mod h1:uAQ5PCi+MFsC7HjREoAz1BU+Mq60+05gifQSsHSDG/8= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= @@ -209,12 +251,18 @@ go.opentelemetry.io/otel/sdk/metric v1.44.0/go.mod h1:5B5pMARnXxKhltooO4xUuCBorl go.opentelemetry.io/otel/trace v1.44.0 h1:jxF5CsGYCe74MCRx2X4g7WsY/VBKRqqpNvXlX/6gtIk= go.opentelemetry.io/otel/trace v1.44.0/go.mod h1:oLl1jrMQAVo6v3GAggN+1VH9VIz9iUSvW53sW1Q8PIE= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= +go.shabbyrobe.org/gocovmerge v0.0.0-20230507111327-fa4f82cfbf4d h1:Ns9kd1Rwzw7t0BR8XMphenji4SmIoNZPn8zhYmaVKP8= +go.shabbyrobe.org/gocovmerge v0.0.0-20230507111327-fa4f82cfbf4d/go.mod h1:92Uoe3l++MlthCm+koNi0tcUCX3anayogF0Pa/sp24k= go.temporal.io/api v1.5.0/go.mod h1:BqKxEJJYdxb5dqf0ODfzfMxh8UEQ5L3zKS51FiIYYkA= go.temporal.io/api v1.64.3 h1:Q2oP9jVB5pSputb2j3BLAEjJsi8A2tSzMojqcSGyga0= go.temporal.io/api v1.64.3/go.mod h1:acM0I9WPuYg8W3Pd9jOZvEgi7mRUttUQ4+e7fowKVnM= go.temporal.io/sdk v1.12.0/go.mod h1:lSp3lH1lI0TyOsus0arnO3FYvjVXBZGi/G7DjnAnm6o= go.temporal.io/sdk v1.51.0 h1:RsEghFfg91qWgNaecRgPrms9TA7iXskSzSQO2BwhJRs= go.temporal.io/sdk v1.51.0/go.mod h1:Gj2KwnQAlMhPRSX1RoqV3Zez8Y0U+6dCGxn1sg+j9kg= +go.temporal.io/sdk/contrib/aws/s3driver v0.1.1 h1:cV0nhvb5rTDxP06L3XVAqwTSgFDXFVBFaA3b9dQl4rk= +go.temporal.io/sdk/contrib/aws/s3driver v0.1.1/go.mod h1:/sYQljwSaVsL5bjdLeehUfKFlzA3y4jvbLShNv4PZ5Q= +go.temporal.io/sdk/contrib/aws/s3driver/awssdkv2 v0.1.1 h1:qNEdOWhbn+SeceOoCdd+WatLbIXFSuJa5EmiWhgH2F4= +go.temporal.io/sdk/contrib/aws/s3driver/awssdkv2 v0.1.1/go.mod h1:xAZx5FRbvG1MHG1TIhjcTiVnUdTSDyPHenbjWTQv4eA= go.temporal.io/sdk/contrib/tally v0.2.0 h1:XnTJIQcjOv+WuCJ1u8Ve2nq+s2H4i/fys34MnWDRrOo= go.temporal.io/sdk/contrib/tally v0.2.0/go.mod h1:1kpSuCms/tHeJQDPuuKkaBsMqfHnIIRnCtUYlPNXxuE= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= @@ -319,6 +367,8 @@ golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roY golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/tools v0.48.0 h1:3+hClM1aLL5mjMKm5ovokw9epgRXPuu2tILgismM6RE= +golang.org/x/tools v0.48.0/go.mod h1:08xX0orndb/F7jJxGDicx061tyd5pcMto75YMAXr6lk= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/harness/java/io/temporal/sdkfeatures/PreparedFeature.java b/harness/java/io/temporal/sdkfeatures/PreparedFeature.java index 650d2b31..cbae5de5 100644 --- a/harness/java/io/temporal/sdkfeatures/PreparedFeature.java +++ b/harness/java/io/temporal/sdkfeatures/PreparedFeature.java @@ -23,6 +23,7 @@ public class PreparedFeature { data_converter.json.feature.Impl.class, data_converter.json_protobuf.feature.Impl.class, eager_activity.non_remote_activities_worker.feature.Impl.class, + external_storage.s3_interop.feature.Impl.class, nexus.async_cancellation.feature.Impl.class, nexus.async_success.feature.Impl.class, nexus.parallel_sync_operations.feature.Impl.class, diff --git a/harness/php/composer.json b/harness/php/composer.json index f2ddb5a7..d4f888ee 100644 --- a/harness/php/composer.json +++ b/harness/php/composer.json @@ -6,6 +6,7 @@ "license": "MIT", "require": { "php": "^8.2", + "aws/aws-sdk-php": "^3.300", "buggregator/trap": "^1.9", "spiral/core": "^3.13", "symfony/process": ">=6.4", diff --git a/harness/php/src/Runtime/Runner.php b/harness/php/src/Runtime/Runner.php index 0f0fc829..6ce1fc59 100644 --- a/harness/php/src/Runtime/Runner.php +++ b/harness/php/src/Runtime/Runner.php @@ -43,6 +43,21 @@ public function start(): void $run->tlsCert === null or $rrCommand = [...$rrCommand, '-o', "temporal.tls.cert={$run->tlsCert}"]; $run->tlsCaCert === null or $rrCommand = [...$rrCommand, '-o', "temporal.tls.ca-cert={$run->tlsCaCert}"]; + $s3Bucket = (string) \getenv('TEMPORAL_FEATURES_S3_BUCKET'); + if ($s3Bucket !== '') { + $rrCommand = [...$rrCommand, '-o', "temporal.external_storage.s3.bucket={$s3Bucket}"]; + $s3Endpoint = (string) \getenv('TEMPORAL_FEATURES_S3_ENDPOINT'); + if ($s3Endpoint !== '') { + $rrCommand = [ + ...$rrCommand, + '-o', + "temporal.external_storage.s3.endpoint={$s3Endpoint}", + '-o', + 'temporal.external_storage.s3.force_path_style=true', + ]; + } + } + $this->process = new Process($rrCommand); $this->process->setTimeout(null); $this->process->start();