Better explanation when a page 404s
Overview
TL;DR On the GitHub Desktop and CLI courses, the CI tests kick off and check that each page that has previously been added to the showcase doesn't 404. When a page does 404, a learner's merge is blocked. We should write clearer instructions around how to resolve that specific CI error.
Extra Detail
Screenshots
Here's some output from Travis CI:
Checking 1 external link...
HTML-Proofer finished successfully.
Running ["ScriptCheck", "LinkCheck", "ImageCheck"] on ["bonuskek.github.io"] on *.html...
Checking 1 external link...
HTML-Proofer finished successfully.
Running ["ScriptCheck", "LinkCheck", "ImageCheck"] on ["botoxny.github.io"] on *.html...
Checking 1 external link...
-
* External link botoxny.github.io failed: 404 No error
E
===============================================================================
Error: test_htmlvalidation(TestHTMLValidation)
: RuntimeError: HTML-Proofer found 1 failure!
/home/travis/.rvm/gems/ruby-2.2.2/gems/html-proofer-3.4.0/lib/html-proofer/runner.rb:171:in `print_failed_tests'
/home/travis/.rvm/gems/ruby-2.2.2/gems/html-proofer-3.4.0/lib/html-proofer/runner.rb:52:in `run'
tests/test_HTML.rb:13:in `block (2 levels) in test_htmlvalidation'
10: [
11: f["pageUrl"],
12: ].each do |s|
=> 13: assert_not_nil(HTMLProofer.check_links([s]).run, path)
14: end
15: end
16:
tests/test_HTML.rb:12:in `each'
tests/test_HTML.rb:12:in `block in test_htmlvalidation'
tests/test_HTML.rb:8:in `each'
tests/test_HTML.rb:8:in `test_htmlvalidation'
===============================================================================
Finished in 2.125146872 seconds.
1 tests, 58 assertions, 0 failures, 1 errors, 0 pendings, 0 omissions, 0 notifications
0% passed
0.47 tests/s, 27.29 assertions/s
The command "ruby tests/test_HTML.rb" exited with 1.
0.17s$ ruby tests/test_htmlValidation.rb
How to Contribute
- [ ] Comment on this issue if you'd like to work/collaborate on it!
- [ ] Fork the repository.
- [ ] Use the GitHub Flow to make changes to your fork. This is a refresher course if you're unsure about how to make a change on GitHub.
- [ ] Push your changes to your repository.
- [ ] Submit a Pull Request
- Base Dropdown: github/training-kit
- Compare Dropdown: Your fork
Testing Locally
If you'd like to make and test changes locally (and see how they would look if merged), do the following:
- In your command line:
- Install Git
- Install Ruby
- [ ] Run
script/setup - [ ] Run
script/server.- When successful, the script will initiate a local server at
http://127.0.0.1:4000/on-demand.
- When successful, the script will initiate a local server at
Questions?
- Leave a comment on this issue! Make sure to use @ mentions if you want a specific person's attention!
I guess the instruction should be to fix the affected .yaml file, but a possible difficulty is that the test returns the failing URL and not the delinquent .yaml file. But possibly I am overlooking something in the log.
Because learners where instructed to format the url the same way as the .yaml file name, it is easy to find this file, but what if the user decides to point to another website? Should learners do a code search?
I guess the instruction should be to fix the affected .yaml file
You're right, @r5atom. It looks like @brianamarie chose to change that URL to github.com in the past, I think I fixed one once that I removed altogether. We should probably agree on something before moving forward 😉 Thoughts @github/services-training?
difficulty is that the test returns the failing URL and not the delinquent .yaml file
This is true, but the failing URL will have the handle, which should then point the learner to the corresponding file in the _pages directory. In the example, the offending URL was botoxny.github.io which means that the offending file was _pages/botoxny.yaml. All the more reason to get it documented 😉
FWIW, this could also help to improve the learning experience, as it introduces people to the basics of reading a CI log.
It looks like @brianamarie chose to change that URL to github.com in the past, I think I fixed one once that I removed altogether. We should probably agree on something before moving forward 😉
Guilty, I have been changing broken links to github.com. :bowtie: I'm open to other alternatives. I believe @crichID has been deleting the files completely, which is another option.
FWIW, this could also help to improve the learning experience, as it introduces people to the basics of reading a CI log.
☝️ This 💯
I've been removing them as well.
but the failing URL will have the handle
What if a learner decides to make the following John.yaml
---
githubHandle: John
pageUrl: my-other-page.com
timestamp: 2017-02-29
---
After John forgets to pay for hosting 😏 CI will log
* External linkmy-other-page.comfailed: 404 No error
This information will not point to John.yaml.
Although in the majority of the cases this won't be an issue, is it an idea to log the filename the script is evaluating? For instance here.
@r5atom I believe you're right, that there are no checks to ensure that the pageURL matches the user's GitHub Pages URL. Let's check with @brianamarie @stoe and @kylemacey since they did all the work on the Ruby tests to ensure I'm not mistaken here. While we've got their 👀: are users allowed to touch files other than their own? For example, would r5atom be allowed to change hectorsector's existing _pages/hectorsector.yaml? I want to make sure that CI tests will not flag this as a failure if we write instructions to tell users to remove pages that result in a 404.
I believe you're right, that there are no checks to ensure that the pageURL matches the user's GitHub Pages URL.
@r5atom @hectorsector Correct, the tests only check for a valid URL. We decided that some users may create a repository under a different name, and we didn't need to penalize them for that.
are users allowed to touch files other than their own?
@r5atom @hectorsector Yes. 👍 Tests only check contents of file, not who is changing which file. (Although if we can figure out how to test for that, it would be lovely to add some extra protection against the test files... 😉)
Thanks @brianamarie! With this in mind, I think the extra troubleshooting steps should just tell the learner that they can remove the offending file until changes are made to the CI tests and we get more visibility.
Got something going at #481 👀 .
Now that #481 has 🚢ed, it's time to close this one. Huuuuge thanks, @r5atom!
