Skip to content
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
51d210f
Add gradle task to update submodule and update proto to latest version
YunchuWang Jan 23, 2025
8660f1b
bump build pipeline github action version to non deprecated version
YunchuWang Jan 23, 2025
8a54ce4
initial dts support changes
YunchuWang Jan 23, 2025
f951428
placeholder
YunchuWang Jan 23, 2025
12e9e50
ignore
YunchuWang Jan 23, 2025
3b09d59
update
YunchuWang Jan 23, 2025
32eca1e
remove
YunchuWang Jan 23, 2025
ea2e181
update
YunchuWang Jan 23, 2025
e025538
update
YunchuWang Jan 23, 2025
6ea3a65
update
YunchuWang Jan 23, 2025
2270ed2
signing is disabled, should not exclude as there is no sign
YunchuWang Jan 23, 2025
9a02b23
save
YunchuWang Jan 29, 2025
8fb193f
feedback changes
YunchuWang Jan 29, 2025
a51ba86
delete legacy lib/java
YunchuWang Jan 29, 2025
7241e34
create skeleton project for pkg "com.microsoft.durabletask-azuremanaged"
YunchuWang Jan 29, 2025
8688320
split pkg in progress
YunchuWang Mar 14, 2025
628c093
move out
YunchuWang Mar 18, 2025
a7e8d19
progress
YunchuWang Mar 18, 2025
ab89785
p
YunchuWang Mar 18, 2025
6fc0748
progress
YunchuWang Mar 18, 2025
e3406d7
progress
YunchuWang Mar 18, 2025
110306e
fix
YunchuWang Mar 18, 2025
b7a88af
p
YunchuWang Mar 18, 2025
1b7fe1c
save
YunchuWang Mar 19, 2025
b74d699
save
YunchuWang Mar 19, 2025
f6611af
save
YunchuWang Mar 19, 2025
03df094
save
YunchuWang Mar 19, 2025
3cd3598
clientoptions done
YunchuWang Mar 19, 2025
357ecdd
client ext
YunchuWang Mar 19, 2025
df4a0e4
client refactored
YunchuWang Mar 19, 2025
0f79297
worker done
YunchuWang Mar 19, 2025
c7eb4f1
sample update
YunchuWang Mar 19, 2025
aa94d9c
fix
YunchuWang Mar 19, 2025
02f92ea
save
YunchuWang Mar 19, 2025
2b9d8eb
fix
YunchuWang Mar 19, 2025
3eca075
cleanup
YunchuWang Mar 19, 2025
6e9a6e8
cleanup
YunchuWang Mar 19, 2025
2f2a359
Merge branch 'main' into wangbill/update-proto
YunchuWang Mar 20, 2025
41ef360
Merge branch 'main' into wangbill/update-proto
YunchuWang Mar 20, 2025
d9e20ec
unit tests
YunchuWang Mar 20, 2025
f59af6b
Update Gradle build command to include stacktrace option for better d…
YunchuWang Mar 20, 2025
f7c5376
cleanup
YunchuWang Mar 20, 2025
538033c
Enhance build validation workflow to handle build failures by uploadi…
YunchuWang Mar 20, 2025
bb1fbb1
Update PATH_TO_TEST_JAVA_RUNTIME in build.gradle files to use environ…
YunchuWang Mar 21, 2025
637863c
Revert "Update PATH_TO_TEST_JAVA_RUNTIME in build.gradle files to use…
YunchuWang Mar 21, 2025
8d530cb
separate build and unit tests
YunchuWang Mar 21, 2025
5f3ebfb
use jdk11 for unit tests
YunchuWang Mar 21, 2025
02ec66d
update sample
YunchuWang Mar 21, 2025
f23edcc
clean up
YunchuWang Mar 21, 2025
299ab73
rename azuremanaged module names to avoid colliding module names name…
YunchuWang Mar 21, 2025
8cf6cdb
update azure managed to one package
YunchuWang Mar 21, 2025
1bebf5a
conn str support
YunchuWang Mar 23, 2025
98cf7eb
changelog
YunchuWang Mar 23, 2025
8705055
Add support for Visual Studio Code and Interactive Browser authentica…
YunchuWang Mar 24, 2025
ad72eca
Add support for IntelliJ authentication type in DurableTaskSchedulerC…
YunchuWang Mar 24, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 4 additions & 10 deletions .github/workflows/build-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ jobs:

steps:
- uses: actions/checkout@v2
with:
submodules: true

- name: Set up JDK 11
uses: actions/setup-java@v2
Expand Down Expand Up @@ -58,13 +56,13 @@ jobs:
run: ./gradlew integrationTest

- name: Archive test report
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: Integration test report
path: client/build/reports/tests/integrationTest

- name: Upload JAR output
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: Package
path: client/build/libs
Expand All @@ -76,8 +74,6 @@ jobs:

steps:
- uses: actions/checkout@v2
with:
submodules: true

- name: Set up JDK 8
uses: actions/setup-java@v2
Expand Down Expand Up @@ -105,7 +101,7 @@ jobs:
arguments: endToEndTest

- name: Archive test report
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: Integration test report
path: client/build/reports/tests/endToEndTest
Expand All @@ -117,8 +113,6 @@ jobs:

steps:
- uses: actions/checkout@v2
with:
submodules: true

- name: Set up JDK 8
uses: actions/setup-java@v2
Expand Down Expand Up @@ -146,7 +140,7 @@ jobs:
arguments: sampleTest

- name: Archive test report
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: Integration test report
path: client/build/reports/tests/endToEndTest
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,7 @@ build/
.project
.settings
.classpath
repo/
repo/

# Ignore sample application properties or any other properties files used for sample
samples/src/main/resources/*.properties
3 changes: 0 additions & 3 deletions .gitmodules

This file was deleted.

1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
## placeholder
* Add automatic proto file download and commit hash tracking during build ([#TBD](https://github.com/microsoft/durabletask-java/pull/TBD))
* Fix infinite loop when use continueasnew after wait external event ([#183](https://github.com/microsoft/durabletask-java/pull/183))
* Fix the issue "Deserialize Exception got swallowed when use anyOf with external event." ([#185](https://github.com/microsoft/durabletask-java/pull/185))

Expand Down
1 change: 0 additions & 1 deletion azdevops-pipeline/build-release-artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ pool:

steps:
- checkout: self
submodules: true

- task: Gradle@3
inputs:
Expand Down
26 changes: 25 additions & 1 deletion client/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ dependencies {
implementation "com.fasterxml.jackson.core:jackson-annotations:${jacksonVersion}"
implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:${jacksonVersion}"

implementation 'com.azure:azure-identity:1.15.0'

testImplementation(platform('org.junit:junit-bom:5.7.2'))
testImplementation('org.junit.jupiter:junit-jupiter')
}
Expand All @@ -49,20 +51,42 @@ compileTestJava {
options.forkOptions.executable = "${PATH_TO_TEST_JAVA_RUNTIME}/bin/javac"
}

task downloadProtoFiles {
doLast {
def protoDir = file("${rootProject.projectDir}/internal/durabletask-protobuf/protos")
protoDir.mkdirs()

// Download the proto file
new URL('https://raw.githubusercontent.com/microsoft/durabletask-protobuf/main/protos/orchestrator_service.proto')
.withInputStream { i ->
new File(protoDir, 'orchestrator_service.proto').withOutputStream { it << i }
}

// Get and save the commit hash
def commitHashFile = new File("${rootProject.projectDir}/internal/durabletask-protobuf/PROTO_SOURCE_COMMIT_HASH")
def commitApiUrl = new URL('https://api.github.com/repos/microsoft/durabletask-protobuf/commits?path=protos/orchestrator_service.proto&sha=main&per_page=1')
def connection = commitApiUrl.openConnection()
connection.setRequestProperty('Accept', 'application/vnd.github.v3+json')
def commitHash = new groovy.json.JsonSlurper().parse(connection.inputStream)[0].sha
commitHashFile.text = commitHash
}
}

protobuf {
protoc { artifact = "com.google.protobuf:protoc:${protocVersion}" }
plugins {
grpc { artifact = "io.grpc:protoc-gen-grpc-java:${grpcVersion}" }
}
generateProtoTasks {
all()*.plugins { grpc {} }
all()*.dependsOn downloadProtoFiles
}
}

sourceSets {
main {
proto {
srcDir '../submodules/durabletask-protobuf/protos'
srcDir '../internal/durabletask-protobuf/protos'
}
java {
srcDirs 'build/generated/source/proto/main/grpc'
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package com.microsoft.durabletask;

import com.azure.core.credential.TokenCredential;
import com.azure.core.credential.AccessToken;
import com.azure.core.credential.TokenRequestContext;

import java.time.Duration;
import java.time.OffsetDateTime;

public final class AccessTokenCache {
private final TokenCredential credential;
private final TokenRequestContext context;
private final Duration margin;
private AccessToken cachedToken;

public AccessTokenCache(TokenCredential credential, TokenRequestContext context, Duration margin) {
this.credential = credential;
this.context = context;
this.margin = margin;
}

public AccessToken getToken() {
OffsetDateTime nowWithMargin = OffsetDateTime.now().plus(margin);

if (cachedToken == null
|| cachedToken.getExpiresAt().isBefore(nowWithMargin)) {
this.cachedToken = credential.getToken(context).block();
}

return cachedToken;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ public void startAndBlock() {
.setInstanceId(orchestratorRequest.getInstanceId())
.addAllActions(taskOrchestratorResult.getActions())
.setCustomStatus(StringValue.of(taskOrchestratorResult.getCustomStatus()))
.setCompletionToken(workItem.getCompletionToken())
.build();

this.sidecarClient.completeOrchestratorTask(response);
Expand All @@ -164,7 +165,8 @@ public void startAndBlock() {

ActivityResponse.Builder responseBuilder = ActivityResponse.newBuilder()
.setInstanceId(activityRequest.getOrchestrationInstance().getInstanceId())
.setTaskId(activityRequest.getTaskId());
.setTaskId(activityRequest.getTaskId())
.setCompletionToken(workItem.getCompletionToken());

if (output != null) {
responseBuilder.setResult(StringValue.of(output));
Expand Down
1 change: 0 additions & 1 deletion eng/templates/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ jobs:

steps:
- checkout: self
submodules: true

- task: Gradle@3
inputs:
Expand Down
21 changes: 21 additions & 0 deletions internal/durabletask-protobuf/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) Microsoft Corporation.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE
1 change: 1 addition & 0 deletions internal/durabletask-protobuf/PROTO_SOURCE_COMMIT_HASH
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
443b333f4f65a438dc9eb4f090560d232afec4b7
52 changes: 52 additions & 0 deletions internal/durabletask-protobuf/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Durable Task Protobuf Files

This directory contains the protocol buffer definitions used by the Durable Task Framework Java SDK. The files in this directory are automatically downloaded and updated during the build process from the [microsoft/durabletask-protobuf](https://github.com/microsoft/durabletask-protobuf) repository.

## Directory Structure

- `protos/` - Contains the downloaded proto files
- `PROTO_SOURCE_COMMIT_HASH` - Contains the commit hash of the latest proto file version

## Auto-Update Process

The proto files are automatically downloaded and updated when running Gradle builds. This is handled by the `downloadProtoFiles` task in the `client/build.gradle` file. The task:

1. Downloads the latest version of `orchestrator_service.proto`
2. Saves the current commit hash for tracking purposes
3. Updates these files before proto compilation begins

## Manual Update

If you need to manually update the proto files, you can run:

```bash
./gradlew downloadProtoFiles
```

# Durable Task Protobuf Definitions

This repo contains [protocol buffer](https://developers.google.com/protocol-buffers) (protobuf) definitions
used by the Durable Task framework sidecar architecture. It's recommended that Durable Task language SDKs reference
the protobuf contracts in this repo via [Git submodules](https://git-scm.com/book/en/v2/Git-Tools-Submodules).

## Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a
Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us
the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.

When you submit a pull request, a CLA bot will automatically determine whether you need to provide
a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions
provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or
contact [[email protected]](mailto:[email protected]) with any additional questions or comments.

## Trademarks

This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft
trademarks or logos is subject to and must follow
[Microsoft's Trademark & Brand Guidelines](https://www.microsoft.com/legal/intellectualproperty/trademarks/usage/general).
Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship.
Any use of third-party trademarks or logos are subject to those third-party's policies.
6 changes: 6 additions & 0 deletions internal/durabletask-protobuf/lib/java/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#
# https://help.github.com/articles/dealing-with-line-endings/
#
# These are explicitly windows files and should use crlf
*.bat text eol=crlf

5 changes: 5 additions & 0 deletions internal/durabletask-protobuf/lib/java/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Ignore Gradle project-specific cache directory
.gradle

# Ignore Gradle build output directory
build
52 changes: 52 additions & 0 deletions internal/durabletask-protobuf/lib/java/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
plugins {
id 'com.google.protobuf' version '0.8.16'
id 'java-library'
}

repositories {
mavenCentral()
}

version = '0.1.0'
archivesBaseName = 'durabletask-grpc'

sourceCompatibility = 1.8
targetCompatibility = 1.8

def grpcVersion = '1.46.0'
def protobufVersion = '3.12.0'
def protocVersion = protobufVersion

dependencies {
implementation "io.grpc:grpc-protobuf:${grpcVersion}"
implementation "io.grpc:grpc-stub:${grpcVersion}"
compileOnly "org.apache.tomcat:annotations-api:6.0.53"

runtimeOnly "io.grpc:grpc-netty-shaded:${grpcVersion}"

testImplementation "io.grpc:grpc-testing:${grpcVersion}"
testImplementation "junit:junit:4.12"
testImplementation "org.mockito:mockito-core:3.4.0"
}

protobuf {
protoc { artifact = "com.google.protobuf:protoc:${protocVersion}" }
plugins {
grpc { artifact = "io.grpc:protoc-gen-grpc-java:${grpcVersion}" }
}
generateProtoTasks {
all()*.plugins { grpc {} }
}
}

sourceSets {
main {
proto {
srcDir '../../protos'
}
java {
srcDirs 'build/generated/source/proto/main/grpc'
srcDirs 'build/generated/source/proto/main/java'
}
}
}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading
Loading