From b1b3b3c6735d7779fb9c07412ec61729cac994f1 Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Wed, 9 Jun 2021 00:03:24 -0500 Subject: [PATCH 1/4] pants: Rename shell targets --- contrib/examples/actions/BUILD | 2 +- contrib/linux/actions/BUILD | 2 +- scripts/BUILD | 2 +- st2actions/bin/BUILD | 4 +++- st2common/bin/migrations/v2.1/BUILD | 2 +- st2common/tests/fixtures/BUILD | 2 +- st2tests/integration/BUILD | 4 +++- tools/BUILD | 2 +- 8 files changed, 12 insertions(+), 8 deletions(-) diff --git a/contrib/examples/actions/BUILD b/contrib/examples/actions/BUILD index a36ccd24d32..3ba6abf4226 100644 --- a/contrib/examples/actions/BUILD +++ b/contrib/examples/actions/BUILD @@ -1,5 +1,5 @@ python_sources() shell_sources( - name="actions0", + name="shell", ) diff --git a/contrib/linux/actions/BUILD b/contrib/linux/actions/BUILD index a36ccd24d32..3ba6abf4226 100644 --- a/contrib/linux/actions/BUILD +++ b/contrib/linux/actions/BUILD @@ -1,5 +1,5 @@ python_sources() shell_sources( - name="actions0", + name="shell", ) diff --git a/scripts/BUILD b/scripts/BUILD index 0fabf607bee..3ba6abf4226 100644 --- a/scripts/BUILD +++ b/scripts/BUILD @@ -1,5 +1,5 @@ python_sources() shell_sources( - name="scripts0", + name="shell", ) diff --git a/st2actions/bin/BUILD b/st2actions/bin/BUILD index 6c95f66377d..7d014554b68 100644 --- a/st2actions/bin/BUILD +++ b/st2actions/bin/BUILD @@ -1 +1,3 @@ -shell_sources() +shell_sources( + name="shell", +) diff --git a/st2common/bin/migrations/v2.1/BUILD b/st2common/bin/migrations/v2.1/BUILD index ae8a03e5ae9..3ba6abf4226 100644 --- a/st2common/bin/migrations/v2.1/BUILD +++ b/st2common/bin/migrations/v2.1/BUILD @@ -1,5 +1,5 @@ python_sources() shell_sources( - name="v2.10", + name="shell", ) diff --git a/st2common/tests/fixtures/BUILD b/st2common/tests/fixtures/BUILD index 4775698535f..3ba6abf4226 100644 --- a/st2common/tests/fixtures/BUILD +++ b/st2common/tests/fixtures/BUILD @@ -1,5 +1,5 @@ python_sources() shell_sources( - name="fixtures0", + name="shell", ) diff --git a/st2tests/integration/BUILD b/st2tests/integration/BUILD index 6c95f66377d..7d014554b68 100644 --- a/st2tests/integration/BUILD +++ b/st2tests/integration/BUILD @@ -1 +1,3 @@ -shell_sources() +shell_sources( + name="shell", +) diff --git a/tools/BUILD b/tools/BUILD index a23b4b2fa62..3ba6abf4226 100644 --- a/tools/BUILD +++ b/tools/BUILD @@ -1,5 +1,5 @@ python_sources() shell_sources( - name="tools0", + name="shell", ) From 0323973eab6562eae618ec7a18e822f2a3534162 Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Wed, 9 Jun 2021 00:03:24 -0500 Subject: [PATCH 2/4] pants: Add/adjust targets for executables Most of the shell_source(s) targets were created with `./pants tailor ::`. That missed a few of our scripts that do not have a `.sh` extension, as well as a few executable python scripts that did not have a `.py` extension, so we let pants know about them. --- contrib/core/actions/send_mail/BUILD | 3 +++ st2actions/bin/BUILD | 4 ++++ st2api/bin/BUILD | 3 +++ st2auth/bin/BUILD | 3 +++ st2common/bin/BUILD | 9 ++++++++- st2common/bin/migrations/v3.5/BUILD | 2 ++ st2reactor/bin/BUILD | 3 +++ st2stream/bin/BUILD | 3 +++ tools/BUILD | 4 ++++ 9 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 contrib/core/actions/send_mail/BUILD create mode 100644 st2api/bin/BUILD create mode 100644 st2auth/bin/BUILD create mode 100644 st2reactor/bin/BUILD create mode 100644 st2stream/bin/BUILD diff --git a/contrib/core/actions/send_mail/BUILD b/contrib/core/actions/send_mail/BUILD new file mode 100644 index 00000000000..1afc0af75ae --- /dev/null +++ b/contrib/core/actions/send_mail/BUILD @@ -0,0 +1,3 @@ +shell_source( + source="send_mail", +) diff --git a/st2actions/bin/BUILD b/st2actions/bin/BUILD index 7d014554b68..cfd8966f757 100644 --- a/st2actions/bin/BUILD +++ b/st2actions/bin/BUILD @@ -1,3 +1,7 @@ +python_sources( + sources=["st2*"], +) + shell_sources( name="shell", ) diff --git a/st2api/bin/BUILD b/st2api/bin/BUILD new file mode 100644 index 00000000000..05411bee10f --- /dev/null +++ b/st2api/bin/BUILD @@ -0,0 +1,3 @@ +python_sources( + sources=["st2*"], +) diff --git a/st2auth/bin/BUILD b/st2auth/bin/BUILD new file mode 100644 index 00000000000..05411bee10f --- /dev/null +++ b/st2auth/bin/BUILD @@ -0,0 +1,3 @@ +python_sources( + sources=["st2*"], +) diff --git a/st2common/bin/BUILD b/st2common/bin/BUILD index db46e8d6c97..f3fe80bff89 100644 --- a/st2common/bin/BUILD +++ b/st2common/bin/BUILD @@ -1 +1,8 @@ -python_sources() +python_sources( + sources=["*.py", "st2*", "!st2ctl", "!st2-self-check", "!st2-run-pack-tests"], +) + +shell_sources( + name="shell", + sources=["st2ctl", "st2-self-check", "st2-run-pack-tests"], +) diff --git a/st2common/bin/migrations/v3.5/BUILD b/st2common/bin/migrations/v3.5/BUILD index db46e8d6c97..e574adca51b 100644 --- a/st2common/bin/migrations/v3.5/BUILD +++ b/st2common/bin/migrations/v3.5/BUILD @@ -1 +1,3 @@ +# TODO: what to do about st2-migrate-db-dict-field-values ? +# st2_migrate_db_dict_field_values.py is a symlink to st2-migrate-db-dict-field-values python_sources() diff --git a/st2reactor/bin/BUILD b/st2reactor/bin/BUILD new file mode 100644 index 00000000000..05411bee10f --- /dev/null +++ b/st2reactor/bin/BUILD @@ -0,0 +1,3 @@ +python_sources( + sources=["st2*"], +) diff --git a/st2stream/bin/BUILD b/st2stream/bin/BUILD new file mode 100644 index 00000000000..05411bee10f --- /dev/null +++ b/st2stream/bin/BUILD @@ -0,0 +1,3 @@ +python_sources( + sources=["st2*"], +) diff --git a/tools/BUILD b/tools/BUILD index 3ba6abf4226..c0eb325e9de 100644 --- a/tools/BUILD +++ b/tools/BUILD @@ -2,4 +2,8 @@ python_sources() shell_sources( name="shell", + sources=[ + "*.sh", + "st2-setup-*", + ], ) From 46fabcdfdd4ad2d99fb73a995acc861a07b2a0a9 Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Wed, 9 Jun 2021 00:03:24 -0500 Subject: [PATCH 3/4] pants: Add shellcheck for shell_source(s) targets This excludes some scripts from shellcheck because they weren't linted previously. We can clean them up in one or more follow-up PRs and remove `skip_shellcheck=True` from the relevant BUILD targets to re-enable shellcheck for those files. --- contrib/core/actions/send_mail/BUILD | 1 + contrib/examples/actions/BUILD | 1 + contrib/examples/actions/bash_ping/BUILD | 2 +- contrib/examples/actions/bash_random/BUILD | 6 +++++- contrib/linux/actions/BUILD | 1 + pants.toml | 1 + st2actions/bin/BUILD | 1 + st2common/bin/BUILD | 1 + st2common/bin/migrations/v2.1/BUILD | 1 + st2tests/integration/BUILD | 1 + st2tests/st2tests/fixtures/packs/BUILD | 1 + st2tests/testpacks/errorcheck/actions/BUILD | 2 +- tools/BUILD | 1 + 13 files changed, 17 insertions(+), 3 deletions(-) diff --git a/contrib/core/actions/send_mail/BUILD b/contrib/core/actions/send_mail/BUILD index 1afc0af75ae..f27e7c10ecb 100644 --- a/contrib/core/actions/send_mail/BUILD +++ b/contrib/core/actions/send_mail/BUILD @@ -1,3 +1,4 @@ shell_source( source="send_mail", + skip_shellcheck=True, ) diff --git a/contrib/examples/actions/BUILD b/contrib/examples/actions/BUILD index 3ba6abf4226..20fc0fa6ad5 100644 --- a/contrib/examples/actions/BUILD +++ b/contrib/examples/actions/BUILD @@ -2,4 +2,5 @@ python_sources() shell_sources( name="shell", + skip_shellcheck=True, ) diff --git a/contrib/examples/actions/bash_ping/BUILD b/contrib/examples/actions/bash_ping/BUILD index 6c95f66377d..31c2d6bc4c5 100644 --- a/contrib/examples/actions/bash_ping/BUILD +++ b/contrib/examples/actions/bash_ping/BUILD @@ -1 +1 @@ -shell_sources() +shell_sources(skip_shellcheck=True) diff --git a/contrib/examples/actions/bash_random/BUILD b/contrib/examples/actions/bash_random/BUILD index 6c95f66377d..787e6c8c11c 100644 --- a/contrib/examples/actions/bash_random/BUILD +++ b/contrib/examples/actions/bash_random/BUILD @@ -1 +1,5 @@ -shell_sources() +shell_sources( + overrides={ + "random2.sh": {"skip_shellcheck": True}, + }, +) diff --git a/contrib/linux/actions/BUILD b/contrib/linux/actions/BUILD index 3ba6abf4226..20fc0fa6ad5 100644 --- a/contrib/linux/actions/BUILD +++ b/contrib/linux/actions/BUILD @@ -2,4 +2,5 @@ python_sources() shell_sources( name="shell", + skip_shellcheck=True, ) diff --git a/pants.toml b/pants.toml index 8e61cf94ff8..51b1ab33473 100644 --- a/pants.toml +++ b/pants.toml @@ -15,6 +15,7 @@ backend_packages = [ # shell "pants.backend.shell", + "pants.backend.shell.lint.shellcheck", ] # pants ignores files in .gitignore, .*/ directories, /dist/ directory, and __pycache__. pants_ignore.add = [ diff --git a/st2actions/bin/BUILD b/st2actions/bin/BUILD index cfd8966f757..73f2312907c 100644 --- a/st2actions/bin/BUILD +++ b/st2actions/bin/BUILD @@ -4,4 +4,5 @@ python_sources( shell_sources( name="shell", + skip_shellcheck=True, ) diff --git a/st2common/bin/BUILD b/st2common/bin/BUILD index f3fe80bff89..f579a5aadcf 100644 --- a/st2common/bin/BUILD +++ b/st2common/bin/BUILD @@ -5,4 +5,5 @@ python_sources( shell_sources( name="shell", sources=["st2ctl", "st2-self-check", "st2-run-pack-tests"], + skip_shellcheck=True, ) diff --git a/st2common/bin/migrations/v2.1/BUILD b/st2common/bin/migrations/v2.1/BUILD index 3ba6abf4226..20fc0fa6ad5 100644 --- a/st2common/bin/migrations/v2.1/BUILD +++ b/st2common/bin/migrations/v2.1/BUILD @@ -2,4 +2,5 @@ python_sources() shell_sources( name="shell", + skip_shellcheck=True, ) diff --git a/st2tests/integration/BUILD b/st2tests/integration/BUILD index 7d014554b68..119746b34bb 100644 --- a/st2tests/integration/BUILD +++ b/st2tests/integration/BUILD @@ -1,3 +1,4 @@ shell_sources( name="shell", + skip_shellcheck=True, ) diff --git a/st2tests/st2tests/fixtures/packs/BUILD b/st2tests/st2tests/fixtures/packs/BUILD index 01ca6fa5562..b7582956e8c 100644 --- a/st2tests/st2tests/fixtures/packs/BUILD +++ b/st2tests/st2tests/fixtures/packs/BUILD @@ -14,6 +14,7 @@ resources( shell_sources( name="test_content_version_shell", + skip_shellcheck=True, sources=[ "test_content_version/**/*.sh", ], diff --git a/st2tests/testpacks/errorcheck/actions/BUILD b/st2tests/testpacks/errorcheck/actions/BUILD index 6c95f66377d..31c2d6bc4c5 100644 --- a/st2tests/testpacks/errorcheck/actions/BUILD +++ b/st2tests/testpacks/errorcheck/actions/BUILD @@ -1 +1 @@ -shell_sources() +shell_sources(skip_shellcheck=True) diff --git a/tools/BUILD b/tools/BUILD index c0eb325e9de..aa957dfd728 100644 --- a/tools/BUILD +++ b/tools/BUILD @@ -6,4 +6,5 @@ shell_sources( "*.sh", "st2-setup-*", ], + skip_shellcheck=True, ) From beae45f4e52a182c4aa67f4a945f2b91b19c433b Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Tue, 4 Oct 2022 21:47:48 -0500 Subject: [PATCH 4/4] update changelog entry --- CHANGELOG.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 77e0c8302db..b0aafea9c08 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -53,7 +53,7 @@ Added * Begin introducing `pants `_ to improve DX (Developer Experience) working on StackStorm, improve our security posture, and improve CI reliability thanks in part - to pants' use of PEX lockfiles. This is not a user-facing addition. #5713 #5724 #5726 #5725 #5732 #5733 #5737 #5738 #5758 + to pants' use of PEX lockfiles. This is not a user-facing addition. #5713 #5724 #5726 #5725 #5732 #5733 #5737 #5738 #5758 #5751 Contributed by @cognifloyd Changed