-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add deploy action #27
Merged
Merged
Changes from all commits
Commits
Show all changes
37 commits
Select commit
Hold shift + click to select a range
3be8762
add deploy action
db1ebda
add deploy action
ee0efac
Merge branch 'main' into add_deploy_action
qdaxb 079e895
add deploy action
51d9e28
Merge remote-tracking branch 'origin/add_deploy_action' into add_depl…
e7106f3
add deploy action
c208a2b
add deploy action
a5e7d21
add deploy action
9ccdfd1
add deploy action
6c90182
add deploy action
0be8ba1
add deploy action
4b6c00f
add deploy action
1579cb4
add deploy action
01b0ec0
add deploy action
7d9d4f4
add deploy action
d344346
add deploy action
8e63ce1
fix deploy action
bee3dc9
fix deploy action
4fb808d
fix deploy action
51a1942
fix deploy action
b65aba3
fix deploy action
4c878c7
fix deploy action
1a50e50
fix deploy action
c17da85
fix deploy action
b17eed1
fix deploy action
3e9b0c2
fix deploy action
443e3f1
add helm action
ec73bcd
add helm action
a1f9a38
fix deploy action
ab75e39
fix deploy action
61c6378
fix deploy action
2b694bc
fix deploy action
3512890
fix deploy action
e95a170
fix deploy action
2429b9e
fix deploy action
10d1501
fix deploy action
d5e29d2
Merge branch 'main' into add_deploy_action
qdaxb File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
name: Docker Deploy and Test | ||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
types: [ opened, synchronize, reopened ] | ||
jobs: | ||
test: | ||
name: Docker Deploy and Test | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: 17 | ||
distribution: 'temurin' | ||
|
||
- name: Run Internal Test | ||
run: mvn test && echo "Maven Run Internal Test succeeded"|| { echo "Run Internal Test failed."; exit 1; } | ||
|
||
- name: Install Docker Compose | ||
run: | | ||
sudo curl -L "https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose | ||
sudo chmod +x /usr/local/bin/docker-compose | ||
|
||
- name: Deploy with Docker Compose | ||
run: | | ||
cd docker | ||
docker-compose up -d | ||
|
||
- name: Run API Test | ||
run: mvn test -P flow_api_test -Dapi.url=http://localhost:8080 && echo "Run API Test succeeded" || { echo "Run API Test failed."; exit 1; } | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
version: '3' | ||
services: | ||
rill-flow: | ||
image: weibocom/rill-flow | ||
depends_on: | ||
- cache | ||
- jaeger | ||
ports: | ||
- "8080:8080" | ||
environment: | ||
- RILL_FLOW_DESCRIPTOR_REDIS_HOST=cache | ||
- RILL_FLOW_DEFAULT_REDIS_HOST=cache | ||
- RILL_FLOW_TRACE_ENDPOINT=http://jaeger:4317 | ||
- RILL_FLOW_CALLBACK_URL=http://rill-flow:8080/flow/finish.json | ||
- RILL_FLOW_TRACE_QUERY_HOST=http://jaeger:16686 | ||
cache: | ||
image: redis:6.2-alpine | ||
restart: always | ||
command: redis-server --save 20 1 --loglevel warning | ||
jaeger: | ||
image: jaegertracing/all-in-one:1.39 | ||
restart: always | ||
environment: | ||
- COLLECTOR_OTLP_ENABLED=true | ||
ui: | ||
image: weibocom/rill-flow-ui | ||
ports: | ||
- "8088:80" | ||
depends_on: | ||
- rill-flow | ||
- jaeger | ||
environment: | ||
- BACKEND_SERVER=http://rill-flow:8080 | ||
sample-executor: | ||
image: weibocom/rill-flow-sample:sample-executor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>com.weibo</groupId> | ||
<artifactId>rill-flow</artifactId> | ||
<version>0.1.6-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>rill-flow-test</artifactId> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.apache.httpcomponents</groupId> | ||
<artifactId>httpclient</artifactId> | ||
<version>4.5.14</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.alibaba</groupId> | ||
<artifactId>fastjson</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>net.sf.json-lib</groupId> | ||
<artifactId>json-lib</artifactId> | ||
<classifier>jdk15</classifier> | ||
</dependency> | ||
</dependencies> | ||
</project> |
137 changes: 137 additions & 0 deletions
137
rill-flow-test/src/test/groovy/com/weibo/rill/flow/sample/SampleApiTest.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,137 @@ | ||
package com.weibo.rill.flow.sample | ||
|
||
import net.sf.json.groovy.JsonSlurper | ||
import org.apache.http.HttpEntity | ||
import org.apache.http.HttpResponse | ||
import org.apache.http.client.HttpClient | ||
import org.apache.http.client.methods.HttpGet | ||
import org.apache.http.client.methods.HttpPost | ||
import org.apache.http.entity.ContentType | ||
import org.apache.http.entity.StringEntity | ||
import org.apache.http.impl.client.HttpClientBuilder | ||
import spock.lang.Specification | ||
import spock.lang.Stepwise | ||
import spock.lang.Timeout | ||
|
||
@Stepwise | ||
class SampleApiTest extends Specification { | ||
|
||
|
||
|
||
String domain; | ||
|
||
def setup(){ | ||
domain = System.getProperty("api.url") | ||
} | ||
|
||
@Timeout(30) | ||
|
||
def "run choice sample task"() { | ||
when: | ||
def responseJson = sendPostRequest(domain + "/flow/bg/manage/descriptor/add_descriptor.json?business_id=rillFlowSample&feature_name=choiceSample&alias=release", "text/plain", readFileContent("../docs/samples/choice-sample.yaml")) | ||
|
||
then: | ||
responseJson.status == 200 | ||
responseJson.content.ret == true | ||
|
||
when: | ||
def submitResponseJson = sendPostRequest(domain + "/flow/submit.json?descriptor_id=rillFlowSample:choiceSample", "application/json", "{\"input_num\":10}") | ||
|
||
then: | ||
submitResponseJson.status == 200 | ||
submitResponseJson.content.execution_id != "" | ||
|
||
expect: | ||
assert checkDagStatus(submitResponseJson.content.execution_id) | ||
} | ||
|
||
def "run call api sample task"() { | ||
when: | ||
def responseJson = sendPostRequest(domain + "/flow/bg/manage/descriptor/add_descriptor.json?business_id=rillFlowSample&feature_name=callApiSample&alias=release", "text/plain", readFileContent("../docs/samples/call-api-sample.yaml")) | ||
|
||
then: | ||
responseJson.status == 200 | ||
responseJson.content.ret == true | ||
|
||
when: | ||
def submitResponseJson = sendPostRequest(domain + "/flow/submit.json?descriptor_id=rillFlowSample:callApiSample", "application/json", "{\"input_num\":10}") | ||
|
||
then: | ||
submitResponseJson.status == 200 | ||
submitResponseJson.content.execution_id != "" | ||
|
||
expect: | ||
assert checkDagStatus(submitResponseJson.content.execution_id) | ||
|
||
} | ||
|
||
private String readFileContent(String filePath) { | ||
try { | ||
return new File(filePath).text | ||
} catch (IOException e) { | ||
e.printStackTrace() | ||
return null | ||
} | ||
} | ||
|
||
private boolean checkDagStatus(String executionId) { | ||
def i = 0 | ||
while (i < 10) { | ||
def getResponseJson = sendGetRequest(domain + "/flow/get.json?execution_id=" + executionId, "application/json") | ||
if (getResponseJson.content.ret.dag_status == "SUCCEED") { | ||
return true | ||
} | ||
i++ | ||
println getResponseJson.content.ret.dag_status | ||
if (getResponseJson.content.ret.dag_status == "FAILED") { | ||
println getResponseJson.content.ret | ||
} | ||
Thread.sleep(1000) | ||
} | ||
return false | ||
} | ||
|
||
private Map<String, Object> sendPostRequest(String url, String contentType, String requestData) { | ||
HttpClient httpClient = HttpClientBuilder.create().build() | ||
def result = [:] | ||
try { | ||
HttpPost httpPost = new HttpPost(url) | ||
httpPost.addHeader("Content-Type", contentType) | ||
|
||
httpPost.setEntity(new StringEntity(requestData, ContentType.create(contentType))) | ||
|
||
HttpResponse response = httpClient.execute(httpPost) | ||
HttpEntity entity = response.getEntity() | ||
|
||
int statusCode = response.getStatusLine().getStatusCode() | ||
def responseContent = new JsonSlurper().parse(entity.content) | ||
result.status = statusCode | ||
result.content = responseContent | ||
result as Map<String, Object> | ||
} catch (Exception e) { | ||
e.printStackTrace() | ||
return null | ||
} | ||
} | ||
|
||
private Map<String, Object> sendGetRequest(String url, String contentType) { | ||
HttpClient httpClient = HttpClientBuilder.create().build() | ||
def result = [:] | ||
try { | ||
HttpGet httpGet = new HttpGet(url) | ||
httpGet.addHeader("Content-Type", contentType) | ||
|
||
HttpResponse response = httpClient.execute(httpGet) | ||
HttpEntity entity = response.getEntity() | ||
|
||
int statusCode = response.getStatusLine().getStatusCode() | ||
def responseContent = new JsonSlurper().parse(entity.content) | ||
result.status = statusCode | ||
result.content = responseContent | ||
result as Map<String, Object> | ||
} catch (Exception e) { | ||
e.printStackTrace() | ||
return null | ||
} | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
package包含test