Skip to content

Docs: refactor "skipping a build" section #9717

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

humitos
Copy link
Member

@humitos humitos commented Nov 8, 2022

  • Move the explanation about the "Cancelling builds" feature to the "Builds" page
  • Keep the examples (How-To) for "Cancel a build" into the "Build customization" page

📚 Documentation previews 📚

- Move the explanation about the "Cancelling builds" feature to the "Builds"
page
- Keep the examples (How-To) for "Cancel a build" into the "Build customization"
page
Copy link
Member

@ericholscher ericholscher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a great addition to the docs.

humitos and others added 5 commits November 9, 2022 09:59
> This error code isn't a valid exit
> code (tldp.org/LDP/abs/html/exitcodes.html), we shouldn't document a code above
> 255 otherwise users will get confused.

From Eric's review.
They are easier to read
Co-authored-by: Eric Holscher <[email protected]>
@humitos humitos merged commit 111ee35 into humitos/skip-build-based-on-exit-code Nov 10, 2022
@humitos humitos deleted the humitos/skip-builds-docs branch November 10, 2022 08:21
humitos added a commit that referenced this pull request Nov 14, 2022
* Build: skip build based on commands' exit codes

Define a particular exit code (439) to skip a build.

If any of the commands returns this exit code, the build will be cancelled
automatically and won't run any of the following commands. When this happens,
the build will be marked as `cancelled` and no email/webhook notifications will
be sent.

Why 439 was chosen for the exit code?

It's the word "skip" encoded in ASCII. Then it's taken the 256 modulo of it because
the Unix implementation does this automatically for exit codes greater than 255

```
>>> sum(list('skip'.encode('ascii')))
439
>>> 439 % 256
183
```

* Update readthedocs/doc_builder/exceptions.py

Co-authored-by: Anthony <[email protected]>

* Build: send SUCCESS external build status on skipped builds

When the command exists with the magic exit code, we send SUCCESS to
GitHub/GitLab as status so the PR check passes and the PR can be merged.

* Docs: skip build based on a condition

* Lint: small darker change

* Docs: reference fixed

* Docs: improve comment on YAML

* Build: make usage of `status` variable

Thanks to Benjamin for pointing it to me ;)

* Apply suggestions from code review

Co-authored-by: Benjamin Balder Bach <[email protected]>

* Docs: update code example for skip builds

Use Bash's `if` to only run this code on pull requests.

* Docs: example showing how to skip the build based on commit message

* Docs: refactor "skipping a build" section (#9717)

* Docs: refactor "skipping a build" section

- Move the explanation about the "Cancelling builds" feature to the "Builds"
page
- Keep the examples (How-To) for "Cancel a build" into the "Build customization"
page

* Docs: use 183 instead of 439 exit code

> This error code isn't a valid exit
> code (tldp.org/LDP/abs/html/exitcodes.html), we shouldn't document a code above
> 255 otherwise users will get confused.

From Eric's review.

* Apply suggestions from code review

Co-authored-by: Eric Holscher <[email protected]>

* Minor fix underline

* Use multi-line bash examples

They are easier to read

* Update docs/user/builds.rst

Co-authored-by: Eric Holscher <[email protected]>

Co-authored-by: Eric Holscher <[email protected]>

* Docs: use `grep` instead of `case`

* Docs: small note about "Why 183?"

Co-authored-by: Anthony <[email protected]>
Co-authored-by: Benjamin Balder Bach <[email protected]>
Co-authored-by: Eric Holscher <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants