Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Add Dashboard Support: #72 - Create Dashboard Added `create_dashboard` action. * Add Dashboard Support: #72 Add Gadget Action * Added `add_gadget` action. Allows the user to add a gadget to an existing dashboard. * Add Dashboard Support: #72 Add `update_dashboard` Action * Added `update_dashboard` action. It accepts parameters for the update, fetches the dashboard by `id`, runs the `update` method on the `dashboard` resource and returns it's `raw` result (`json` result from the API) * Add Dashboard Support: #72 Add `update_gadget` Action * Added `update_gadget` action to allow a user to modify an existing gadget on a dashboard. * Add Dashboard Support: #72 Add `delete_dashboard` Action * Added an action to delete dashboards by `id`. The `jira` library only returns the raw `requests` response in this case. The return is a dictionary containing the response status code and any text that was included with the response. The action fails if any status code other than 204 is produced. * Add Dashboard Support: #72 Add `remove_gadget` Action * Added `remove_gadget` action to allow users to delete gadgets from dashboards. * Add Dashboard Support: #72 Add `get_gadgets` Action * The `get_gadgets` action just pulls the available list of gadgets from the `jira` instance. This commit also includes a fix to the description of the `remove_gadget` yaml. * Change `get_gadgets` to `get_available_gadgets` This is more in keeping with the API. * Add Dashboard Support: #72 Add `get_dashboard_gadgets` Action * The `get_dashboard_gadgets` action differs from the `get_available_gadgets` action in that, it targets a specific dashboard and returns only the gadgets present on that dashboard. * Add Dashboard Support: #72 Add `copy_dashboard` Action * Added the `copy_dashboard` action. * Updated some descriptions in `update_dashboard` and `create_dashboard` yaml files. * Add `get_dashboard_item_property_keys` Action #72 * Added `get_dashboard_item_property_keys`. This returns a list of dashboard item property keys which are used to identify metadata stores on a given dashboard item (gadget). * Dashboard Support: #72 Add `get_dashboard_item_property` Action * Added `get_dashboard_item_property` action. This gets a dashboard item (gadget) property by key. Typically these hold user specified metadata, or in the case of some gadgets the `config` key can be sent a payload to configure an otherwise unconfigured gadget. * Dashboard Support: #72 Add `set_dashboard_item_property` Action * Allows the user to set the values of item properties on a given dashboard item (gadget). An example of this would be a configuration for a dashboard gadget that is configured with a `Filter Result` module. * Dashboard Support #72: Add `delete_dashboard_item_property` * Added `delete_dashboard_item_property`. Allows the user to delete a dashboard item property (like a config object on a filter module on a gadget). * Dashboard Support: #72 `update_dashboard_item_property` * Added `update_dashboard_item_property` action. This differs from `set_dashboard_item_property` in that, it updates the existing object attributes, instead of simply replacing them. Good for updating specific fields on gadget configuration items. * Dashboard Support: #72 `update_dashboard_automatic_refresh` * Added `update_dashboard_automatic_refresh` action. This let's the user set how often the dashboard refreshes in minutes. * Add Dashboard Support: #72 Tests Added tests for all of the new actions. Included some new fixtures as well for those tests. The report is as follows: ``` (st2) root@e74c68fe6ffa:/opt/stackstorm/packs.dev/jira# st2-run-pack-tests -j -t -c -p /opt/stackstorm/packs.dev/jira Running tests for pack: jira Activating virtualenv in /tmp/st2-pack-tests-virtualenvs/jira... ::/opt/stackstorm/packs.dev/jira/sensors/:/opt/stackstorm/packs.dev/jira/actions/:/opt/stackstorm/packs.dev/jira/actions/lib/:/opt/stackstorm/packs.dev/jira/etc/ WARNING: You are using pip version 20.3.3; however, version 24.0 is available. You should consider upgrading via the '/tmp/st2-pack-tests-virtualenvs/jira/bin/python -m pip install --upgrade pip' command. Running tests... test_add_gadget (tests.test_action_add_gadget.AddGadgetTests) ... passed test_copy_dashboard (tests.test_action_copy_dashboard.CopyDashboardTests) ... passed test_create_dashboard (tests.test_action_create_dashboard.CreateDashboardTests) ... passed test_delete_dashboard (tests.test_action_delete_dashboard.DeleteDashboardTests) ... passed test_delete_dashboard_item_property (tests.test_action_delete_dashboard_item_property.DeleteDashboardItemPropertyTest) ... passed test_get_available_gadgets (tests.test_action_get_available_gadgets.GetAvailableGadgetsTests) ... passed test_get_dashboard_gadgets (tests.test_action_get_dashboard_gadgets.GetDashboardGadgetsTest) ... passed test_get_dashboard_item_property (tests.test_action_get_dashboard_item_property.GetDashboardItemPropertyTests) ... passed test_get_dashboard_item_property_keys (tests.test_action_get_dashboard_item_property_keys.GetDashboardItemPropertyKeysTests) ... passed test_remove_gadget (tests.test_action_remove_gadget.RemoveGadgetTests) ... passed test_run_with_invalid_action (tests.test_action_run.RunTestCase) ... passed test_run_with_jira_exception (tests.test_action_run.RunTestCase) ... passed test_run_without_exception (tests.test_action_run.RunTestCase) ... passed test_transition_name_to_id (tests.test_action_run.RunTestCase) ... passed test_get_dashboard_item_property (tests.test_action_set_dashboard_item_property.SetDashboardItemPropertyTests) ... passed test_update_dashboard (tests.test_action_update_dashboard.UpdateDashboardTests) ... passed test_update_dashboard_automatic_refresh (tests.test_action_update_dashboard_automatic_refresh.UpdateJiraDashboardAutomaticRefreshActionDashboardTests) ... passed test_set_dashboard_item_property (tests.test_action_update_dashboard_property.UpdateDashboardItemPropertyTests) ... passed test_update_gadget (tests.test_action_update_gadget.UpdateGadgetTests) ... passed test_poll (tests.test_sensor_jira_sensor.JIRASensorTestCase) ... passed test_poll (tests.test_sensor_jira_sensor_for_apiv2.JIRASensorForAPIv2TestCase) ... passed TEST RESULT OUTPUT: Name Stmts Miss Cover ------------------------------------------------------------------- actions/add_field_value.py 8 8 0% actions/add_gadget.py 8 0 100% actions/attach_file_to_issue.py 10 10 0% actions/attach_files_to_issue.py 11 11 0% actions/bulk_link_issue.py 27 27 0% actions/comment_issue.py 8 8 0% actions/copy_dashboard.py 8 0 100% actions/create_dashboard.py 8 0 100% actions/create_issue.py 14 14 0% actions/delete_dashboard.py 8 0 100% actions/delete_dashboard_item_property.py 8 0 100% actions/get_available_gadgets.py 6 0 100% actions/get_dashboard_gadgets.py 6 0 100% actions/get_dashboard_item_property.py 6 0 100% actions/get_dashboard_item_property_keys.py 6 0 100% actions/get_issue.py 8 8 0% actions/get_issue_attachments.py 11 11 0% actions/get_issue_comments.py 11 11 0% actions/get_issue_links.py 8 8 0% actions/lib/__init__.py 0 0 100% actions/lib/base.py 41 21 49% actions/lib/formatters.py 57 57 0% actions/lib/utils.py 4 0 100% actions/link_issue.py 6 6 0% actions/remove_gadget.py 9 0 100% actions/run.py 21 3 86% actions/search_issues.py 10 10 0% actions/set_dashboard_item_property.py 6 0 100% actions/transition_issue.py 6 6 0% actions/update_dashboard.py 9 0 100% actions/update_dashboard_automatic_refresh.py 7 0 100% actions/update_dashboard_item_property.py 7 0 100% actions/update_field_value.py 8 8 0% actions/update_gadget.py 10 0 100% sensors/jira_sensor.py 97 45 54% sensors/jira_sensor_for_apiv2.py 96 45 53% ------------------------------------------------------------------- TOTAL 574 317 45% [success] 16.58% tests.test_action_run.RunTestCase.test_run_without_exception: 0.0253s [success] 6.88% tests.test_action_add_gadget.AddGadgetTests.test_add_gadget: 0.0105s [success] 5.61% tests.test_action_delete_dashboard_item_property.DeleteDashboardItemPropertyTest.test_delete_dashboard_item_property: 0.0086s [success] 5.45% tests.test_action_update_gadget.UpdateGadgetTests.test_update_gadget: 0.0083s [success] 5.38% tests.test_action_create_dashboard.CreateDashboardTests.test_create_dashboard: 0.0082s [success] 5.22% tests.test_action_get_available_gadgets.GetAvailableGadgetsTests.test_get_available_gadgets: 0.0080s [success] 5.22% tests.test_action_copy_dashboard.CopyDashboardTests.test_copy_dashboard: 0.0080s [success] 5.09% tests.test_action_update_dashboard_property.UpdateDashboardItemPropertyTests.test_set_dashboard_item_property: 0.0078s [success] 5.06% tests.test_action_delete_dashboard.DeleteDashboardTests.test_delete_dashboard: 0.0077s [success] 4.80% tests.test_action_set_dashboard_item_property.SetDashboardItemPropertyTests.test_get_dashboard_item_property: 0.0073s [success] 4.76% tests.test_action_get_dashboard_gadgets.GetDashboardGadgetsTest.test_get_dashboard_gadgets: 0.0073s [success] 4.68% tests.test_action_get_dashboard_item_property.GetDashboardItemPropertyTests.test_get_dashboard_item_property: 0.0071s [success] 4.66% tests.test_action_remove_gadget.RemoveGadgetTests.test_remove_gadget: 0.0071s [success] 4.64% tests.test_action_update_dashboard_automatic_refresh.UpdateJiraDashboardAutomaticRefreshActionDashboardTests.test_update_dashboard_automatic_refresh: 0.0071s [success] 4.45% tests.test_action_update_dashboard.UpdateDashboardTests.test_update_dashboard: 0.0068s [success] 4.09% tests.test_action_get_dashboard_item_property_keys.GetDashboardItemPropertyKeysTests.test_get_dashboard_item_property_keys: 0.0063s [success] 2.27% tests.test_action_run.RunTestCase.test_transition_name_to_id: 0.0035s [success] 2.25% tests.test_action_run.RunTestCase.test_run_with_jira_exception: 0.0034s [success] 1.90% tests.test_action_run.RunTestCase.test_run_with_invalid_action: 0.0029s [success] 0.51% tests.test_sensor_jira_sensor_for_apiv2.JIRASensorForAPIv2TestCase.test_poll: 0.0008s [success] 0.50% tests.test_sensor_jira_sensor.JIRASensorTestCase.test_poll: 0.0008s ----------------------------------------------------------------------------- 21 tests run in 0.159 seconds (21 tests passed) ``` All changes are covered at 100%. * Add Dashboard Support: #72 Finishing touches. * Updated `CHANGES.md` * Updated `README.md` * Bumped `pack` version. * Committed missed addition to `test/lib/actions.py` * Dashboard Support #72: Update `jira` version The changes necessary for these pack updates have been merged into the `jira` package and that package has had a release to `pypi`. * Force Tests * Add Dashboard Actions #72: Update Had to update some tests/class references/method calls to match the final interface over in the `jira` lib. * `Gadget` renamed to `DashboardGadget`. * `gadgets` method renamed to `all_dashboard_gadgets`. * Update `%s/update_dashboard_automatic_refresh_seconds/update_dashboard/automatic_refresh_minutes` * Add Dashboard Support #72: CI && Pack bump The latest versions of the `jira` library require `python >= 3.8`. In light of the fact that `StackStorm` is going to shed support for `python3.6` (which is EOL https://www.python.org/downloads/release/python-360/) this pack is updating to stop testing `3.6` and bumping the pack to the next major version to signal a potentially breaking change. * Add Dashboard Support #72: Try CI again Cutting this down to the lowest common denominator in terms of working tests for `StackStorm`. `3.11` is breaking on installing some dev dependencies: ``` ERROR: Command errored out with exit status 1: command: /home/runner/virtualenv/bin/python /home/runner/virtualenv/lib/python3.11/site-packages/pip/_vendor/pep517/_in_process.py get_requires_for_build_wheel /tmp/tmp_5anenlq cwd: /tmp/pip-install-mj_5c6wi/pyyaml_3973c6602d81416aa8ada0b8d43f48a5 Complete output (54 lines): running egg_info writing lib3/PyYAML.egg-info/PKG-INFO writing dependency_links to lib3/PyYAML.egg-info/dependency_links.txt writing top-level names to lib3/PyYAML.egg-info/top_level.txt Traceback (most recent call last): File "/home/runner/virtualenv/lib/python3.11/site-packages/pip/_vendor/pep517/_in_process.py", line 280, in <module> main() File "/home/runner/virtualenv/lib/python3.11/site-packages/pip/_vendor/pep517/_in_process.py", line 263, in main json_out['return_val'] = hook(**hook_input['kwargs']) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/runner/virtualenv/lib/python3.11/site-packages/pip/_vendor/pep517/_in_process.py", line 114, in get_requires_for_build_wheel return hook(config_settings) ^^^^^^^^^^^^^^^^^^^^^ File "/tmp/pip-build-env-e17od6z2/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 325, in get_requires_for_build_wheel return self._get_build_requires(config_settings, requirements=['wheel']) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/tmp/pip-build-env-e17od6z2/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 295, in _get_build_requires self.run_setup() File "/tmp/pip-build-env-e17od6z2/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 311, in run_setup exec(code, locals()) File "<string>", line 271, in <module> File "/tmp/pip-build-env-e17od6z2/overlay/lib/python3.11/site-packages/setuptools/__init__.py", line 104, in setup return distutils.core.setup(**attrs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/tmp/pip-build-env-e17od6z2/overlay/lib/python3.11/site-packages/setuptools/_distutils/core.py", line 185, in setup return run_commands(dist) ^^^^^^^^^^^^^^^^^^ File "/tmp/pip-build-env-e17od6z2/overlay/lib/python3.11/site-packages/setuptools/_distutils/core.py", line 201, in run_commands dist.run_commands() File "/tmp/pip-build-env-e17od6z2/overlay/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 969, in run_commands self.run_command(cmd) File "/tmp/pip-build-env-e17od6z2/overlay/lib/python3.11/site-packages/setuptools/dist.py", line 967, in run_command super().run_command(command) File "/tmp/pip-build-env-e17od6z2/overlay/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 988, in run_command cmd_obj.run() File "/tmp/pip-build-env-e17od6z2/overlay/lib/python3.11/site-packages/setuptools/command/egg_info.py", line 321, in run self.find_sources() File "/tmp/pip-build-env-e17od6z2/overlay/lib/python3.11/site-packages/setuptools/command/egg_info.py", line 329, in find_sources mm.run() File "/tmp/pip-build-env-e17od6z2/overlay/lib/python3.11/site-packages/setuptools/command/egg_info.py", line 550, in run self.add_defaults() File "/tmp/pip-build-env-e17od6z2/overlay/lib/python3.11/site-packages/setuptools/command/egg_info.py", line 588, in add_defaults sdist.add_defaults(self) File "/tmp/pip-build-env-e17od6z2/overlay/lib/python3.11/site-packages/setuptools/command/sdist.py", line 102, in add_defaults super().add_defaults() File "/tmp/pip-build-env-e17od6z2/overlay/lib/python3.11/site-packages/setuptools/_distutils/command/sdist.py", line 251, in add_defaults self._add_defaults_ext() File "/tmp/pip-build-env-e17od6z2/overlay/lib/python3.11/site-packages/setuptools/_distutils/command/sdist.py", line 336, in _add_defaults_ext self.filelist.extend(build_ext.get_source_files()) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "<string>", line 201, in get_source_files File "/tmp/pip-build-env-e17od6z2/overlay/lib/python3.11/site-packages/setuptools/_distutils/cmd.py", line 107, in __getattr__ raise AttributeError(attr) AttributeError: cython_sources ---------------------------------------- ERROR: Command errored out with exit status 1: /home/runner/virtualenv/bin/python /home/runner/virtualenv/lib/python3.11/site-packages/pip/_vendor/pep517/_in_process.py get_requires_for_build_wheel /tmp/tmp_5anenlq Check the logs for full command output. WARNING: You are using pip version 20.3.3; however, version 24.0 is available. You should consider upgrading via the '/home/runner/virtualenv/bin/python -m pip install --upgrade pip' command. ``` * Add Dashboard Support #72: Updated CHANGES && Import Paths This PR updates the CHANGES.md to include the deprecation of `python 3.6`. Further, it updates the paths to the `utils` function `remove_empty_attributes`. The test set up puts the * Add Dashboard Support #72: More pathing issues Turns out the `.gitignore` ignores the `lib/` dir. This applies to the `lib` dir within the `actions` dir. Caused me to miss the fact that I didn't actually commit the `utils.py` file. * Add Dashboard Support #72: Update `release.yaml` I just realized the `release.yaml` GHA also uses the upstream `pack-build_and_test` workflow. It would have failed when an attempt was released because of our now deprecating `python 3.6`. Updating this to mirror the `build_and_test.yaml` workflow.
- Loading branch information