Skip to content
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

[WIP] Adding a build-changed-pages.py script #48582

Conversation

pneedle-rh
Copy link
Contributor

@pneedle-rh pneedle-rh commented Jul 29, 2022

This PR is a work in progress. Do not merge.

This applies to main, enterprise-4.11, enterprise-4.10, enterprise-4.9, enterprise-4.8, enterprise-4.7 and enterprise-4.6.

This PR adds a ./build-changed-pages.py script to the top level directory in the openshift-docs repo. You can run the script to build AsciiBinder previews only for openshift-docs pages that are changed in the latest commit in the branch.

The development is primarily intended for potential use with the Travis checks for the openshift-docs repo. This script can also be run manually in a local clone feature branch.

See the header of the script for details on how to run it.

@pneedle-rh pneedle-rh self-assigned this Jul 29, 2022
@openshift-ci openshift-ci bot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jul 29, 2022
@pneedle-rh pneedle-rh changed the title [WIP] Adding a build-changes-pages.py script [WIP] Adding a build-changed-pages.py script Jul 29, 2022
@pneedle-rh pneedle-rh force-pushed the adding-build-changed-pages-script branch 2 times, most recently from 36587be to 6e3baaf Compare July 29, 2022 18:42
@pneedle-rh
Copy link
Contributor Author

@kalexand-rh hi! Can you please review this PR? Thanks!

@pneedle-rh pneedle-rh force-pushed the adding-build-changed-pages-script branch 7 times, most recently from fcf0a4b to 3004c7d Compare July 29, 2022 19:30
@pneedle-rh
Copy link
Contributor Author

pneedle-rh commented Jul 30, 2022

After a bit of testing, it looks like the current approach in this script might only be useful for commits that change a few pages. This is because AsciiBinder only seems to allow you to specify the --pages or -p option once per build. Given this, the script currently runs asciibinder build -p <page> for each individual page that is changed in a commit. Having to run the command multiple times causes a performance overhead as you scale the number of changed pages in a commit.

I can't see a way to specify more than one page in a single AsciiBinder build run. For example:

  • Asciibinder does not seem to accept a comma-separated list of pages with the -p option (unless I have the wrong format):
$ asciibinder build -p monitoring/monitoring-overview,monitoring/managing-alerts
Rebuilding 'monitoring/monitoring-overview,monitoring/managing-alerts/' on branch 'build-check-test'.
WARN: The /tmp/_topic_map.yml20220730-5158-q13k7f file on branch 'build-check-test' references 83 nonexistent topics. Set logging to 'debug' for details.

$ ls _preview/openshift-enterprise/build-check-test/monitoring/
$ 
  • AsciiBinder does not allow you to specify the -p option more than once:
$ asciibinder build -p monitoring/monitoring-overview -p monitoring/managing-alerts
Error: option '-p' specified multiple times.
Try --help for help.

I haven't yet been able to find any detailed AsciiBinder documentation or help items on the option. I am continuing to review if there is a way to build more than one page in a single AsciiBinder build run.

If we can't find a way to build multiple selected pages in a single run, we could potentially explore the following if condition:

  • If a commit changes less than a certain number of pages, then build only the changed pages
  • Else if a commit changes more than a certain number of pages, then do a full build

@pneedle-rh
Copy link
Contributor Author

This relates to #48653.

@pneedle-rh
Copy link
Contributor Author

I created this RFE issue in AsciiBinder in relation to this.

pages_to_build = list(dict.fromkeys(pages_to_build))
# Run 'asciibinder build' for each page that is changed in the HEAD commit, including any unchanged assemblies that include changed modules:
print(f"Attempting to build the pages changed in the HEAD commit:")
for i in pages_to_build:
Copy link
Contributor

@aireilly aireilly Aug 15, 2022

Choose a reason for hiding this comment

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

Could these processes be threaded in parallel? https://stackoverflow.com/a/14533902/7010427 This would solve your bottle neck. Right now, you are running builds sequentially.

@openshift-bot
Copy link

Issues go stale after 90d of inactivity.

Mark the issue as fresh by commenting /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.
Exclude this issue from closing by commenting /lifecycle frozen.

If this issue is safe to close now please do so with /close.

/lifecycle stale

@openshift-ci openshift-ci bot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Nov 14, 2022
@openshift-bot
Copy link

Stale issues rot after 30d of inactivity.

Mark the issue as fresh by commenting /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.
Exclude this issue from closing by commenting /lifecycle frozen.

If this issue is safe to close now please do so with /close.

/lifecycle rotten
/remove-lifecycle stale

@openshift-ci openshift-ci bot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Dec 14, 2022
@openshift-bot
Copy link

Rotten issues close after 30d of inactivity.

Reopen the issue by commenting /reopen.
Mark the issue as fresh by commenting /remove-lifecycle rotten.
Exclude this issue from closing again by commenting /lifecycle frozen.

/close

@openshift-ci openshift-ci bot closed this Jan 14, 2023
@openshift-ci
Copy link

openshift-ci bot commented Jan 14, 2023

@openshift-bot: Closed this PR.

In response to this:

Rotten issues close after 30d of inactivity.

Reopen the issue by commenting /reopen.
Mark the issue as fresh by commenting /remove-lifecycle rotten.
Exclude this issue from closing again by commenting /lifecycle frozen.

/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants