Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ file(

shell_sources(
name="root",
skip_shfmt=True,
)

file(
Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ Added
to pants' use of PEX lockfiles. This is not a user-facing addition.
#6118 #6141 #6133 #6120 #6181 #6183 #6200 #6237 #6229 #6240 #6241 #6244 #6251 #6253
#6254 #6258 #6259 #6260 #6269 #6275 #6279 #6278 #6282 #6283 #6273 #6287 #6306 #6307
#6311 #6314 #6315
#6311 #6314 #6315 #6317
Contributed by @cognifloyd
* Build of ST2 EL9 packages #6153
Contributed by @amanda11
Expand Down
1 change: 1 addition & 0 deletions contrib/core/actions/send_mail/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ st2_shell_sources_and_resources(
name="send_mail",
sources=["send_mail"],
skip_shellcheck=True,
skip_shfmt=True,
)
1 change: 1 addition & 0 deletions contrib/examples/actions/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ python_sources()
shell_sources(
name="shell",
skip_shellcheck=True,
skip_shfmt=True,
)
2 changes: 1 addition & 1 deletion contrib/examples/actions/bash_exit_code/BUILD
Original file line number Diff line number Diff line change
@@ -1 +1 @@
shell_sources()
shell_sources(skip_shfmt=True)
1 change: 1 addition & 0 deletions contrib/examples/actions/bash_random/BUILD
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
shell_sources(
skip_shfmt=True,
overrides={
"random2.sh": dict(skip_shellcheck=True),
},
Expand Down
1 change: 1 addition & 0 deletions contrib/linux/actions/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ python_sources()
shell_sources(
name="shell",
skip_shellcheck=True,
skip_shfmt=True,
)
11 changes: 5 additions & 6 deletions packaging/deb/scripts/post-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,15 @@ set -e

case "$1" in
configure)
# make sure that our socket generators run
systemctl daemon-reload >/dev/null 2>&1 || true
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
# make sure that our socket generators run
systemctl daemon-reload >/dev/null 2>&1 || true
;;
abort-upgrade | abort-remove | abort-deconfigure) ;;

*)
echo "postinst called with unknown argument \`$1'" >&2
exit 1
;;
;;
esac

# dh_installdeb will replace this with shell code automatically
Expand Down
7 changes: 3 additions & 4 deletions packaging/deb/scripts/post-remove.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,12 @@ purge_files() {
case "$1" in
purge)
purge_files
;;
remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
;;
;;
remove | upgrade | failed-upgrade | abort-install | abort-upgrade | disappear) ;;
*)
echo "postrm called with unknown argument \`$1'" >&2
exit 1
;;
;;
esac

# dh_installdeb will replace this with shell code automatically
Expand Down
41 changes: 20 additions & 21 deletions packaging/deb/scripts/pre-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,35 +22,34 @@ ST2_USER=st2

## Create stackstorm users and groups
create_users() {
# create st2 user (services user)
(id $ST2_USER 1>/dev/null 2>&1) ||
adduser --group --disabled-password --no-create-home --system $ST2_USER

# make st2 member of st2packs group
(getent group $PACKS_GROUP 1>/dev/null 2>&1) || groupadd -r $PACKS_GROUP
(groups $ST2_USER 2>/dev/null | grep -q "\b${PACKS_GROUP}\b") ||
usermod -a -G $PACKS_GROUP $ST2_USER

# create stanley user (for actionrunner service)
if (! id $SYS_USER 1>/dev/null 2>&1); then
adduser --group $SYS_USER
adduser --disabled-password --gecos "" --ingroup $SYS_USER $SYS_USER
fi
# create st2 user (services user)
(id $ST2_USER 1>/dev/null 2>&1) ||
adduser --group --disabled-password --no-create-home --system $ST2_USER

# make st2 member of st2packs group
(getent group $PACKS_GROUP 1>/dev/null 2>&1) || groupadd -r $PACKS_GROUP
(groups $ST2_USER 2>/dev/null | grep -q "\b${PACKS_GROUP}\b") ||
usermod -a -G $PACKS_GROUP $ST2_USER

# create stanley user (for actionrunner service)
if (! id $SYS_USER 1>/dev/null 2>&1); then
adduser --group $SYS_USER
adduser --disabled-password --gecos "" --ingroup $SYS_USER $SYS_USER
fi
}

case "$1" in
install)
create_users
;;
create_users
;;
upgrade)
create_users
;;
abort-upgrade)
;;
create_users
;;
abort-upgrade) ;;
*)
echo "preinst called with unknown argument \`$1'" >&2
exit 1
;;
;;
esac

# dh_installdeb will replace this with shell code automatically
Expand Down
20 changes: 10 additions & 10 deletions packaging/rpm/scripts/pre-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,18 @@ ST2_USER=%{svc_user}

## Create stackstorm users and groups (differs from debian)
create_users() {
# create st2 user (services user)
(id $ST2_USER 1>/dev/null 2>&1) ||
adduser --no-create-home --system --user-group $ST2_USER
# create st2 user (services user)
(id $ST2_USER 1>/dev/null 2>&1) ||
adduser --no-create-home --system --user-group $ST2_USER

# make st2 member of st2packs group
(getent group $PACKS_GROUP 1>/dev/null 2>&1) || groupadd -r $PACKS_GROUP
(groups $ST2_USER 2>/dev/null | grep -q "\b${PACKS_GROUP}\b") ||
usermod -a -G $PACKS_GROUP $ST2_USER
# make st2 member of st2packs group
(getent group $PACKS_GROUP 1>/dev/null 2>&1) || groupadd -r $PACKS_GROUP
(groups $ST2_USER 2>/dev/null | grep -q "\b${PACKS_GROUP}\b") ||
usermod -a -G $PACKS_GROUP $ST2_USER

# create stanley user (unprivileged action user, we don't ship sudoers.d config)
(id $SYS_USER 1>/dev/null 2>&1) ||
adduser --user-group $SYS_USER
# create stanley user (unprivileged action user, we don't ship sudoers.d config)
(id $SYS_USER 1>/dev/null 2>&1) ||
adduser --user-group $SYS_USER
}

create_users
1 change: 1 addition & 0 deletions pants-plugins/macros.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ def st2_shell_sources_and_resources(**kwargs):
shell_sources(**kwargs) # noqa: F821

kwargs.pop("skip_shellcheck", None)
kwargs.pop("skip_shfmt", None)

kwargs["name"] += "_resources"
resources(**kwargs) # noqa: F821
Expand Down
8 changes: 8 additions & 0 deletions pants.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ backend_packages = [
# shell
"pants.backend.shell",
"pants.backend.shell.lint.shellcheck",
"pants.backend.shell.lint.shfmt",

# packaging
"pants.backend.experimental.makeself",
Expand Down Expand Up @@ -236,6 +237,13 @@ config = "@lint-configs/regex-lint.yaml"
[setuptools]
install_from_resolve = "st2"

[shfmt]
args = [
# https://github.com/mvdan/sh/blob/master/cmd/shfmt/shfmt.1.scd#printer-flags
"--indent=4", # default is 0 (use tabs)
"--case-indent",
]

[test]
extra_env_vars = [
# Use this so that the test system does not require the stanley user.
Expand Down
1 change: 1 addition & 0 deletions scripts/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ python_sources()

shell_sources(
name="shell",
skip_shfmt=True,
)
2 changes: 1 addition & 1 deletion scripts/ci/BUILD
Original file line number Diff line number Diff line change
@@ -1 +1 @@
shell_sources()
shell_sources(skip_shfmt=True)
1 change: 1 addition & 0 deletions scripts/github/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ files(

shell_sources(
dependencies=[":assets"],
skip_shfmt=True,
)
1 change: 1 addition & 0 deletions st2actions/bin/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ st2_shell_sources_and_resources(
name="shell",
sources=["*.sh"],
skip_shellcheck=True,
skip_shfmt=True,
)
1 change: 1 addition & 0 deletions st2common/bin/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ st2_shell_sources_and_resources(
name="shell",
sources=["st2ctl", "st2-self-check", "st2-run-pack-tests"],
skip_shellcheck=True,
skip_shfmt=True,
overrides={
"st2ctl": dict(
dependencies=[
Expand Down
1 change: 1 addition & 0 deletions st2common/bin/migrations/v2.1/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ python_sources()
shell_sources(
name="shell",
skip_shellcheck=True,
skip_shfmt=True,
)
1 change: 1 addition & 0 deletions st2common/tests/fixtures/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ python_sources()
st2_shell_sources_and_resources(
name="shell",
sources=["*.sh"],
skip_shfmt=True,
)
1 change: 1 addition & 0 deletions st2tests/integration/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ shell_sources(
"st2tests/conf:vagrant_ssh_key",
],
skip_shellcheck=True,
skip_shfmt=True,
)
1 change: 1 addition & 0 deletions st2tests/st2tests/fixtures/generic/actions/BUILD
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
st2_shell_sources_and_resources(
name="shell",
sources=["*.sh"],
skip_shfmt=True,
)
1 change: 1 addition & 0 deletions st2tests/st2tests/fixtures/packs/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ st2_shell_sources_and_resources(
name="test_content_version_shell",
# do not check across git submodule boundary
skip_shellcheck=True,
skip_shfmt=True,
sources=[
"test_content_version/**/*.sh",
],
Expand Down
1 change: 1 addition & 0 deletions st2tests/st2tests/fixtures/ssl_certs/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ python_sources(

shell_sources(
name="util",
skip_shfmt=True,
)
2 changes: 1 addition & 1 deletion st2tests/testpacks/errorcheck/actions/BUILD
Original file line number Diff line number Diff line change
@@ -1 +1 @@
shell_sources(skip_shellcheck=True)
shell_sources(skip_shellcheck=True, skip_shfmt=True)
1 change: 1 addition & 0 deletions tools/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ shell_sources(
"st2-setup-*",
],
skip_shellcheck=True,
skip_shfmt=True,
dependencies=[
"conf:st2_dev_conf",
],
Expand Down
Loading