Skip to content

Commit 9747273

Browse files
authored
Merge branch 'master' into feature/jobs-api
2 parents a966fbd + be0e56b commit 9747273

File tree

1,317 files changed

+4637
-4333
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,317 files changed

+4637
-4333
lines changed

.github/scripts/create-release.sh

+24-24
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,12 @@ if [ "$VARIANT" = "SNAPSHOT" ]; then
4242
git checkout -b $branch_name
4343
${script_dir}/update_sdk_version.sh $REL_VERSION
4444
git clean -xdf
45-
git commit -s -m "Update master version to ${$REL_VERSION}" -a
45+
git commit -s -m "Update master version to ${REL_VERSION}" -a
4646
git push origin $branch_name
4747
gh pr create --repo ${GITHUB_REPOSITORY} \
4848
--base master \
49-
--title "Update master version to ${$REL_VERSION}" \
50-
--body "Update master version to ${$REL_VERSION}"
49+
--title "Update master version to ${REL_VERSION}" \
50+
--body "Update master version to ${REL_VERSION}"
5151
echo "Done."
5252
exit 0
5353
elif [ "$VARIANT" = "rc" ]; then
@@ -84,38 +84,38 @@ fi
8484
echo "$RELEASE_BRANCH branch is ready."
8585

8686
if [ `git rev-parse --verify $RELEASE_TAG 2>/dev/null` ]; then
87-
echo "$RELEASE_TAG tag already exists, aborting ..."
88-
exit 2
89-
fi
90-
91-
${script_dir}/update_sdk_version.sh $REL_VERSION
92-
git commit -s -m "Release $REL_VERSION" -a
93-
if [ "$VARIANT" = "" ]; then
94-
echo "Generating docs ..."
95-
${script_dir}/update_docs.sh $REL_VERSION
96-
git commit -s -m "Generate updated javadocs for $REL_VERSION" -a
97-
fi
98-
git push origin $RELEASE_BRANCH
87+
echo "$RELEASE_TAG tag already exists, checking it out ..."
88+
git checkout $RELEASE_TAG
89+
else
90+
${script_dir}/update_sdk_version.sh $REL_VERSION
91+
git commit -s -m "Release $REL_VERSION" -a
92+
if [ "$VARIANT" = "" ]; then
93+
echo "Generating docs ..."
94+
${script_dir}/update_docs.sh $REL_VERSION
95+
git commit -s -m "Generate updated javadocs for $REL_VERSION" -a
96+
fi
97+
git push origin $RELEASE_BRANCH
9998

100-
echo "Tagging $RELEASE_TAG ..."
101-
git tag $RELEASE_TAG
102-
echo "$RELEASE_TAG is tagged."
99+
echo "Tagging $RELEASE_TAG ..."
100+
git tag $RELEASE_TAG
101+
echo "$RELEASE_TAG is tagged."
103102

104-
echo "Pushing $RELEASE_TAG tag ..."
105-
git push origin $RELEASE_TAG
106-
echo "$RELEASE_TAG tag is pushed."
103+
echo "Pushing $RELEASE_TAG tag ..."
104+
git push origin $RELEASE_TAG
105+
echo "$RELEASE_TAG tag is pushed."
106+
fi
107107

108108
if [ "$VARIANT" = "" ]; then
109109
git clean -xdf
110110
echo "Creating pull request to update docs ..."
111111
branch_name="automation/update_docs_${current_time}"
112112
git reset --hard origin/master
113-
git cherry-pick $RELEASE_TAG
113+
git cherry-pick --strategy=recursive -X theirs $RELEASE_TAG
114114
git push origin $branch_name
115115
gh pr create --repo ${GITHUB_REPOSITORY} \
116116
--base master \
117-
--title "Update master docs for ${$REL_VERSION} release" \
118-
--body "Update master docs for ${$REL_VERSION} release"
117+
--title "Update master docs for ${REL_VERSION} release" \
118+
--body "Update master docs for ${REL_VERSION} release"
119119
fi
120120

121121
echo "Done."

.github/scripts/update_docs.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,5 @@ rm -f daprdocs/content/en/java-sdk-docs/_index.mdbak || echo
2727
rm -f daprdocs/content/en/java-sdk-docs/spring-boot/_index.md/_index.mdbak || echo
2828

2929
rm -rf docs
30-
./mvnw -Dmaven.test.skip=false -Djacoco.skip=true clean install
31-
./mvnw site-deploy
30+
./mvnw -Dmaven.test.skip=true -Djacoco.skip=true clean install
31+
./mvnw -Dmaven.test.skip=true -Djacoco.skip=true site-deploy

.github/workflows/create-release.yml

+16-2
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,18 @@ jobs:
2525
create-release:
2626
name: Creates release branch and tag
2727
runs-on: ubuntu-latest
28+
env:
29+
JDK_VER: '17'
2830
steps:
2931
- name: Check out code
3032
uses: actions/checkout@v4
3133
with:
3234
fetch-depth: 0
35+
- name: Set up OpenJDK ${{ env.JDK_VER }}
36+
uses: actions/setup-java@v4
37+
with:
38+
distribution: 'temurin'
39+
java-version: ${{ env.JDK_VER }}
3340
- name: Install required packages
3441
run: |
3542
sudo apt-get update
@@ -50,8 +57,15 @@ jobs:
5057
runs-on: ubuntu-latest
5158
needs: create-release
5259
steps:
53-
- name: Triggers the build
60+
- name: Identify build ref to trigger build and release.
61+
run: |
62+
if [[ "${{ inputs.rel_version }}" == *"SNAPSHOT"* ]]; then
63+
echo "BUILD_GIT_REF=master" >> $GITHUB_ENV
64+
else
65+
echo "BUILD_GIT_REF=v${{ inputs.rel_version }}" >> $GITHUB_ENV
66+
fi
67+
- name: Triggers the build and release.
5468
env:
5569
GITHUB_TOKEN: ${{ secrets.DAPR_BOT_TOKEN }}
5670
run: |
57-
gh workflow run build.yml --repo ${GITHUB_REPOSITORY} --ref v$(echo '${{ inputs.rel_version }}' | sed -r 's/^[vV]?([0-9].+)$/\1/')
71+
gh workflow run build.yml --repo ${GITHUB_REPOSITORY} --ref v$(echo '${{ env.BUILD_GIT_REF }}' | sed -r 's/^[vV]?([0-9].+)$/\1/')

README.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -49,19 +49,19 @@ For a Maven project, add the following to your `pom.xml` file:
4949
<dependency>
5050
<groupId>io.dapr</groupId>
5151
<artifactId>dapr-sdk</artifactId>
52-
<version>1.12.0</version>
52+
<version>1.13.1</version>
5353
</dependency>
5454
<!-- Dapr's SDK for Actors (optional). -->
5555
<dependency>
5656
<groupId>io.dapr</groupId>
5757
<artifactId>dapr-sdk-actors</artifactId>
58-
<version>1.12.0</version>
58+
<version>1.13.1</version>
5959
</dependency>
6060
<!-- Dapr's SDK integration with SpringBoot (optional). -->
6161
<dependency>
6262
<groupId>io.dapr</groupId>
6363
<artifactId>dapr-sdk-springboot</artifactId>
64-
<version>1.12.0</version>
64+
<version>1.13.1</version>
6565
</dependency>
6666
...
6767
</dependencies>
@@ -75,11 +75,11 @@ For a Gradle project, add the following to your `build.gradle` file:
7575
dependencies {
7676
...
7777
// Dapr's core SDK with all features, except Actors.
78-
compile('io.dapr:dapr-sdk:1.12.0')
78+
compile('io.dapr:dapr-sdk:1.13.1')
7979
// Dapr's SDK for Actors (optional).
80-
compile('io.dapr:dapr-sdk-actors:1.12.0')
80+
compile('io.dapr:dapr-sdk-actors:1.13.1')
8181
// Dapr's SDK integration with SpringBoot (optional).
82-
compile('io.dapr:dapr-sdk-springboot:1.12.0')
82+
compile('io.dapr:dapr-sdk-springboot:1.13.1')
8383
}
8484
```
8585

dapr-spring/dapr-spring-boot-autoconfigure/pom.xml

+7-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>io.dapr.spring</groupId>
88
<artifactId>dapr-spring-parent</artifactId>
9-
<version>0.13.0-SNAPSHOT</version>
9+
<version>0.14.0-SNAPSHOT</version>
1010
</parent>
1111

1212
<artifactId>dapr-spring-boot-autoconfigure</artifactId>
@@ -27,6 +27,12 @@
2727
<version>${project.parent.version}</version>
2828
<optional>true</optional>
2929
</dependency>
30+
<dependency>
31+
<groupId>io.dapr.spring</groupId>
32+
<artifactId>dapr-spring-workflows</artifactId>
33+
<version>${project.parent.version}</version>
34+
<optional>true</optional>
35+
</dependency>
3036
<dependency>
3137
<groupId>org.springframework.boot</groupId>
3238
<artifactId>spring-boot-starter</artifactId>

dapr-spring/dapr-spring-boot-autoconfigure/src/main/java/io/dapr/spring/boot/autoconfigure/client/DaprClientAutoConfiguration.java

+30
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,17 @@
1616
import io.dapr.client.DaprClient;
1717
import io.dapr.client.DaprClientBuilder;
1818
import io.dapr.config.Properties;
19+
import io.dapr.workflows.client.DaprWorkflowClient;
20+
import io.dapr.workflows.runtime.WorkflowRuntimeBuilder;
1921
import org.springframework.boot.autoconfigure.AutoConfiguration;
2022
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
2123
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
2224
import org.springframework.boot.context.properties.EnableConfigurationProperties;
2325
import org.springframework.context.annotation.Bean;
2426

27+
import java.util.HashMap;
28+
import java.util.Map;
29+
2530
@AutoConfiguration
2631
@ConditionalOnClass(DaprClient.class)
2732
@EnableConfigurationProperties(DaprClientProperties.class)
@@ -58,4 +63,29 @@ DaprClient daprClient(DaprClientBuilder daprClientBuilder) {
5863
return daprClientBuilder.build();
5964
}
6065

66+
@Bean
67+
@ConditionalOnMissingBean
68+
DaprWorkflowClient daprWorkflowClient(DaprConnectionDetails daprConnectionDetails) {
69+
Properties properties = createPropertiesFromConnectionDetails(daprConnectionDetails);
70+
return new DaprWorkflowClient(properties);
71+
}
72+
73+
@Bean
74+
@ConditionalOnMissingBean
75+
WorkflowRuntimeBuilder daprWorkflowRuntimeBuilder(DaprConnectionDetails daprConnectionDetails) {
76+
Properties properties = createPropertiesFromConnectionDetails(daprConnectionDetails);
77+
return new WorkflowRuntimeBuilder(properties);
78+
}
79+
80+
private Properties createPropertiesFromConnectionDetails(DaprConnectionDetails daprConnectionDetails) {
81+
final Map<String, String> propertyOverrides = new HashMap<>();
82+
propertyOverrides.put(Properties.HTTP_ENDPOINT.getName(), daprConnectionDetails.httpEndpoint());
83+
propertyOverrides.put(Properties.HTTP_PORT.getName(), String.valueOf(daprConnectionDetails.httpPort()));
84+
propertyOverrides.put(Properties.GRPC_ENDPOINT.getName(), daprConnectionDetails.grpcEndpoint());
85+
propertyOverrides.put(Properties.GRPC_PORT.getName(), String.valueOf(daprConnectionDetails.grpcPort()));
86+
return new Properties(propertyOverrides);
87+
}
88+
89+
90+
6191
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
package io.dapr.spring.boot.autoconfigure.client;
2+
3+
import io.dapr.spring.boot.autoconfigure.client.workflows.TestActivity;
4+
import io.dapr.spring.boot.autoconfigure.client.workflows.TestWorkflow;
5+
import io.dapr.workflows.client.DaprWorkflowClient;
6+
import io.dapr.workflows.runtime.WorkflowRuntimeBuilder;
7+
import org.junit.jupiter.api.Test;
8+
import org.springframework.beans.factory.annotation.Autowired;
9+
import org.springframework.boot.test.context.SpringBootTest;
10+
11+
import static org.junit.jupiter.api.Assertions.assertNotNull;
12+
13+
@SpringBootTest(classes = {WorkflowTestApplication.class, DaprClientAutoConfiguration.class, TestActivity.class, TestWorkflow.class})
14+
public class DaprWorkflowsRegistrationTests {
15+
16+
@Autowired
17+
private DaprWorkflowClient daprWorkflowClient;
18+
19+
@Autowired
20+
private WorkflowRuntimeBuilder workflowRuntimeBuilder;
21+
22+
@Autowired
23+
private TestActivity testActivity;
24+
25+
@Autowired
26+
private TestWorkflow testWorkflow;
27+
28+
@Test
29+
public void testWorkflowInjection(){
30+
31+
//I cannot test here if the client works, as it needs the runtime
32+
assertNotNull(daprWorkflowClient);
33+
34+
//@TODO: there is no way to assert the runtime and its registered workflows and activities
35+
assertNotNull(workflowRuntimeBuilder);
36+
37+
//Check that both Activities and Workflows are managed beans
38+
assertNotNull(testActivity);
39+
assertNotNull(testWorkflow);
40+
assertNotNull(testActivity.getRestTemplate());
41+
assertNotNull(testWorkflow.getRestTemplate());
42+
43+
}
44+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package io.dapr.spring.boot.autoconfigure.client;
2+
3+
import io.dapr.spring.workflows.config.EnableDaprWorkflows;
4+
import org.springframework.boot.SpringApplication;
5+
import org.springframework.boot.autoconfigure.SpringBootApplication;
6+
import org.springframework.context.annotation.Bean;
7+
import org.springframework.context.annotation.Configuration;
8+
import org.springframework.web.client.RestTemplate;
9+
10+
@SpringBootApplication
11+
@EnableDaprWorkflows
12+
public class WorkflowTestApplication {
13+
public static void main(String[] args) {
14+
SpringApplication.run(WorkflowTestApplication.class, args);
15+
}
16+
17+
@Configuration
18+
static class Config {
19+
@Bean
20+
RestTemplate restTemplate(){
21+
return new RestTemplate();
22+
}
23+
}
24+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package io.dapr.spring.boot.autoconfigure.client.workflows;
2+
3+
import io.dapr.workflows.WorkflowActivity;
4+
import io.dapr.workflows.WorkflowActivityContext;
5+
import org.springframework.beans.factory.annotation.Autowired;
6+
import org.springframework.web.client.RestTemplate;
7+
8+
public class TestActivity implements WorkflowActivity {
9+
10+
@Autowired
11+
private RestTemplate restTemplate;
12+
13+
@Override
14+
public Object run(WorkflowActivityContext ctx) {
15+
return "OK";
16+
}
17+
18+
public RestTemplate getRestTemplate() {
19+
return restTemplate;
20+
}
21+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package io.dapr.spring.boot.autoconfigure.client.workflows;
2+
3+
import io.dapr.workflows.Workflow;
4+
import io.dapr.workflows.WorkflowStub;
5+
import org.springframework.beans.factory.annotation.Autowired;
6+
import org.springframework.web.client.RestTemplate;
7+
8+
public class TestWorkflow implements Workflow {
9+
10+
@Autowired
11+
private RestTemplate restTemplate;
12+
13+
@Override
14+
public WorkflowStub create() {
15+
return ctx -> {
16+
ctx.callActivity(TestActivity.class.getName(), null).await();
17+
};
18+
}
19+
20+
public RestTemplate getRestTemplate() {
21+
return restTemplate;
22+
}
23+
}

dapr-spring/dapr-spring-boot-starters/dapr-spring-boot-starter-test/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>io.dapr.spring</groupId>
88
<artifactId>dapr-spring-parent</artifactId>
9-
<version>0.13.0-SNAPSHOT</version>
9+
<version>0.14.0-SNAPSHOT</version>
1010
<relativePath>../../pom.xml</relativePath>
1111
</parent>
1212

dapr-spring/dapr-spring-boot-starters/dapr-spring-boot-starter/pom.xml

+6-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>io.dapr.spring</groupId>
88
<artifactId>dapr-spring-parent</artifactId>
9-
<version>0.13.0-SNAPSHOT</version>
9+
<version>0.14.0-SNAPSHOT</version>
1010
<relativePath>../../pom.xml</relativePath>
1111
</parent>
1212

@@ -40,6 +40,11 @@
4040
<artifactId>dapr-spring-messaging</artifactId>
4141
<version>${project.parent.version}</version>
4242
</dependency>
43+
<dependency>
44+
<groupId>io.dapr.spring</groupId>
45+
<artifactId>dapr-spring-workflows</artifactId>
46+
<version>${project.parent.version}</version>
47+
</dependency>
4348
</dependencies>
4449

4550
</project>

dapr-spring/dapr-spring-boot-tests/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>io.dapr.spring</groupId>
88
<artifactId>dapr-spring-parent</artifactId>
9-
<version>0.13.0-SNAPSHOT</version>
9+
<version>0.14.0-SNAPSHOT</version>
1010
</parent>
1111

1212
<artifactId>dapr-spring-boot-tests</artifactId>

dapr-spring/dapr-spring-data/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>io.dapr.spring</groupId>
88
<artifactId>dapr-spring-parent</artifactId>
9-
<version>0.13.0-SNAPSHOT</version>
9+
<version>0.14.0-SNAPSHOT</version>
1010
</parent>
1111

1212
<artifactId>dapr-spring-data</artifactId>

0 commit comments

Comments
 (0)