feat(repo): add deprecate-archived-plugins workflow from BCP#2664
Conversation
Signed-off-by: Christoph Jerolimov <jerolimov+git@redhat.com>
Review Summary by QodoAdd deprecate-archived-plugins workflow automation
WalkthroughsDescription• Add automated workflow to deprecate archived plugins • Implement bash script to process archived plugins list • Trigger deprecation on archived-plugins.json changes • Support dry-run mode for testing deprecations Diagramflowchart LR
A["archived-plugins.json"] -->|triggers on push| B["deprecate-archived-plugins.yml"]
B -->|runs| C["deprecate-archived-plugins.sh"]
C -->|reads| A
C -->|validates & deprecates| D["NPM Registry"]
File Changes1. scripts/ci/deprecate-archived-plugins.sh
|
Code Review by Qodo
1. Pipeline masks jq failure
|
| set -e | ||
|
|
||
| # Get script directory and archived file path | ||
| SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | ||
| ARCHIVED_FILE="$(dirname "$(dirname "$SCRIPT_DIR")")/.github/archived-plugins.json" | ||
|
|
||
| # Check if dry run (first argument) | ||
| DRY_RUN=${1:-false} | ||
|
|
||
| if [[ "$DRY_RUN" == "--dry-run" ]]; then | ||
| DRY_RUN=true | ||
| echo "DRY RUN MODE" | ||
| else | ||
| DRY_RUN=false | ||
| fi | ||
|
|
||
| echo "Processing archived packages..." | ||
|
|
||
| # Extract unique plugins from archived-plugins.json file | ||
| # Format: package_name|workspace|plugin|reason | ||
| jq -r ' | ||
| .archived | ||
| | unique_by(.pluginName) | ||
| | .[] | ||
| | "\(.pluginName)|\(.workspace)|\(.plugin)|\(.reason)" | ||
| ' "$ARCHIVED_FILE" | while IFS='|' read -r package_name workspace plugin reason; do |
There was a problem hiding this comment.
1. Pipeline masks jq failure 🐞 Bug ☼ Reliability
scripts/ci/deprecate-archived-plugins.sh uses set -e but pipes jq into a while loop without pipefail, so missing/invalid JSON (or a missing file) can cause jq to fail while the script still exits successfully. This can make the workflow report success while performing zero deprecations, hiding operational failures.
Agent Prompt
### Issue description
The deprecation script can silently succeed when `jq` fails (e.g., missing file, invalid JSON/query) because `set -e` does not catch failures inside a pipeline whose last command succeeds.
### Issue Context
The script currently does `jq ... "$ARCHIVED_FILE" | while ...; do ...; done`. In bash, without `set -o pipefail`, the pipeline status is the status of the `while` loop, not `jq`.
### Fix Focus Areas
- scripts/ci/deprecate-archived-plugins.sh[1-59]
### Suggested fix
- Switch to `set -euo pipefail`.
- Avoid piping into `while`; instead use process substitution:
- `while ...; do ...; done < <(jq -r '...' "$ARCHIVED_FILE")`
- Optionally add an explicit file check before running jq:
- `[[ -f "$ARCHIVED_FILE" ]] || { echo "Missing $ARCHIVED_FILE"; exit 1; }`
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
hopehadfield
left a comment
There was a problem hiding this comment.
Just a couple small changes but otherwise lgtm.
There's also a script in backstage/community-plugins that automates all the changes done in #2665, but it would need a number of changes for our repo. I'll move that over in future + add the instructions for archiving in our repo to capture the whole process, as I can imagine this won't be the last plugin we archive here😉
Co-authored-by: Hope Hadfield <hhadfiel@redhat.com>
Co-authored-by: Hope Hadfield <hhadfiel@redhat.com>
|
Thanks @hopehadfield, I saw that script but I expected that it wouldn't work directly. In general we should align our repo again. I applied both recommendations, please take a look again. Thanks :) |
|



Hey, I just made a Pull Request!
Just duplicated the deprecate-archived-plugins workflow from BCP.