simplerubysteps 0.0.4 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +0 -1
- data/exe/simplerubysteps-workflow-run-sync +6 -0
- data/lib/deploy.sh +2 -1
- data/lib/simplerubysteps/version.rb +1 -1
- data/lib/simplerubysteps.rb +6 -0
- data/lib/statemachine.yaml +5 -0
- data/lib/workflow-run-sync.sh +10 -0
- data/samples/sample2/workflow.rb +2 -0
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1db80d874fc5708a39f631983f7bf584ed63eb3840a2f212db85efff25b06486
|
4
|
+
data.tar.gz: 14ee38786322a3962cb48bcc64ba5c5d0606750fc24f422ef2c0ed17d962680b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9b43275998e160fb9d47db290b973d73b56da8b829ff5e35f408f6cdb093a3dcbf7c990ceabf063733730cbd131be6a9b0369c29113a11f18317c124391656ac
|
7
|
+
data.tar.gz: 5d224524a8d5f42f69cdd5e5b1fc778744e847d918e5cefca08f2115cd23503b8828f154b1f98292df0d1fd4082f79645444f67ddcccb16ff86e15a9bfffed1f
|
data/README.md
CHANGED
@@ -61,7 +61,6 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
61
61
|
|
62
62
|
### TODOs
|
63
63
|
|
64
|
-
* Support for StateMachineType (STANDARD or EXPRESS)
|
65
64
|
* Custom IAM role policies (Step Functions and Lambda)
|
66
65
|
* sls-like tooling in ruby with AWS SDK
|
67
66
|
* Workflow action unit test support
|
data/lib/deploy.sh
CHANGED
@@ -66,13 +66,14 @@ fi
|
|
66
66
|
echo "Uploading state machine JSON"
|
67
67
|
|
68
68
|
ruby -e 'require "./workflow.rb";puts $sm.render.to_json' > /tmp/my-state-machine-definition.json
|
69
|
+
export WF_TYPE=$(ruby -e 'require "./workflow.rb";puts $sm.kind')
|
69
70
|
export STATE_MACHINE_JSON_SHA=$(shasum /tmp/my-state-machine-definition.json | awk '{print $1}')
|
70
71
|
export UPLOADED_STATE_MACHINE_JSON=statemachine-$STATE_MACHINE_JSON_SHA.zip
|
71
72
|
aws s3 cp /tmp/my-state-machine-definition.json s3://$DEPLOY_BUCKET/$UPLOADED_STATE_MACHINE_JSON
|
72
73
|
|
73
74
|
echo "Updating CloudFormation Stack"
|
74
75
|
|
75
|
-
echo '[{"ParameterKey":"DeployLambda","ParameterValue":"yes"},{"ParameterKey":"DeployStepfunctions","ParameterValue":"yes"},{"ParameterKey":"LambdaS3","ParameterValue":"'$UPLOADED_LAMBDA_ZIP'"},{"ParameterKey":"StepFunctionsS3","ParameterValue":"'$UPLOADED_STATE_MACHINE_JSON'"}]' > /tmp/params.json
|
76
|
+
echo '[{"ParameterKey":"DeployLambda","ParameterValue":"yes"},{"ParameterKey":"DeployStepfunctions","ParameterValue":"yes"},{"ParameterKey":"LambdaS3","ParameterValue":"'$UPLOADED_LAMBDA_ZIP'"},{"ParameterKey":"StepFunctionsS3","ParameterValue":"'$UPLOADED_STATE_MACHINE_JSON'"},{"ParameterKey":"StateMachineType","ParameterValue":"'$WF_TYPE'"}]' > /tmp/params.json
|
76
77
|
|
77
78
|
aws cloudformation deploy \
|
78
79
|
--template-file $CF_TEMPLATE \
|
data/lib/simplerubysteps.rb
CHANGED
@@ -14,9 +14,11 @@ module Simplerubysteps
|
|
14
14
|
class StateMachine
|
15
15
|
attr_reader :states
|
16
16
|
attr_reader :start_at
|
17
|
+
attr_accessor :kind
|
17
18
|
|
18
19
|
def initialize()
|
19
20
|
@states = {}
|
21
|
+
@kind = "STANDARD"
|
20
22
|
end
|
21
23
|
|
22
24
|
def add(state)
|
@@ -189,6 +191,10 @@ module Simplerubysteps
|
|
189
191
|
|
190
192
|
$sm = StateMachine.new
|
191
193
|
$tasks = []
|
194
|
+
|
195
|
+
def kind(k)
|
196
|
+
$sm.kind = k
|
197
|
+
end
|
192
198
|
|
193
199
|
def task(name)
|
194
200
|
t = $sm.add Task.new(name)
|
data/lib/statemachine.yaml
CHANGED
@@ -25,6 +25,10 @@ Parameters:
|
|
25
25
|
- "yes"
|
26
26
|
- "no"
|
27
27
|
ConstraintDescription: must specify yes or no.
|
28
|
+
StateMachineType:
|
29
|
+
Description: StateMachineType.
|
30
|
+
Default: STANDARD
|
31
|
+
Type: String
|
28
32
|
Conditions:
|
29
33
|
CreateLambda: !Equals
|
30
34
|
- !Ref DeployLambda
|
@@ -53,6 +57,7 @@ Resources:
|
|
53
57
|
Bucket: !Ref DeployBucket
|
54
58
|
Key: !Ref StepFunctionsS3
|
55
59
|
RoleArn: !GetAtt StepFunctionsRole.Arn
|
60
|
+
StateMachineType: !Ref StateMachineType
|
56
61
|
MyLambdaRole:
|
57
62
|
Type: AWS::IAM::Role
|
58
63
|
Condition: CreateLambda
|
@@ -0,0 +1,10 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
export STACK_NAME=$(basename "$PWD")
|
4
|
+
|
5
|
+
export STEP_FUNCTIONS_ARN=$(aws cloudformation describe-stacks --stack-name $STACK_NAME --output text --query "Stacks[].Outputs[]"|grep StepFunctionsStateMachineARN|awk '{print $2}')
|
6
|
+
|
7
|
+
tee /tmp/statemachineinput.json > /dev/null
|
8
|
+
STATE_MACHINE_INPUT="$(cat /tmp/statemachineinput.json)"
|
9
|
+
|
10
|
+
aws stepfunctions start-sync-execution --state-machine-arn $STEP_FUNCTIONS_ARN --input "$STATE_MACHINE_INPUT" --query "output" --output text
|
data/samples/sample2/workflow.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simplerubysteps
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Christian Tschenett
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-04-
|
11
|
+
date: 2023-04-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -46,6 +46,7 @@ executables:
|
|
46
46
|
- simplerubysteps-destroy
|
47
47
|
- simplerubysteps-logs
|
48
48
|
- simplerubysteps-workflow-run
|
49
|
+
- simplerubysteps-workflow-run-sync
|
49
50
|
extensions: []
|
50
51
|
extra_rdoc_files: []
|
51
52
|
files:
|
@@ -60,6 +61,7 @@ files:
|
|
60
61
|
- exe/simplerubysteps-destroy
|
61
62
|
- exe/simplerubysteps-logs
|
62
63
|
- exe/simplerubysteps-workflow-run
|
64
|
+
- exe/simplerubysteps-workflow-run-sync
|
63
65
|
- lib/deploy.sh
|
64
66
|
- lib/destroy.sh
|
65
67
|
- lib/function.rb
|
@@ -67,6 +69,7 @@ files:
|
|
67
69
|
- lib/simplerubysteps.rb
|
68
70
|
- lib/simplerubysteps/version.rb
|
69
71
|
- lib/statemachine.yaml
|
72
|
+
- lib/workflow-run-sync.sh
|
70
73
|
- lib/workflow-run.sh
|
71
74
|
- samples/sample1/continue-callbackbranch.sh
|
72
75
|
- samples/sample1/send-task-success.sh
|