Skip to content

Commit 1ce9045

Browse files
polasudodavidfestal
authored andcommitted
feat: Save Backstage compatibility report as artifact
- Create markdown file (backstage-compatibility-report.md) with compatibility report - Upload as artifact for consumption by calling workflows - Maintain existing step summary behavior - Handle both compatible and incompatible workspace scenarios - Artifact retains for 30 days
1 parent bb91531 commit 1ce9045

File tree

1 file changed

+45
-36
lines changed

1 file changed

+45
-36
lines changed

.github/workflows/check-backstage-compatibility.yaml

Lines changed: 45 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -203,30 +203,36 @@ jobs:
203203
echo "::error title=Incompatible backstage versions::${message}."
204204
fi
205205
206-
echo "## Backsatge-incompatible workspaces" >> $GITHUB_STEP_SUMMARY
207-
echo "" >> $GITHUB_STEP_SUMMARY
208-
echo "Some workspaces have a backstage version (in sources or in their overlay folder) which is *__incompatible__* with the target Backstage version (\`${targetBackstageVersion}\`)." >> $GITHUB_STEP_SUMMARY
209-
echo "${message}:" >> $GITHUB_STEP_SUMMARY
210-
echo "| Folder | Backstage version | Mandatory | Info |" >> $GITHUB_STEP_SUMMARY
211-
echo "|--------|-------------------|-----------|-------|" >> $GITHUB_STEP_SUMMARY
212-
for key in "${!incompatibleRequiredWorkspaces[@]}"
213-
do
214-
echo "| [${key}](https://github.com/${INPUT_OVERLAY_REPO}/tree/${INPUT_OVERLAY_REPO_REF}/${key}) | ${incompatibleRequiredWorkspaces[$key]} | :red_circle: | ${infos[$key]} |" >> $GITHUB_STEP_SUMMARY
215-
done
216-
for key in "${!incompatibleUnrequiredWorkspaces[@]}"
217-
do
218-
echo "| [${key}](https://github.com/${INPUT_OVERLAY_REPO}/tree/${INPUT_OVERLAY_REPO_REF}/${key}) | ${incompatibleUnrequiredWorkspaces[$key]} | :white_circle: | ${infos[$key]} |" >> $GITHUB_STEP_SUMMARY
219-
done
220-
echo "" >> $GITHUB_STEP_SUMMARY
221-
echo "### How to fix" >> $GITHUB_STEP_SUMMARY
222-
echo "You have 3 main options:" >> $GITHUB_STEP_SUMMARY
223-
echo '- *__Use the already-opened PR :__* For automatically-discovered workspaces, there might already be an automatically-opened PR that updates the commit to the target backstage version (`Automatic PR` link in column 4 above): just publish the plugins and test them from the PR by following the PR instructions.' >> $GITHUB_STEP_SUMMARY
224-
echo '- *__Manually update the workspace commit :__*' >> $GITHUB_STEP_SUMMARY
225-
echo ' - Find a newer commit, with a backstage version compatible with the target backstage version :__*' >> $GITHUB_STEP_SUMMARY
226-
echo ' - *__Backstage version history available__*: A `BS Version History` link might be available in column 4: in the workspace source repository, it points to the list of commits touching the `backstage.json` file. This would help you finding out whether this workspace has a commit that has been published for the target backstage version.' >> $GITHUB_STEP_SUMMARY
227-
echo ' - *__No info available__*: If no information is is provided in column 4, the `backstage.json` probably does not exist in workspace sources. You would have to look deeper into the newer commits of workspace sources, possibly in the low-level dependencies in the `package.json` files, to find out a commit with an underlying backstage version compatible with the target backstage version.' >> $GITHUB_STEP_SUMMARY
228-
echo ' - Then, in the overlay repository, update the `repo-ref` field of the `source.json` file to the new source commit, and remember to also change the `repo-backstage-version` field to the corresponding compatible backstage version.' >> $GITHUB_STEP_SUMMARY
229-
echo '- *__No compatible commit :__* If the workspace sources contain __*no compatible newer commit*__ ( == a commit that provides a `backstage.json` version compatible with the target backstage), but the current workspace commit is known to work with the target backstage version, then you can override the declared backstage version compatibility for this workspace commit in the overlay repository: add a `backstage.json` file at the root of the overlay workspace folder with the desired target backstage version, and remember to also change the `repo-backstage-version` field of the `source.json` file to the same target backstage version. This would require full testing of the workspace plugins on the target backstage though.' >> $GITHUB_STEP_SUMMARY
206+
# Create compatibility report markdown file
207+
REPORT_FILE="backstage-compatibility-report.md"
208+
209+
# Write markdown content to both file and step summary
210+
{
211+
echo "## Backstage-incompatible workspaces"
212+
echo ""
213+
echo "Some workspaces have a backstage version (in sources or in their overlay folder) which is *__incompatible__* with the target Backstage version (\`${targetBackstageVersion}\`)."
214+
echo "${message}:"
215+
echo "| Folder | Backstage version | Mandatory | Info |"
216+
echo "|--------|-------------------|-----------|-------|"
217+
for key in "${!incompatibleRequiredWorkspaces[@]}"
218+
do
219+
echo "| [${key}](https://github.com/${INPUT_OVERLAY_REPO}/tree/${INPUT_OVERLAY_REPO_REF}/${key}) | ${incompatibleRequiredWorkspaces[$key]} | :red_circle: | ${infos[$key]} |"
220+
done
221+
for key in "${!incompatibleUnrequiredWorkspaces[@]}"
222+
do
223+
echo "| [${key}](https://github.com/${INPUT_OVERLAY_REPO}/tree/${INPUT_OVERLAY_REPO_REF}/${key}) | ${incompatibleUnrequiredWorkspaces[$key]} | :white_circle: | ${infos[$key]} |"
224+
done
225+
echo ""
226+
echo "### How to fix"
227+
echo "You have 3 main options:"
228+
echo '- *__Use the already-opened PR :__* For automatically-discovered workspaces, there might already be an automatically-opened PR that updates the commit to the target backstage version (`Automatic PR` link in column 4 above): just publish the plugins and test them from the PR by following the PR instructions.'
229+
echo '- *__Manually update the workspace commit :__*'
230+
echo ' - Find a newer commit, with a backstage version compatible with the target backstage version :__*'
231+
echo ' - *__Backstage version history available__*: A `BS Version History` link might be available in column 4: in the workspace source repository, it points to the list of commits touching the `backstage.json` file. This would help you finding out whether this workspace has a commit that has been published for the target backstage version.'
232+
echo ' - *__No info available__*: If no information is is provided in column 4, the `backstage.json` probably does not exist in workspace sources. You would have to look deeper into the newer commits of workspace sources, possibly in the low-level dependencies in the `package.json` files, to find out a commit with an underlying backstage version compatible with the target backstage version.'
233+
echo ' - Then, in the overlay repository, update the `repo-ref` field of the `source.json` file to the new source commit, and remember to also change the `repo-backstage-version` field to the corresponding compatible backstage version.'
234+
echo '- *__No compatible commit :__* If the workspace sources contain __*no compatible newer commit*__ ( == a commit that provides a `backstage.json` version compatible with the target backstage), but the current workspace commit is known to work with the target backstage version, then you can override the declared backstage version compatibility for this workspace commit in the overlay repository: add a `backstage.json` file at the root of the overlay workspace folder with the desired target backstage version, and remember to also change the `repo-backstage-version` field of the `source.json` file to the same target backstage version. This would require full testing of the workspace plugins on the target backstage though.'
235+
} | tee -a "$REPORT_FILE" >> $GITHUB_STEP_SUMMARY
230236
231237
if [[ "${INPUT_FAIL_FOR_REQUIRED_ONLY}" != "true" ]]
232238
then
@@ -236,19 +242,22 @@ jobs:
236242
then
237243
exit 1
238244
fi
245+
else
246+
# Create empty report file when there are no incompatible workspaces
247+
REPORT_FILE="backstage-compatibility-report.md"
248+
{
249+
echo "## Backstage Compatibility Check"
250+
echo ""
251+
echo "✅ All workspaces are compatible with the target Backstage version (\`${targetBackstageVersion}\`)."
252+
echo ""
253+
echo "_No action required._"
254+
} > "$REPORT_FILE"
239255
fi
240256
241-
- name: Generate compatibility report markdown
242-
if: always() # Generate even if compatibility check failed
243-
run: |
244-
# Copy the step summary to a markdown file for artifact
245-
cp "$GITHUB_STEP_SUMMARY" compatibility-report.md
246-
echo "Generated compatibility report markdown file"
247-
248-
- name: Upload compatibility report artifact
249-
if: always()
257+
- name: Upload compatibility report
250258
uses: actions/upload-artifact@v4
259+
if: always()
251260
with:
252-
name: compatibility-report
253-
path: compatibility-report.md
254-
retention-days: 7
261+
name: backstage-compatibility-report
262+
path: backstage-compatibility-report.md
263+
retention-days: 30

0 commit comments

Comments
 (0)