Skip to content

Commit 6ba23a2

Browse files
authored
Merge pull request Azure#557 from Azure/canary
Canary
2 parents ee303da + 7a26a16 commit 6ba23a2

File tree

7 files changed

+386
-203
lines changed

7 files changed

+386
-203
lines changed

.github/workflows/url-checker.yml

+81
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
name: Check Broken Links
2+
3+
on:
4+
schedule:
5+
- cron: '0 0 * * *'
6+
push:
7+
branches:
8+
- canary
9+
- main
10+
# Enable manual triggering from GitHub Actions tab
11+
workflow_dispatch:
12+
inputs:
13+
fail-on-broken-links:
14+
description: 'Fail workflow if broken links are found'
15+
required: true
16+
type: choice
17+
default: 'false'
18+
options:
19+
- 'true'
20+
- 'false'
21+
22+
jobs:
23+
url-check:
24+
runs-on: ubuntu-latest
25+
26+
steps:
27+
- name: Checkout repository
28+
uses: actions/checkout@v4
29+
30+
- name: Set up Python
31+
uses: actions/setup-python@v4
32+
with:
33+
python-version: '3.x'
34+
35+
- name: Install dependencies
36+
run: |
37+
python -m pip install --upgrade pip
38+
pip install requests colorama
39+
40+
- name: Enable Color Output
41+
run: echo "FORCE_COLOR=1" >> $GITHUB_ENV
42+
43+
- name: Check for broken links
44+
id: check_links
45+
continue-on-error: true
46+
run: |
47+
python scripts/python/url-checker/url-checker.py
48+
EXIT_CODE=$?
49+
echo "link_check_exit_code=$EXIT_CODE" >> $GITHUB_OUTPUT
50+
51+
# Always display the summary clearly
52+
echo "### URL Check Results" >> $GITHUB_STEP_SUMMARY
53+
if [ $EXIT_CODE -eq 0 ]; then
54+
echo "✅ All links are valid!" >> $GITHUB_STEP_SUMMARY
55+
else
56+
echo "⚠️ Some broken links were found. Check the logs for details." >> $GITHUB_STEP_SUMMARY
57+
echo "Download the log artifacts for the complete report." >> $GITHUB_STEP_SUMMARY
58+
fi
59+
60+
- name: Upload log file
61+
if: always()
62+
uses: actions/upload-artifact@v4
63+
with:
64+
name: url-checker-log
65+
path: scripts/python/url-checker/logs/*.log
66+
67+
- name: Clean up environment
68+
if: always()
69+
run: rm -rf scripts/python/url-checker/__pycache__
70+
71+
- name: Debug values
72+
run: |
73+
echo "Event name: ${{ github.event_name }}"
74+
echo "Input fail-on-broken-links: ${{ github.event.inputs.fail-on-broken-links }}"
75+
echo "Link check exit code: ${{ steps.check_links.outputs.link_check_exit_code }}"
76+
77+
- name: Force workflow failure
78+
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.fail-on-broken-links == 'true' && steps.check_links.outputs.link_check_exit_code != '0' }}
79+
run: |
80+
echo "::error::Broken links were found in the documentation and fail-on-broken-links is set to true."
81+
exit 1

docs/azure_arc_jumpstart/azure_arc_data/day2/aks/aks_mssql_arm_template_ado/_index.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -195,4 +195,4 @@ In this scenario, you will create a new Release pipeline to deploy the environme
195195
196196
![Screenshot of Azure resources](./28.jpg)
197197
198-
- As mentioned, this scenario is focusing on the Azure DevOps Release pipeline creation. At this point, now that you have the Azure resources created, continue to the next steps as [described on in the main bootstrap scenario](../../../aks/aks_mssql_mi_arm_template/#windows-login--post-deployment).
198+
- As mentioned, this scenario is focusing on the Azure DevOps Release pipeline creation. At this point, now that you have the Azure resources created, continue to the next steps as [described on in the main bootstrap scenario](../../../aks/aks_mssql_mi_arm_template/#windows-login-post-deployment).

docs/azure_arc_jumpstart/azure_arc_data/day2/aks/aks_postgresql_arm_template_ado/_index.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -193,4 +193,4 @@ In this scenario, you will create a new Release pipeline to deploy the environme
193193
194194
![Screenshot of Azure resources](./27.jpg)
195195
196-
- As mentioned, this scenario is focusing on the Azure DevOps Release pipeline creation. At this point, now that you have the Azure resources created, continue to the next steps as [described on in the main bootstrap scenario](../../../aks/aks_postgresql_arm_template/#windows-login--post-deployment).
196+
- As mentioned, this scenario is focusing on the Azure DevOps Release pipeline creation. At this point, now that you have the Azure resources created, continue to the next steps as [described on in the main bootstrap scenario](../../../aks/aks_postgresql_arm_template/#windows-login-post-deployment).

docs/azure_jumpstart_arcbox/ITPro/_index.md

+1
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,7 @@ Enter-AzVM -ResourceGroupName $Env:resourceGroup -Name $serverName -LocalUser $l
377377
```
378378

379379
2. Configure role assignments for the Arc-enabled server _ArcBox-Ubuntu-01_ using the Azure portal. Two Azure roles are used to authorize VM login:
380+
380381
- **Virtual Machine Administrator Login**: Users who have this role assigned can log in to an Azure virtual machine with administrator privileges.
381382
- **Virtual Machine User Login**: Users who have this role assigned can log in to an Azure virtual machine with regular user privileges.
382383

scripts/python/url-checker/README.md

+79
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# Jumpstart Markdown URL Checker
2+
3+
This Python script (`url_checker.py`) checks for broken URLs in all Markdown within a Git repository. The script scans all files, extracts URLs, and verifies if they are reachable.
4+
5+
## Features
6+
7+
- Checks both absolute and relative URLs.
8+
- Skips email URLs and localhost/IP-based URLs.
9+
- Logs results to a timestamped log file.
10+
- Provides a summary of broken and valid URLs.
11+
- Supports short URLs.
12+
13+
## Requirements
14+
15+
- Python 3.x
16+
- `requests` library
17+
- `colorama` library
18+
19+
You can install the required libraries using pip:
20+
21+
```sh
22+
pip install requests colorama
23+
```
24+
25+
## Usage
26+
27+
1. Clone the repository and navigate to the directory:
28+
29+
```sh
30+
git clone <repository-url>
31+
cd arc_jumpstart_docs
32+
```
33+
34+
2. Run the script:
35+
36+
```sh
37+
python scripts/python/url_checker/url_checker.py
38+
```
39+
40+
The script will start scanning all files in the repository, checking URLs, and logging the results.
41+
42+
## Output
43+
44+
The script generates a log file with a timestamp in the format `broken_urls_YYYY-MM-DD_HH-MM-SS.log`. The log file contains:
45+
46+
- Total broken absolute URLs
47+
- Total OK absolute URLs
48+
- Total broken relative URLs
49+
- Total OK relative URLs
50+
- Detailed lists of broken and valid URLs
51+
52+
## Example
53+
54+
```sh
55+
python scripts/python/url_checker/url_checker.py
56+
```
57+
58+
Output:
59+
60+
```console
61+
Starting URL check...
62+
Processing markdown file: /path/to/file.md
63+
Checking absolute URL: https://example.com
64+
[OK] https://example.com
65+
...
66+
Check complete. See broken_urls_2023-10-01_12-00-00.log for details.
67+
68+
Summary:
69+
Total broken absolute URLs: 2
70+
Total OK absolute URLs: 10
71+
Total broken relative URLs: 1
72+
Total OK relative URLs: 5
73+
```
74+
75+
## Notes
76+
77+
- The script skips URLs that start with `mailto:` and `http://localhost`.
78+
- You can add known valid URLs to the `KNOWN_VALID_URLS` list in the script to skip checking them.
79+
- The script supports short URLs.

0 commit comments

Comments
 (0)