@biffo/cli 0.241.0 → 0.241.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/scripts/verify.sh +37 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@biffo/cli",
3
- "version": "0.241.0",
3
+ "version": "0.241.1",
4
4
  "description": "Biffo project scaffolding CLI",
5
5
  "license": "MIT",
6
6
  "type": "module",
package/scripts/verify.sh CHANGED
@@ -720,7 +720,7 @@ else
720
720
  fi
721
721
 
722
722
  # Terraform, wherever this repo keeps it: modules/ in the template and
723
- # instances, infra/ and modules/ in siblings.
723
+ # instances, infra/ and modules/ in siblings, terraform/ in the runner fleets.
724
724
  if [ -n "$LIST" ] || command -v terraform >/dev/null 2>&1; then
725
725
  # Scope must match this repo's CI, not exceed it. The template and instances
726
726
  # deliberately fmt-check modules/ ONLY: infra/environments/ is user-owned, and
@@ -731,11 +731,46 @@ if [ -n "$LIST" ] || command -v terraform >/dev/null 2>&1; then
731
731
  tf_dirs=""
732
732
  [ -d modules ] && tf_dirs="$tf_dirs modules/"
733
733
  [ -f biffo.sibling.json ] && [ -d infra ] && tf_dirs="$tf_dirs infra/"
734
+ # terraform/ is the whole of a runner fleet (#1239). Both fleets kept every
735
+ # .tf file there, which is neither of the two directories above, so `tf_dirs`
736
+ # came out empty and this gate printed `no terraform in this repo` -- in the
737
+ # two repos that are nothing BUT terraform. Their CI does check it
738
+ # (`terraform fmt -check -recursive terraform/`), so the gap was local only:
739
+ # the gate that exists to catch this before the push was the one thing not
740
+ # catching it. No repo in the estate holds both terraform/ and modules/, so
741
+ # adding it cannot widen scope anywhere that was already covered.
742
+ [ -d terraform ] && tf_dirs="$tf_dirs terraform/"
734
743
  if [ -n "$tf_dirs" ]; then
735
744
  # shellcheck disable=SC2086
736
745
  ci_has "terraform fmt" && run_check terraform-fmt terraform fmt -check -recursive $tf_dirs
737
746
  else
738
- skip terraform-fmt "no terraform in this repo"
747
+ # Distinguish "this repo has no terraform" from "this repo has terraform
748
+ # somewhere I do not look". The old message asserted the first and was
749
+ # printed for the second, which is the difference between a considered skip
750
+ # and a blind spot wearing its clothes -- the same shape as a branch audit
751
+ # dropping the repos it could not read (#1145) and reporting the remainder
752
+ # as the whole.
753
+ # Pruned rather than filtered, and NOT capped: `| head -20 | wc -l` would
754
+ # silently report 20 for a repo with 200, and a count that stops counting is
755
+ # the denominator defect this estate keeps re-learning.
756
+ _tf_stray=$(find . \
757
+ \( -name .git -o -name .worktrees -o -name .terraform -o -name node_modules \) -prune \
758
+ -o -name '*.tf' -print 2>/dev/null | wc -l | tr -d ' ')
759
+ if [ "${_tf_stray:-0}" -gt 0 ] && [ -z "$LIST" ]; then
760
+ # A WARN, not a skip and not a failure -- exactly the posture pg-test
761
+ # takes above for "the repo HAS the thing and the gate is blind to it".
762
+ # Not a failure because the right scope depends on what this repo's CI
763
+ # covers, which this gate cannot decide for a layout nobody has declared.
764
+ NOT_RUN="$NOT_RUN terraform-fmt"
765
+ printf ' \033[33mWARN\033[0m %-16s NOT RUN - %s .tf file(s) present, none in a directory this gate checks\n' \
766
+ "terraform-fmt" "$_tf_stray"
767
+ printf ' \033[33m%s\033[0m\n' \
768
+ "it looks in modules/, infra/ (siblings) and terraform/ - this repo uses none of them"
769
+ printf ' \033[90m%s\033[0m\n' \
770
+ "add the directory to the tf_dirs block in scripts/verify.sh (biffo-template#1239)"
771
+ else
772
+ skip terraform-fmt "no .tf files in modules/, infra/ or terraform/"
773
+ fi
739
774
  fi
740
775
  else
741
776
  skip terraform-fmt "terraform not installed"