-
-
Notifications
You must be signed in to change notification settings - Fork 776
config_context renders against incorrect pack #4570
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
Changes from 14 commits
e2cca81
a97fd8e
5c64ca0
62a51fb
0e780ad
0c41155
f76e6dd
82ce3c5
c81f042
6f62b3c
eaa3858
c1f0724
82fcc34
3a8598e
c81e6d1
30bd1a0
2cbe564
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| --- | ||
| name: render_config_context | ||
| pack: examples | ||
| description: Run render config context workflow | ||
| runner_type: orquesta | ||
| entry_point: workflows/render_config_context.yaml | ||
| enabled: true | ||
| parameters: {} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| version: 1.0 | ||
| description: Testing config context render". | ||
| tasks: | ||
| task1: | ||
| action: tests.render_config_context | ||
| output: | ||
| - context_value: <% task(task1).result.result.context_value %> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -547,9 +547,12 @@ def request_action_execution(wf_ex_db, task_ex_db, st2_ctx, ac_ex_req, delay=Non | |
| # Identify the runner for the action. | ||
| runner_type_db = action_utils.get_runnertype_by_name(action_db.runner_type['name']) | ||
|
|
||
| # Identify action pack name | ||
| pack_name = action_ref.split('.')[0] if action_ref else st2_ctx.get('pack') | ||
|
|
||
| # Set context for the action execution. | ||
| ac_ex_ctx = { | ||
| 'pack': st2_ctx.get('pack'), | ||
| 'pack': pack_name, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please default to st2_ctx.get('pack') when task is action less.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We're good here then. See comment above. Thanks for following up. |
||
| 'user': st2_ctx.get('user'), | ||
| 'parent': st2_ctx, | ||
| 'orquesta': { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| --- | ||
| config_item_one: "testing" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| from st2common.runners.base_action import Action | ||
|
|
||
|
|
||
| class PrintPythonVersionAction(Action): | ||
|
|
||
| def run(self, value1): | ||
| return {"context_value": value1} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| --- | ||
| name: render_config_context | ||
| runner_type: python-script | ||
| description: Action that uses config context | ||
| enabled: true | ||
| entry_point: render_config_context.py | ||
| parameters: | ||
| value1: | ||
| description: Input for render_config_context. Defaults to config_context value. | ||
| required: false | ||
| type: "string" | ||
| default: "{{ config_context.config_item_one }}" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| config_item_one: | ||
| description: "Item use to test config context." | ||
| type: "string" | ||
| required: true |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| --- | ||
| name: render_config_context | ||
| pack: orquesta_tests | ||
| description: Run render config context workflow | ||
| runner_type: orquesta | ||
| entry_point: workflows/render_config_context.yaml | ||
| enabled: true | ||
| parameters: {} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| version: 1.0 | ||
| description: Testing config context render". | ||
| tasks: | ||
| task1: | ||
| action: dummy_pack_7.render_config_context | ||
| output: | ||
| - context_value: <% task(task1).result.result.context_value %> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,7 +9,7 @@ runner_count=1 | |
| scheduler_count=1 | ||
| workflow_engine_count=1 | ||
| use_gunicorn=true | ||
| copy_examples=false | ||
| copy_test_packs=false | ||
| load_content=true | ||
| use_ipv6=false | ||
| include_mistral=false | ||
|
|
@@ -29,7 +29,7 @@ while getopts ":r:s:w:gxcu6m" o; do | |
| use_gunicorn=false | ||
| ;; | ||
| x) | ||
| copy_examples=true | ||
| copy_test_packs=true | ||
| ;; | ||
| c) | ||
| load_content=false | ||
|
|
@@ -209,9 +209,20 @@ function st2start(){ | |
| cp -Rp ./contrib/core/ $PACKS_BASE_DIR | ||
| cp -Rp ./contrib/packs/ $PACKS_BASE_DIR | ||
|
|
||
| if [ "$copy_examples" = true ]; then | ||
| echo "Copying examples from ./contrib/examples to $PACKS_BASE_DIR" | ||
| if [ "$copy_test_packs" = true ]; then | ||
| echo "Copying test packs examples and tests to $PACKS_BASE_DIR" | ||
| cp -Rp ./contrib/examples $PACKS_BASE_DIR | ||
| # Clone st2tests in /tmp directory. | ||
| pushd /tmp | ||
| git clone https://github.com/StackStorm/st2tests.git | ||
| ret=$? | ||
| if [ ${ret} -eq 0 ]; then | ||
| cp -Rp ./st2tests/packs/tests $PACKS_BASE_DIR | ||
| rm -R st2tests/ | ||
| else | ||
| echo "Failed to clone st2tests repo" | ||
| fi | ||
| popd | ||
| fi | ||
|
|
||
| # activate virtualenv to set PYTHONPATH | ||
|
|
@@ -413,6 +424,13 @@ function st2start(){ | |
| --config-file $ST2_CONF --register-all | ||
| fi | ||
|
|
||
| if [ "$copy_test_packs" = true ]; then | ||
| st2 run packs.setup_virtualenv packs=tests | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe this will fail when auth is enabled in the dev config. Can you test this scenario and make sure the launch script handle this gracefully and warn users that they have to setup the virtualenv on their own. |
||
| if [ $? != 0 ]; then | ||
| echo "Warning: Please setup virtualenv for pack \"tests\" before run integration test" | ||
|
||
| fi | ||
| fi | ||
|
|
||
| # List screen sessions | ||
| screen -ls || exit 0 | ||
| } | ||
|
|
||
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.
Orquesta task can be action less. Example at https://github.com/StackStorm/st2/blob/master/contrib/examples/actions/workflows/tests/orquesta-test-action-less-tasks.yaml#L12. Please add a use case for this line that shows it can handle task that is action less.
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.
Tested of action less workflow
examples.orquesta-test-action-less-tasksand it went well. Not sure aboutadd a use case, is to add comment or unit test case?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.
Ok. Then we're good. Just want to make sure this use case is covered. Thank you for your diligence. It's appreciated.