From 07d3066f1d790245673d3199ecaa250f98b2561c Mon Sep 17 00:00:00 2001 From: Aviral Singh Date: Mon, 2 Oct 2023 16:50:08 +0530 Subject: [PATCH 1/9] [enhancement]: Automatically linkcheck in CI Signed-off-by: Aviral Singh --- .github/workflows/linkcheck.yml | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 .github/workflows/linkcheck.yml diff --git a/.github/workflows/linkcheck.yml b/.github/workflows/linkcheck.yml new file mode 100644 index 00000000000..d1d7223d399 --- /dev/null +++ b/.github/workflows/linkcheck.yml @@ -0,0 +1,33 @@ +name: linkcheck in CI + +on: + push: + branches: + - main + pull_request: + workflow_dispatch: + inputs: + failOnError: + description: 'Fail job on link check error' + required: false + default: 'false' + +jobs: + linkcheck: + runs-on: ubuntu-22.04 + continue-on-error: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.failOnError == 'true' ? false : true }} + + steps: + - name: Checkout Repository + uses: actions/checkout@v3.0.0 + + - name: "Install Python 3.10" + uses: actions/setup-python@v4 + with: + python-version: '3.10.8' + + - name: Install tox + run: pip install tox + + - name: Run Sphinx linkcheck + run: tox -e linkcheck From 08062290c0b6a39d61457e5b2a7e13f8ebffb432 Mon Sep 17 00:00:00 2001 From: Aviral Singh Date: Mon, 2 Oct 2023 18:01:09 +0530 Subject: [PATCH 2/9] [enhancement]: Automatically linkcheck in CI Signed-off-by: Aviral Singh --- .github/workflows/linkcheck.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/linkcheck.yml b/.github/workflows/linkcheck.yml index d1d7223d399..f7f87d6026e 100644 --- a/.github/workflows/linkcheck.yml +++ b/.github/workflows/linkcheck.yml @@ -4,7 +4,7 @@ on: push: branches: - main - pull_request: + pull_request: {} workflow_dispatch: inputs: failOnError: @@ -15,7 +15,7 @@ on: jobs: linkcheck: runs-on: ubuntu-22.04 - continue-on-error: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.failOnError == 'true' ? false : true }} + continue-on-error:${{ github.event_name == 'workflow_dispatch' && github.event.inputs.failOnError == 'true' ? false : true }} steps: - name: Checkout Repository From 6fb527bf006b80cbdc3ce6e7d156b3dfab6b07e0 Mon Sep 17 00:00:00 2001 From: Aviral Singh Date: Mon, 2 Oct 2023 18:09:02 +0530 Subject: [PATCH 3/9] [enhancement]: Automatically linkcheck in CI Signed-off-by: Aviral Singh --- .github/workflows/linkcheck.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/linkcheck.yml b/.github/workflows/linkcheck.yml index f7f87d6026e..03b1b8e454c 100644 --- a/.github/workflows/linkcheck.yml +++ b/.github/workflows/linkcheck.yml @@ -4,7 +4,7 @@ on: push: branches: - main - pull_request: {} + pull_request: workflow_dispatch: inputs: failOnError: From 42e4e6a050f9eec6d4fd01994238f2d69b12bb8e Mon Sep 17 00:00:00 2001 From: Aviral Singh Date: Mon, 2 Oct 2023 18:10:39 +0530 Subject: [PATCH 4/9] [enhancement]: Automatically linkcheck in CI Signed-off-by: Aviral Singh --- .github/workflows/linkcheck.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/linkcheck.yml b/.github/workflows/linkcheck.yml index 03b1b8e454c..eda8ead9ebe 100644 --- a/.github/workflows/linkcheck.yml +++ b/.github/workflows/linkcheck.yml @@ -1,7 +1,7 @@ name: linkcheck in CI on: - push: + push: branches: - main pull_request: From 90d5e9e760c5900dd3818b3da9d9362b2090d12e Mon Sep 17 00:00:00 2001 From: Aviral Singh Date: Mon, 2 Oct 2023 18:14:50 +0530 Subject: [PATCH 5/9] [enhancement]: Automatically linkcheck in CI Signed-off-by: Aviral Singh --- .github/workflows/linkcheck.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/linkcheck.yml b/.github/workflows/linkcheck.yml index eda8ead9ebe..f7f87d6026e 100644 --- a/.github/workflows/linkcheck.yml +++ b/.github/workflows/linkcheck.yml @@ -1,10 +1,10 @@ name: linkcheck in CI on: - push: + push: branches: - main - pull_request: + pull_request: {} workflow_dispatch: inputs: failOnError: From 9f25025ee8a34a015f839f066886e573f78cd09c Mon Sep 17 00:00:00 2001 From: Aviral Singh Date: Mon, 2 Oct 2023 18:21:01 +0530 Subject: [PATCH 6/9] cla-signers Signed-off-by: Aviral Singh --- tools/.github-cla-signers | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/.github-cla-signers b/tools/.github-cla-signers index 5838caae1e1..b0af44b0f82 100644 --- a/tools/.github-cla-signers +++ b/tools/.github-cla-signers @@ -63,6 +63,7 @@ impl Indrranil irishgordo ITJamie +itsaviral2609 ixjhuang izzyleung j5awry From 9336400d1de7a5a886f74c14b13c1c2552381cea Mon Sep 17 00:00:00 2001 From: Aviral Singh Date: Tue, 3 Oct 2023 13:17:04 +0530 Subject: [PATCH 7/9] [enhancement]: linkcheck in CI Signed-off-by: Aviral Singh --- .github/workflows/linkcheck.yml | 12 +++++++++++- doc/rtd/conf.py | 9 +++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/.github/workflows/linkcheck.yml b/.github/workflows/linkcheck.yml index f7f87d6026e..b7c06259225 100644 --- a/.github/workflows/linkcheck.yml +++ b/.github/workflows/linkcheck.yml @@ -30,4 +30,14 @@ jobs: run: pip install tox - name: Run Sphinx linkcheck - run: tox -e linkcheck + run: tox -e linkcheck | tee output.txt + + - name: Check for broken links below threshold 6 + run: | + broken_count=$(grep -c "broken" output.txt) + if [[ $broken_count -ge 6 ]]; then + echo "Too many broken links detected: $broken_count" + exit 1 + else + echo "Number of broken links is below threshold: $broken_count" + fi diff --git a/doc/rtd/conf.py b/doc/rtd/conf.py index fcb8f2e3055..0dc3b48397e 100644 --- a/doc/rtd/conf.py +++ b/doc/rtd/conf.py @@ -119,6 +119,15 @@ autosectionlabel_prefix_document = True autosectionlabel_maxdepth = 2 +# Sphinx-linkcheck config +linkcheck_ignore = [ r"http://instance-data.*", r"https://powersj.io.*", + r"http://169.254.169.254.*", r"http://10.10.0.1.*" +] +linkcheck_anchors_ignore_for_url = ( + r"https://github.com/canonical/cloud-init.*", + r"https://github.com/canonical/ubuntu-pro-client.*" +) + # Sphinx-copybutton config options: notfound_body = ( "

Page not found

Sorry we missed you! Our docs have had a" From 835ed8ca344b17c5f6a35618dccbce9c4975a71b Mon Sep 17 00:00:00 2001 From: Aviral Singh Date: Tue, 3 Oct 2023 21:47:39 +0530 Subject: [PATCH 8/9] [enhancement]: linkcheck in CI Signed-off-by: Aviral Singh --- .github/workflows/linkcheck.yml | 2 +- doc/rtd/conf.py | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/linkcheck.yml b/.github/workflows/linkcheck.yml index b7c06259225..9c9502033ce 100644 --- a/.github/workflows/linkcheck.yml +++ b/.github/workflows/linkcheck.yml @@ -35,7 +35,7 @@ jobs: - name: Check for broken links below threshold 6 run: | broken_count=$(grep -c "broken" output.txt) - if [[ $broken_count -ge 6 ]]; then + if [[ $broken_count -ge 3 ]]; then echo "Too many broken links detected: $broken_count" exit 1 else diff --git a/doc/rtd/conf.py b/doc/rtd/conf.py index 0dc3b48397e..9c06bdc0685 100644 --- a/doc/rtd/conf.py +++ b/doc/rtd/conf.py @@ -120,9 +120,11 @@ autosectionlabel_maxdepth = 2 # Sphinx-linkcheck config -linkcheck_ignore = [ r"http://instance-data.*", r"https://powersj.io.*", - r"http://169.254.169.254.*", r"http://10.10.0.1.*" +linkcheck_ignore = [ + r"http://\[fd00:ec2::254.*", r"http://instance-data.*", + r"https://powersj.io.*", r"http://169.254.169.254.*", r"http://10.10.0.1.*" ] + linkcheck_anchors_ignore_for_url = ( r"https://github.com/canonical/cloud-init.*", r"https://github.com/canonical/ubuntu-pro-client.*" From 79309364b1fe1d13303ea10e14dfd6fc241942fd Mon Sep 17 00:00:00 2001 From: Chad Smith Date: Tue, 3 Oct 2023 14:23:54 -0600 Subject: [PATCH 9/9] black formatting fix fixed using tox -e do_format --- doc/rtd/conf.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/doc/rtd/conf.py b/doc/rtd/conf.py index 9c06bdc0685..bd1bc0c30a8 100644 --- a/doc/rtd/conf.py +++ b/doc/rtd/conf.py @@ -121,13 +121,16 @@ # Sphinx-linkcheck config linkcheck_ignore = [ - r"http://\[fd00:ec2::254.*", r"http://instance-data.*", - r"https://powersj.io.*", r"http://169.254.169.254.*", r"http://10.10.0.1.*" + r"http://\[fd00:ec2::254.*", + r"http://instance-data.*", + r"https://powersj.io.*", + r"http://169.254.169.254.*", + r"http://10.10.0.1.*", ] linkcheck_anchors_ignore_for_url = ( r"https://github.com/canonical/cloud-init.*", - r"https://github.com/canonical/ubuntu-pro-client.*" + r"https://github.com/canonical/ubuntu-pro-client.*", ) # Sphinx-copybutton config options: