|
| 1 | +name: Shell Dependencies File Checker |
| 2 | + |
| 3 | +description: | |
| 4 | + Checks shell script files for missing dependencies and GNU coreutils compatibility issues. |
| 5 | + This test analyzes shell scripts and validates that all external command dependencies exist in the |
| 6 | + specified PATH and detects GNU-specific flags that won't work with busybox. Essential for ensuring |
| 7 | + shell scripts work correctly in minimal environments. |
| 8 | +
|
| 9 | +needs: |
| 10 | + packages: |
| 11 | + - tw |
| 12 | + |
| 13 | +inputs: |
| 14 | + files: |
| 15 | + description: | |
| 16 | + Shell script file paths to check, space-separated or one per line. |
| 17 | + Supports glob patterns (e.g., /usr/bin/*.sh). |
| 18 | + Examples: |
| 19 | + Single file: "/usr/bin/entrypoint.sh" |
| 20 | + Multiple files: "/usr/bin/script1.sh /usr/bin/script2.sh" |
| 21 | + With globs: "/opt/scripts/*.sh" |
| 22 | + required: true |
| 23 | + path: |
| 24 | + description: | |
| 25 | + PATH-like colon-separated directories to search for commands. |
| 26 | + Defaults to /usr/bin for broader command coverage. |
| 27 | + required: false |
| 28 | + default: "/usr/bin" |
| 29 | + strict: |
| 30 | + description: | |
| 31 | + Exit with non-zero status if any issues are found. |
| 32 | + Set to false for report-only mode. |
| 33 | + required: false |
| 34 | + default: true |
| 35 | + verbose: |
| 36 | + description: | |
| 37 | + Enable verbose output for detailed debugging information. |
| 38 | + required: false |
| 39 | + default: false |
| 40 | + |
| 41 | +# USAGE EXAMPLES: |
| 42 | +# |
| 43 | +# Single file check: |
| 44 | +# - uses: test/tw/shell-deps-check |
| 45 | +# with: |
| 46 | +# files: /usr/bin/entrypoint.sh |
| 47 | +# |
| 48 | +# Multiple files: |
| 49 | +# - uses: test/tw/shell-deps-check |
| 50 | +# with: |
| 51 | +# files: | |
| 52 | +# /usr/bin/script1.sh |
| 53 | +# /usr/bin/script2.sh |
| 54 | +# |
| 55 | +# With glob pattern: |
| 56 | +# - uses: test/tw/shell-deps-check |
| 57 | +# with: |
| 58 | +# files: /opt/scripts/*.sh |
| 59 | +# |
| 60 | +# Report-only mode with verbose output: |
| 61 | +# - uses: test/tw/shell-deps-check |
| 62 | +# with: |
| 63 | +# files: /usr/bin/*.sh |
| 64 | +# strict: false |
| 65 | +# verbose: true |
| 66 | +pipeline: |
| 67 | + - name: "check shell script dependencies" |
| 68 | + runs: | |
| 69 | + VERBOSE_FLAG="" |
| 70 | + if [ "${{inputs.verbose}}" = "true" ]; then |
| 71 | + VERBOSE_FLAG="--verbose" |
| 72 | + fi |
| 73 | +
|
| 74 | + tw shell-deps check \ |
| 75 | + --path="${{inputs.path}}" \ |
| 76 | + --strict="${{inputs.strict}}" \ |
| 77 | + $VERBOSE_FLAG \ |
| 78 | + ${{inputs.files}} |
0 commit comments