From d658d84b37960ee8c385b211826c01427afbb7aa Mon Sep 17 00:00:00 2001 From: W Chan Date: Fri, 1 Mar 2019 22:02:57 +0000 Subject: [PATCH 1/4] Modify join workflow test to cover use cases Modify the join workflow in test to cover different use cases for the merging context. In the test workflow now, msg1 and msg2 are in the initial context and so if the two branches conflicts, we will pick that up in the values assigned to the workflow output. --- .../actions/workflows/orquesta-join.yaml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/contrib/examples/actions/workflows/orquesta-join.yaml b/contrib/examples/actions/workflows/orquesta-join.yaml index 6d433e99c7..eaf09fed66 100644 --- a/contrib/examples/actions/workflows/orquesta-join.yaml +++ b/contrib/examples/actions/workflows/orquesta-join.yaml @@ -3,14 +3,8 @@ version: 1.0 description: A basic workflow that demonstrate branching and join. vars: - - messages: null - -output: - - messages: - - <% ctx().msg1 %> - - <% ctx().msg2 %> - - <% ctx().msg3 %> - - <% ctx().msg4 %> + - msg1: foobar + - msg2: fubar tasks: task1: @@ -73,8 +67,14 @@ tasks: publish: msg4="I'll grind his bones to make my bread" do: task10 - # converge branches task10: join: all action: core.noop + +output: + - messages: + - <% ctx().msg1 %> + - <% ctx().msg2 %> + - <% ctx().msg3 %> + - <% ctx().msg4 %> From 700bc5ae2eff18d1ab3c9fff5e58d146cbefdafa Mon Sep 17 00:00:00 2001 From: W Chan Date: Fri, 1 Mar 2019 22:04:53 +0000 Subject: [PATCH 2/4] Minor fix to accomodate changes in the engine The context entry stores the actual context value now and there's no dict with the value attribute. --- st2common/st2common/services/workflows.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/st2common/st2common/services/workflows.py b/st2common/st2common/services/workflows.py index d2cace867a..d0e3c5a3c1 100644 --- a/st2common/st2common/services/workflows.py +++ b/st2common/st2common/services/workflows.py @@ -258,7 +258,7 @@ def request(wf_def, ac_ex_db, st2_ctx, notify_cfg=None): # Publish the workflow execution requested state to the message bus. if wf_ex_db.status not in states.COMPLETED_STATES: wf_ex_db.context['st2']['workflow_execution_id'] = str(wf_ex_db.id) - wf_ex_db.flow['contexts'][0]['value']['st2']['workflow_execution_id'] = str(wf_ex_db.id) + wf_ex_db.flow['contexts'][0]['st2']['workflow_execution_id'] = str(wf_ex_db.id) wf_ex_db = wf_db_access.WorkflowExecution.update(wf_ex_db, publish=False) wf_db_access.WorkflowExecution.publish_status(wf_ex_db) msg = '[%s] Workflow execution "%s" is published.' From ac66b9cc786477d05f994c727662d6bfba48d5cb Mon Sep 17 00:00:00 2001 From: W Chan Date: Fri, 1 Mar 2019 22:06:29 +0000 Subject: [PATCH 3/4] Update orquesta dependency with the context fix Update orquesta in requirements.txt to specific commit with the context fix. --- contrib/runners/orquesta_runner/in-requirements.txt | 2 +- contrib/runners/orquesta_runner/requirements.txt | 2 +- requirements.txt | 2 +- st2common/in-requirements.txt | 2 +- st2common/requirements.txt | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/contrib/runners/orquesta_runner/in-requirements.txt b/contrib/runners/orquesta_runner/in-requirements.txt index 3aab1ce6ca..89c17ffb8c 100644 --- a/contrib/runners/orquesta_runner/in-requirements.txt +++ b/contrib/runners/orquesta_runner/in-requirements.txt @@ -1 +1 @@ -git+https://github.com/StackStorm/orquesta.git@5151f38877ac7d05d0576c183900f780a7556539#egg=orquesta +git+https://github.com/StackStorm/orquesta.git@d038caf217cf63bca2364905160bab7655f81d99#egg=orquesta diff --git a/contrib/runners/orquesta_runner/requirements.txt b/contrib/runners/orquesta_runner/requirements.txt index 0b3f1b5792..046f9149a3 100644 --- a/contrib/runners/orquesta_runner/requirements.txt +++ b/contrib/runners/orquesta_runner/requirements.txt @@ -1,2 +1,2 @@ # Don't edit this file. It's generated automatically! -git+https://github.com/StackStorm/orquesta.git@5151f38877ac7d05d0576c183900f780a7556539#egg=orquesta +git+https://github.com/StackStorm/orquesta.git@d038caf217cf63bca2364905160bab7655f81d99#egg=orquesta diff --git a/requirements.txt b/requirements.txt index 9e2ac5c33e..922f2f4976 100644 --- a/requirements.txt +++ b/requirements.txt @@ -8,7 +8,7 @@ cryptography==2.4.2 eventlet==0.24.1 flex==6.14.0 git+https://github.com/Kami/logshipper.git@stackstorm_patched#egg=logshipper -git+https://github.com/StackStorm/orquesta.git@5151f38877ac7d05d0576c183900f780a7556539#egg=orquesta +git+https://github.com/StackStorm/orquesta.git@d038caf217cf63bca2364905160bab7655f81d99#egg=orquesta git+https://github.com/StackStorm/python-mistralclient.git#egg=python-mistralclient git+https://github.com/StackStorm/st2-auth-backend-flat-file.git@master#egg=st2-auth-backend-flat-file gitpython==2.1.11 diff --git a/st2common/in-requirements.txt b/st2common/in-requirements.txt index 78631c305d..e35861ec24 100644 --- a/st2common/in-requirements.txt +++ b/st2common/in-requirements.txt @@ -9,7 +9,7 @@ jsonschema kombu mongoengine networkx -git+https://github.com/StackStorm/orquesta.git@5151f38877ac7d05d0576c183900f780a7556539#egg=orquesta +git+https://github.com/StackStorm/orquesta.git@d038caf217cf63bca2364905160bab7655f81d99#egg=orquesta oslo.config paramiko pyyaml diff --git a/st2common/requirements.txt b/st2common/requirements.txt index 6c38037e8a..75b3c7cb15 100644 --- a/st2common/requirements.txt +++ b/st2common/requirements.txt @@ -4,7 +4,7 @@ apscheduler==3.5.3 cryptography==2.4.2 eventlet==0.24.1 flex==6.14.0 -git+https://github.com/StackStorm/orquesta.git@5151f38877ac7d05d0576c183900f780a7556539#egg=orquesta +git+https://github.com/StackStorm/orquesta.git@d038caf217cf63bca2364905160bab7655f81d99#egg=orquesta greenlet==0.4.15 ipaddr jinja2 From de28fb5c02cab71b01ef6b0487294adcfd7c6002 Mon Sep 17 00:00:00 2001 From: W Chan Date: Mon, 4 Mar 2019 22:59:03 +0000 Subject: [PATCH 4/4] Add changelog entry for the orquesta context bug fix --- CHANGELOG.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 834d23fd8f..53107da9fe 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -31,6 +31,8 @@ Fixed (improvement) StackStorm/orquesta#122. * Fix orquesta workflow stuck in running status when one or more items failed execution for a with items task. (bug fix) #4523 +* Fix orquesta workflow bug where context variables are being overwritten on task join. + (bug fix) StackStorm/orquesta#112 2.10.2 - February 21, 2019 --------------------------