Created
October 6, 2014 21:29
-
-
Save menski/8eb1ad35b08908f4cc9c to your computer and use it in GitHub Desktop.
Deploy BPMN process with external script resource via REST API on heroku
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
#!/bin/sh | |
APP=heroku-app-1234 | |
HOST=http://$APP.herokuapp.com | |
API=$HOST/api | |
USERNAME=root | |
PASSWORD=12345678 | |
SCRIPT=MyTestScript.groovy | |
PROCESS=process.bpmn20.xml | |
TRACE=/dev/stdout | |
# to write output to file use something like: | |
#TRACE=deployment.trace | |
# login | |
curl -v -w "\n" --cookie-jar cookie.txt \ | |
-H "Accept: application/json" \ | |
-d "username=$USERNAME" \ | |
-d "password=$PASSWORD" \ | |
$API/admin/auth/user/default/login/cockpit | |
# deploy | |
curl --trace-ascii "$TRACE" -w "\n" --cookie cookie.txt \ | |
-H "Accept: application/json" \ | |
-F "deployment-name=rest-test" \ | |
-F "enable-duplicate-filtering=false" \ | |
-F "deploy-changed-only=false" \ | |
-F "com/plexiti/test/MyTestScript.groovy=@$SCRIPT;filename=com/plexiti/test/MyTestScript.groovy" \ | |
-F "process.bpmn=@$PROCESS" \ | |
$API/engine/engine/default/deployment/create | |
# start | |
curl -v -w "\n" --cookie cookie.txt \ | |
-H "Accept: application/json" \ | |
-H "Content-Type: application/json" \ | |
-d "{}" \ | |
$API/engine/engine/default/process-definition/key/testProcess/start |
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
println "Hello world" | |
execution.setVariable("groovy", "works") |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:camunda="http://activiti.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn"> | |
<process id="testProcess" name="Test Process" isExecutable="true"> | |
<startEvent id="start" /> | |
<sequenceFlow id="flow1" sourceRef="start" targetRef="script" /> | |
<scriptTask id="script" name="Script" scriptFormat="groovy" camunda:resource="deployment://com/plexiti/test/MyTestScript.groovy" /> | |
<sequenceFlow id="flow2" sourceRef="script" targetRef="wait" /> | |
<userTask id="wait" name="Wait" /> | |
<sequenceFlow id="flow3" sourceRef="wait" targetRef="end" /> | |
<endEvent id="end" /> | |
</process> | |
<bpmndi:BPMNDiagram id="BPMNDiagram_1"> | |
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="testProcess"> | |
<bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="start"> | |
<dc:Bounds x="173" y="102" width="36" height="36" /> | |
</bpmndi:BPMNShape> | |
<bpmndi:BPMNShape id="Task_06xwck2_di" bpmnElement="script"> | |
<dc:Bounds x="259" y="80" width="100" height="80" /> | |
</bpmndi:BPMNShape> | |
<bpmndi:BPMNEdge id="SequenceFlow_1poioba_di" bpmnElement="flow1"> | |
<di:waypoint x="209" y="120" /> | |
<di:waypoint x="259" y="120" /> | |
<bpmndi:BPMNLabel> | |
<dc:Bounds x="189" y="110" width="90" height="20" /> | |
</bpmndi:BPMNLabel> | |
</bpmndi:BPMNEdge> | |
<bpmndi:BPMNShape id="Task_0yaarbf_di" bpmnElement="wait"> | |
<dc:Bounds x="409" y="80" width="100" height="80" /> | |
</bpmndi:BPMNShape> | |
<bpmndi:BPMNEdge id="SequenceFlow_10xhvj9_di" bpmnElement="flow2"> | |
<di:waypoint x="359" y="120" /> | |
<di:waypoint x="409" y="120" /> | |
<bpmndi:BPMNLabel> | |
<dc:Bounds x="339" y="110" width="90" height="20" /> | |
</bpmndi:BPMNLabel> | |
</bpmndi:BPMNEdge> | |
<bpmndi:BPMNShape id="EndEvent_186k1oo_di" bpmnElement="end"> | |
<dc:Bounds x="591" y="102" width="36" height="36" /> | |
<bpmndi:BPMNLabel> | |
<dc:Bounds x="564" y="138" width="90" height="20" /> | |
</bpmndi:BPMNLabel> | |
</bpmndi:BPMNShape> | |
<bpmndi:BPMNEdge id="SequenceFlow_06vp2xn_di" bpmnElement="flow3"> | |
<di:waypoint x="509" y="120" /> | |
<di:waypoint x="591" y="120" /> | |
<bpmndi:BPMNLabel> | |
<dc:Bounds x="505" y="110" width="90" height="20" /> | |
</bpmndi:BPMNLabel> | |
</bpmndi:BPMNEdge> | |
</bpmndi:BPMNPlane> | |
</bpmndi:BPMNDiagram> | |
</definitions> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Many thanks, this helped me a lot.