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

[RHELC-1748] Manpage generation check #1422

Open
wants to merge 71 commits into
base: main
Choose a base branch
from

Conversation

Andrew-ang9
Copy link
Contributor

@Andrew-ang9 Andrew-ang9 commented Nov 4, 2024

This PR sets up the GitHub action so that going forward we will be able to know if we need to generate the manpages per PR basis so that we can always have the manpages up to date.

Jira Issues:

-RHELC-1748

Checklist

  • PR has been tested manually in a VM (either author or reviewer)
  • Jira issue has been made public if possible
  • [RHELC-] or [HMS-] is part of the PR title
  • Label depicting the kind of PR it is
  • PR title explains the change from the user's point of view
  • Code and tests are documented properly
  • The commits are squashed to as few commits as possible (without losing data)
  • When merged: Jira issue has been updated to Release Pending if relevant

Copy link

codecov bot commented Nov 4, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Please upload report for BASE (main@5be973f). Learn more about missing BASE report.
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1422   +/-   ##
=======================================
  Coverage        ?   96.11%           
=======================================
  Files           ?       72           
  Lines           ?     5178           
  Branches        ?      896           
=======================================
  Hits            ?     4977           
  Misses          ?      119           
  Partials        ?       82           
Flag Coverage Δ
centos-linux-7 91.63% <100.00%> (?)
centos-linux-8 92.49% <100.00%> (?)
centos-linux-9 92.61% <100.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.


🚨 Try these New Features:

@Andrew-ang9 Andrew-ang9 force-pushed the auto-gen-manpages-final branch from a88ffb5 to d7b5428 Compare November 4, 2024 20:23
Copy link
Member

@Venefilyn Venefilyn left a comment

Choose a reason for hiding this comment

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

In short, I would want to see

  • Manpages are generated and checked to see if there are changes
  • Manpages are checked for each commit on main and commit in a PR
  • Manpages workflow fails if there is a difference and passes if there are no changes

Comment on lines 67 to 70
- name: Trigger Manpage Generation
run: |
oamg/convert2rhel/.github/workflows/generate_manpage.yml@main

Copy link
Member

Choose a reason for hiding this comment

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

To get this to work generate_manpage.yml needs to be a runnable workflow. But don't think it's necessary to run it here tbh, we can keep to just running it on every PR

Copy link
Member

Choose a reason for hiding this comment

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

It's not enough to check with the previous version. I would like to see the manpages generated and the difference checked to see if there are any changes. Not just if the version changed.

As this will fail every time we submit a new version it's already too late to update too.


# Generate the manpage using argparse-manpage
PYTHONPATH=. /usr/bin/python /home/runner/.local/bin/argparse-manpage --pyfile man/__init__.py --function get_parser --manual-title="General Commands Manual" --description="Automates the conversion of Red Hat Enterprise Linux derivative distributions to Red Hat Enterprise Linux." --project-name "convert2rhel $VER" --prog="convert2rhel" --include man/distribution --include man/synopsis > "$MANPAGE_DIR/convert2rhel.8"
PYTHONPATH=. argparse-manpage --pyfile man/__init__.py --function get_parser --manual-title="General Commands Manual" --description="Automates the conversion of Red Hat Enterprise Linux derivative distributions to Red Hat Enterprise Linux." --project-name "convert2rhel $CURRENT_VER" --prog="convert2rhel" --include man/distribution --include man/synopsis > "$MANPAGE_DIR/convert2rhel.8"
Copy link
Member

Choose a reason for hiding this comment

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

We're missing python call here. Does it still work locally?

Comment on lines +22 to +28
if ! git diff --quiet HEAD -- "$MANPAGE_DIR/convert2rhel.8"; then
echo "Manpages are outdated. Please update them."
exit 1
else
echo "Manpages are up-to-date."
exit 0
fi
Copy link
Member

Choose a reason for hiding this comment

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

Perfect!

Comment on lines +6 to +7
# Ensure the manpage directory exists
mkdir -p "$MANPAGE_DIR"
Copy link
Member

Choose a reason for hiding this comment

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

LGTM

@Andrew-ang9 Andrew-ang9 marked this pull request as draft November 12, 2024 19:27
@Andrew-ang9 Andrew-ang9 force-pushed the auto-gen-manpages-final branch 3 times, most recently from ac655b7 to 9c0900b Compare November 19, 2024 18:54
@Andrew-ang9 Andrew-ang9 marked this pull request as ready for review November 19, 2024 19:12
@Andrew-ang9 Andrew-ang9 requested a review from a team as a code owner November 21, 2024 01:45
* Added in the the check to see if the manpages should be
  generated or not
* Changed the generate_manpage.yml file so that it sets up the
  action as needed, and removed some of the things not needed
* The main thing we should check here is to make sure the manpages
  needed to be updated so we don't need to see the version as it
  would be too late and we want this to happen on all PRs
* on the last commit some of the set up for the action was removed and
  now it is back
* added in the manpage generation command back to the
  manpage_generation.sh script
* How cli.py was calling the atributes from rpm for the pre and post
  RPM_VA_LOG_FILENAME was causing an error whenever I tried to run the
  GitHub action and the manpage command locally so to fix it I imported
  the the vars directly into cli.py
@Andrew-ang9 Andrew-ang9 force-pushed the auto-gen-manpages-final branch from aa5bcf3 to 874e81a Compare November 27, 2024 14:11
Copy link
Member

@Venefilyn Venefilyn Nov 28, 2024

Choose a reason for hiding this comment

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

I noticed the workflow is not using a container or the script. But if this container works locally it's just a matter of running it in the GitHub workflow

Since we don't need the results exported in any way, but rather to exit the container with a code if there is a change

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I talked about this PR with Mb, and they suggested that if everything could just be done in the action, that could fix some of the issues that I was having. The action works as it should. The error shown now is a separate issue from this PR, but you can see that at the end of it, it does show the correct message for the manpages, as currently, in this PR, there are changes in the manpages file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants