From 5421c532235b50cc92053689e39fc8b31bbf5c67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Pola=C5=A1ko?= Date: Wed, 3 Sep 2025 15:16:14 +0200 Subject: [PATCH 1/5] feat: Add Wiki page update to compatibility check workflow - Auto-generate detailed compatibility report in Wiki - Update README badge to link to Wiki page instead of workflow runs - Include summary, status indicators, and fix instructions - Only update Wiki on main branch pushes - Generate timestamps and links to workflow runs Assisted-by: Cursor --- .../check-backstage-compatibility.yaml | 165 ++++++++++++++++++ README.md | 2 +- 2 files changed, 166 insertions(+), 1 deletion(-) diff --git a/.github/workflows/check-backstage-compatibility.yaml b/.github/workflows/check-backstage-compatibility.yaml index d4046b2c..bee9d8be 100644 --- a/.github/workflows/check-backstage-compatibility.yaml +++ b/.github/workflows/check-backstage-compatibility.yaml @@ -110,3 +110,168 @@ jobs: permissions: contents: write + + update-wiki: + needs: + - check + runs-on: ubuntu-latest + if: always() && github.ref == 'refs/heads/main' + steps: + - name: Checkout repository + uses: actions/checkout@v5 + + - name: Checkout wiki + uses: actions/checkout@v5 + with: + repository: ${{ github.repository }}.wiki + path: wiki + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Generate compatibility markdown + env: + INPUT_INCOMPATIBLE_REQUIRED_WORKSPACES: ${{ needs.check.outputs.incompatible-required-workspaces }} + INPUT_INCOMPATIBLE_UNREQUIRED_WORKSPACES: ${{ needs.check.outputs.incompatible-unrequired-workspaces }} + GITHUB_SERVER_URL: ${{ github.server_url }} + GITHUB_REPOSITORY: ${{ github.repository }} + run: | + # Create the compatibility report markdown header + cat > compatibility-report.md << EOF + # Backstage Compatibility Report + + This page shows the current compatibility status of workspaces with the target Backstage version. + + > **Last Updated:** $(date -u '+%Y-%m-%d %H:%M:%S UTC') + > **Generated by:** [Check Backstage Compatibility Workflow](${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/workflows/check-backstage-compatibility.yaml) + + ## Summary + + EOF + + # Count incompatible workspaces + set +e + required_count=$(echo "${INPUT_INCOMPATIBLE_REQUIRED_WORKSPACES}" | grep -c . || echo "0") + unrequired_count=$(echo "${INPUT_INCOMPATIBLE_UNREQUIRED_WORKSPACES}" | grep -c . || echo "0") + set -e + + total_count=$((required_count + unrequired_count)) + + # Add summary + cat >> compatibility-report.md << EOF + - **Total Incompatible Workspaces:** ${total_count} + - **Required Workspaces (Critical):** ${required_count} + - **Optional Workspaces:** ${unrequired_count} + + EOF + + # Add status badge + if [ ${required_count} -gt 0 ]; then + status="**CRITICAL**" + color="critical" + elif [ ${unrequired_count} -gt 0 ]; then + status="**WARNING**" + color="important" + else + status="**ALL COMPATIBLE**" + color="success" + fi + + cat >> compatibility-report.md << EOF + **Status:** ${status} + + ![Compatibility Badge](https://img.shields.io/badge/Backstage_Compatibility-${total_count}_incompatible,_${required_count}_critical-${color}) + + EOF + + # Add incompatible required workspaces section + if [ ${required_count} -gt 0 ]; then + cat >> compatibility-report.md << 'EOF' + ## Incompatible Required Workspaces (Critical) + + These workspaces contain plugins that are mandatory for releases and must be fixed before the next release: + + EOF + + echo "${INPUT_INCOMPATIBLE_REQUIRED_WORKSPACES}" | while IFS= read -r workspace; do + if [ -n "$workspace" ]; then + echo "- \`${workspace}\`" >> compatibility-report.md + fi + done + echo "" >> compatibility-report.md + fi + + # Add incompatible unrequired workspaces section + if [ ${unrequired_count} -gt 0 ]; then + cat >> compatibility-report.md << 'EOF' + ## Incompatible Optional Workspaces + + These workspaces are incompatible but don't contain mandatory plugins: + + EOF + + echo "${INPUT_INCOMPATIBLE_UNREQUIRED_WORKSPACES}" | while IFS= read -r workspace; do + if [ -n "$workspace" ]; then + echo "- \`${workspace}\`" >> compatibility-report.md + fi + done + echo "" >> compatibility-report.md + fi + + # Add footer + cat >> compatibility-report.md << EOF + ## How to Fix Compatibility Issues + + 1. **Check the workflow logs** for specific error details + 2. **Update plugin versions** in the workspace's \`source.json\` + 3. **Test locally** before submitting fixes + 4. **Create a PR** with the compatibility fixes + + ## Related Links + + - [Compatibility Check Workflow Runs](${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/workflows/check-backstage-compatibility.yaml) + - [Main Repository](${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}) + - [Contributing Guide](${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/blob/main/CONTRIBUTING.md) + + --- + *This report is automatically generated and updated by GitHub Actions.* + EOF + + - name: Update wiki page + run: | + cd wiki + + # Configure git + git config user.name "GitHub Actions Bot" + git config user.email "github-actions[bot]@users.noreply.github.com" + + # Copy the generated markdown to wiki + cp ../compatibility-report.md "Backstage-Compatibility-Report.md" + + # Check if there are changes + if ! git diff --quiet; then + git add "Backstage-Compatibility-Report.md" + + # Calculate counts for commit message + required_count=$(echo "${INPUT_INCOMPATIBLE_REQUIRED_WORKSPACES}" | wc -w) + unrequired_count=$(echo "${INPUT_INCOMPATIBLE_UNREQUIRED_WORKSPACES}" | wc -w) + total_count=$((required_count + unrequired_count)) + + git commit -m "Update Backstage Compatibility Report + + - Total incompatible: ${total_count} + - Required: ${required_count} + - Optional: ${unrequired_count} + + Generated from: ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${{ github.run_id }}" + git push + echo "Wiki page updated successfully" + else + echo "No changes detected, wiki page is up to date" + fi + env: + INPUT_INCOMPATIBLE_REQUIRED_WORKSPACES: ${{ needs.check.outputs.incompatible-required-workspaces }} + INPUT_INCOMPATIBLE_UNREQUIRED_WORKSPACES: ${{ needs.check.outputs.incompatible-unrequired-workspaces }} + GITHUB_SERVER_URL: ${{ github.server_url }} + GITHUB_REPOSITORY: ${{ github.repository }} + + permissions: + contents: write diff --git a/README.md b/README.md index 90ba4410..58cb9ea3 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![Target Backstage Compatibility Badge](https://img.shields.io/endpoint?url=https%3A%2F%2Fraw.githubusercontent.com%2Fredhat-developer%2Frhdh-plugin-export-overlays%2Frefs%2Fheads%2Fmetadata%2Fincompatible-workspaces.json&style=flat&cacheSeconds=60)](https://github.com/redhat-developer/rhdh-plugin-export-overlays/actions/workflows/check-backstage-compatibility.yaml?query=event%3Apush) +[![Target Backstage Compatibility Badge](https://img.shields.io/endpoint?url=https%3A%2F%2Fraw.githubusercontent.com%2Fredhat-developer%2Frhdh-plugin-export-overlays%2Frefs%2Fheads%2Fmetadata%2Fincompatible-workspaces.json&style=flat&cacheSeconds=60)](https://github.com/redhat-developer/rhdh-plugin-export-overlays/wiki/Backstage-Compatibility-Report) [![Publish Images Badge](https://img.shields.io/github/actions/workflow/status/redhat-developer/rhdh-plugin-export-overlays/publish-workspace-plugins.yaml?branch=main&event=push&label=Publish%20RHDH%20Next%20Release%20Dynamic%20Plugin%20Images)](https://github.com/redhat-developer/rhdh-plugin-export-overlays/actions/workflows/publish-workspace-plugins.yaml?query=event%3Apush) From e96e2784dce7f03b86ba4d04b93b10abec32f3c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Pola=C5=A1ko?= Date: Wed, 3 Sep 2025 16:38:53 +0200 Subject: [PATCH 2/5] testing for changes --- .../check-backstage-compatibility.yaml | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/.github/workflows/check-backstage-compatibility.yaml b/.github/workflows/check-backstage-compatibility.yaml index bee9d8be..92526fc3 100644 --- a/.github/workflows/check-backstage-compatibility.yaml +++ b/.github/workflows/check-backstage-compatibility.yaml @@ -115,7 +115,7 @@ jobs: needs: - check runs-on: ubuntu-latest - if: always() && github.ref == 'refs/heads/main' + if: always() && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/feat/RHIDP-8649') steps: - name: Checkout repository uses: actions/checkout@v5 @@ -243,12 +243,21 @@ jobs: git config user.name "GitHub Actions Bot" git config user.email "github-actions[bot]@users.noreply.github.com" - # Copy the generated markdown to wiki - cp ../compatibility-report.md "Backstage-Compatibility-Report.md" + # Copy the generated markdown to wiki (use test name for testing branches) + if [ "${{ github.ref }}" = "refs/heads/feat/RHIDP-8649" ]; then + cp ../compatibility-report.md "Backstage-Compatibility-Report-TEST.md" + else + cp ../compatibility-report.md "Backstage-Compatibility-Report.md" + fi # Check if there are changes if ! git diff --quiet; then - git add "Backstage-Compatibility-Report.md" + # Add the appropriate file based on branch + if [ "${{ github.ref }}" = "refs/heads/feat/RHIDP-8649" ]; then + git add "Backstage-Compatibility-Report-TEST.md" + else + git add "Backstage-Compatibility-Report.md" + fi # Calculate counts for commit message required_count=$(echo "${INPUT_INCOMPATIBLE_REQUIRED_WORKSPACES}" | wc -w) From f58178687b0bd05c7eb3288f76e5e4a44c0d994f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Pola=C5=A1ko?= Date: Wed, 17 Sep 2025 17:55:45 +0200 Subject: [PATCH 3/5] update based on comments --- .../check-backstage-compatibility.yaml | 118 +++--------------- 1 file changed, 14 insertions(+), 104 deletions(-) diff --git a/.github/workflows/check-backstage-compatibility.yaml b/.github/workflows/check-backstage-compatibility.yaml index 92526fc3..48841465 100644 --- a/.github/workflows/check-backstage-compatibility.yaml +++ b/.github/workflows/check-backstage-compatibility.yaml @@ -127,114 +127,24 @@ jobs: path: wiki token: ${{ secrets.GITHUB_TOKEN }} - - name: Generate compatibility markdown - env: - INPUT_INCOMPATIBLE_REQUIRED_WORKSPACES: ${{ needs.check.outputs.incompatible-required-workspaces }} - INPUT_INCOMPATIBLE_UNREQUIRED_WORKSPACES: ${{ needs.check.outputs.incompatible-unrequired-workspaces }} - GITHUB_SERVER_URL: ${{ github.server_url }} - GITHUB_REPOSITORY: ${{ github.repository }} - run: | - # Create the compatibility report markdown header - cat > compatibility-report.md << EOF - # Backstage Compatibility Report - - This page shows the current compatibility status of workspaces with the target Backstage version. - - > **Last Updated:** $(date -u '+%Y-%m-%d %H:%M:%S UTC') - > **Generated by:** [Check Backstage Compatibility Workflow](${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/workflows/check-backstage-compatibility.yaml) - - ## Summary - - EOF - - # Count incompatible workspaces - set +e - required_count=$(echo "${INPUT_INCOMPATIBLE_REQUIRED_WORKSPACES}" | grep -c . || echo "0") - unrequired_count=$(echo "${INPUT_INCOMPATIBLE_UNREQUIRED_WORKSPACES}" | grep -c . || echo "0") - set -e - - total_count=$((required_count + unrequired_count)) - - # Add summary - cat >> compatibility-report.md << EOF - - **Total Incompatible Workspaces:** ${total_count} - - **Required Workspaces (Critical):** ${required_count} - - **Optional Workspaces:** ${unrequired_count} - - EOF + - name: Download compatibility report + uses: actions/download-artifact@v4 + with: + name: compatibility-report + path: ./ - # Add status badge - if [ ${required_count} -gt 0 ]; then - status="**CRITICAL**" - color="critical" - elif [ ${unrequired_count} -gt 0 ]; then - status="**WARNING**" - color="important" + - name: Verify downloaded artifact + run: | + echo "Files in current directory:" + ls -la + echo "Looking for compatibility report files:" + find . -name "*compatibility*" -o -name "*.md" | head -10 + if [ -f "compatibility-report.md" ]; then + echo "Found compatibility-report.md" else - status="**ALL COMPATIBLE**" - color="success" - fi - - cat >> compatibility-report.md << EOF - **Status:** ${status} - - ![Compatibility Badge](https://img.shields.io/badge/Backstage_Compatibility-${total_count}_incompatible,_${required_count}_critical-${color}) - - EOF - - # Add incompatible required workspaces section - if [ ${required_count} -gt 0 ]; then - cat >> compatibility-report.md << 'EOF' - ## Incompatible Required Workspaces (Critical) - - These workspaces contain plugins that are mandatory for releases and must be fixed before the next release: - - EOF - - echo "${INPUT_INCOMPATIBLE_REQUIRED_WORKSPACES}" | while IFS= read -r workspace; do - if [ -n "$workspace" ]; then - echo "- \`${workspace}\`" >> compatibility-report.md - fi - done - echo "" >> compatibility-report.md + echo "compatibility-report.md not found" fi - # Add incompatible unrequired workspaces section - if [ ${unrequired_count} -gt 0 ]; then - cat >> compatibility-report.md << 'EOF' - ## Incompatible Optional Workspaces - - These workspaces are incompatible but don't contain mandatory plugins: - - EOF - - echo "${INPUT_INCOMPATIBLE_UNREQUIRED_WORKSPACES}" | while IFS= read -r workspace; do - if [ -n "$workspace" ]; then - echo "- \`${workspace}\`" >> compatibility-report.md - fi - done - echo "" >> compatibility-report.md - fi - - # Add footer - cat >> compatibility-report.md << EOF - ## How to Fix Compatibility Issues - - 1. **Check the workflow logs** for specific error details - 2. **Update plugin versions** in the workspace's \`source.json\` - 3. **Test locally** before submitting fixes - 4. **Create a PR** with the compatibility fixes - - ## Related Links - - - [Compatibility Check Workflow Runs](${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/workflows/check-backstage-compatibility.yaml) - - [Main Repository](${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}) - - [Contributing Guide](${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/blob/main/CONTRIBUTING.md) - - --- - *This report is automatically generated and updated by GitHub Actions.* - EOF - - name: Update wiki page run: | cd wiki From 207932ae14304660d14afeed6feecbd606483e14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Pola=C5=A1ko?= Date: Fri, 19 Sep 2025 10:32:45 +0200 Subject: [PATCH 4/5] Improve compatibility report handling with fallback - Add fallback report creation when compatibility-report.md is missing - Better error messaging and verification of downloaded artifact --- .../check-backstage-compatibility.yaml | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/.github/workflows/check-backstage-compatibility.yaml b/.github/workflows/check-backstage-compatibility.yaml index 48841465..2dcf2754 100644 --- a/.github/workflows/check-backstage-compatibility.yaml +++ b/.github/workflows/check-backstage-compatibility.yaml @@ -132,17 +132,18 @@ jobs: with: name: compatibility-report path: ./ - - - name: Verify downloaded artifact + + - name: Verify compatibility report run: | - echo "Files in current directory:" - ls -la - echo "Looking for compatibility report files:" - find . -name "*compatibility*" -o -name "*.md" | head -10 if [ -f "compatibility-report.md" ]; then - echo "Found compatibility-report.md" + echo "Successfully downloaded compatibility-report.md" else - echo "compatibility-report.md not found" + echo "❌ compatibility-report.md not found, creating fallback report" + echo "# Backstage Compatibility Report" > compatibility-report.md + echo "" >> compatibility-report.md + echo "⚠️ **Report generation failed** - This is a fallback report." >> compatibility-report.md + echo "" >> compatibility-report.md + echo "Please check the workflow logs for more details." >> compatibility-report.md fi - name: Update wiki page From 38be359f2198a7cfb730870bac379864811b3031 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Pola=C5=A1ko?= Date: Tue, 23 Sep 2025 16:34:03 +0200 Subject: [PATCH 5/5] Fix wiki update logic in backstage compatibility workflow - Fail workflow instead of creating fallback report when compatibility report is missing - Remove test branch conditions for feat/RHIDP-8649 branch - Simplify wiki update to always use production filename --- .../check-backstage-compatibility.yaml | 26 +++++-------------- 1 file changed, 7 insertions(+), 19 deletions(-) diff --git a/.github/workflows/check-backstage-compatibility.yaml b/.github/workflows/check-backstage-compatibility.yaml index 2dcf2754..22e022d1 100644 --- a/.github/workflows/check-backstage-compatibility.yaml +++ b/.github/workflows/check-backstage-compatibility.yaml @@ -115,7 +115,7 @@ jobs: needs: - check runs-on: ubuntu-latest - if: always() && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/feat/RHIDP-8649') + if: always() && github.ref == 'refs/heads/main' steps: - name: Checkout repository uses: actions/checkout@v5 @@ -138,12 +138,8 @@ jobs: if [ -f "compatibility-report.md" ]; then echo "Successfully downloaded compatibility-report.md" else - echo "❌ compatibility-report.md not found, creating fallback report" - echo "# Backstage Compatibility Report" > compatibility-report.md - echo "" >> compatibility-report.md - echo "⚠️ **Report generation failed** - This is a fallback report." >> compatibility-report.md - echo "" >> compatibility-report.md - echo "Please check the workflow logs for more details." >> compatibility-report.md + echo "compatibility-report.md not found, failing workflow" + exit 1 fi - name: Update wiki page @@ -154,21 +150,13 @@ jobs: git config user.name "GitHub Actions Bot" git config user.email "github-actions[bot]@users.noreply.github.com" - # Copy the generated markdown to wiki (use test name for testing branches) - if [ "${{ github.ref }}" = "refs/heads/feat/RHIDP-8649" ]; then - cp ../compatibility-report.md "Backstage-Compatibility-Report-TEST.md" - else - cp ../compatibility-report.md "Backstage-Compatibility-Report.md" - fi + # Copy the generated markdown to wiki + cp ../compatibility-report.md "Backstage-Compatibility-Report.md" # Check if there are changes if ! git diff --quiet; then - # Add the appropriate file based on branch - if [ "${{ github.ref }}" = "refs/heads/feat/RHIDP-8649" ]; then - git add "Backstage-Compatibility-Report-TEST.md" - else - git add "Backstage-Compatibility-Report.md" - fi + # Add the file + git add "Backstage-Compatibility-Report.md" # Calculate counts for commit message required_count=$(echo "${INPUT_INCOMPATIBLE_REQUIRED_WORKSPACES}" | wc -w)