8000 Add -c option to validate-config by MooSayed1 · Pull Request #2556 · packit/packit · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add -c option to validate-config #2556

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

MooSayed1
Copy link
Contributor
@MooSayed1 MooSayed1 commented Mar 16, 2025

Fixes #2451

Description

Fixes #2451
i added a -c / --config option to the validate-config command.

How to Test (So Far)

# Default behavior (should use packit.yaml in working_dir)
packit validate-config

# New behavior (pass a custom config file)
packit validate-config -c /home/mohamed/custom-packit.yaml 

# Added Test Cases


pytest -v ./tests/functional/test_validate_config.py   

RELEASE NOTES BEGIN

You can now validate a Packit config passed to the Packit CLI via a path, e.g., packit config validate -c /tmp/my-custom-packit-config.yml.

RELEASE NOTES END

Copy link
Contributor

Build failed.
https://softwarefactory-project.io/zuul/t/packit-service/buildset/9893e1305c5646eab163ad14e19b313c

pre-commit FAILURE in 2m 06s
✔️ packit-tests-rpm SUCCESS in 24m 09s
✔️ packit-tests-pip-deps SUCCESS in 24m 08s
✔️ packit-tests-git-main SUCCESS in 24m 06s
✔️ packit-tests-pip-deps-sess-rec SUCCESS in 2m 37s
✔️ packit-tests-git-main-sess-rec SUCCESS in 2m 57s
✔️ reverse-dep-packit-service-tests SUCCESS in 4m 51s

Copy link
Member
@lachmanfrantisek lachmanfrantisek left a comment

Choose a reason for hiding this comment

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

Thanks a lot for your contribution. I've added a few notes.

Can you please make a test case for this?

Comment on lines 87 to 88
except FileNotFoundError as e:
logger.error(f"Error: {e}")
Copy link
Member

Choose a reason for hiding this comment

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

We already check for this at line 68 so this should not be needed.

Comment on lines 87 to 92
except FileNotFoundError as e:
logger.error(f"Error: {e}")
except yaml.YAMLError as e:
logger.error(f"YAML parsing error: {e}")
except Exception as e:
logger.error(f"Unexpected error: {e}")
Copy link
Member

Choose a reason for hiding this comment

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

It would be nice if we could resolve these error states and fail soo. (It helps code readability if we don't go deeper (~right) into code structure.)

@MooSayed1
Copy link
Contributor Author
MooSayed1 commented Mar 17, 2025

@lachmanfrantisek okay i added test cases and resolve to fail fast also i tried to implement the TODO debug
how can i work on it what should it do

Copy link
Contributor

Build failed.
https://softwarefactory-project.io/zuul/t/packit-service/buildset/b0bae18906f141d383ac90354befda9f

pre-commit FAILURE in 2m 03s
packit-tests-rpm FAILURE in 2m 09s
packit-tests-pip-deps FAILURE in 2m 04s
packit-tests-git-main FAILURE in 2m 23s
✔️ packit-tests-pip-deps-sess-rec SUCCESS in 3m 00s
✔️ packit-tests-git-main-sess-rec SUCCESS in 3m 04s
✔️ reverse-dep-packit-service-tests SUCCESS in 5m 05s

Copy link
Contributor

Build failed.
https://softwarefactory-project.io/zuul/t/packit-service/buildset/9667144cfa0a4dc08fc5551a422ed1bd

pre-commit FAILURE in 2m 13s
✔️ packit-tests-rpm SUCCESS in 23m 57s
✔️ packit-tests-pip-deps SUCCESS in 24m 15s
✔️ packit-tests-git-main SUCCESS in 24m 21s
✔️ packit-tests-pip-deps-sess-rec SUCCESS in 2m 55s
✔️ packit-tests-git-main-sess-rec SUCCESS in 3m 08s
✔️ reverse-dep-packit-service-tests SUCCESS in 5m 17s

Copy link
Contributor

Build succeeded.
https://softwarefactory-project.io/zuul/t/packit-service/buildset/2c4ff2c72345482cada4d60858c602b2

✔️ pre-commit SUCCESS in 2m 13s
✔️ packit-tests-rpm SUCCESS in 24m 10s
✔️ packit-tests-pip-deps SUCCESS in 24m 00s
✔️ packit-tests-git-main SUCCESS in 24m 24s
✔️ packit-tests-pip-deps-sess-rec SUCCESS in 2m 52s
✔️ packit-tests-git-main-sess-rec SUCCESS in 2m 59s
✔️ reverse-dep-packit-service-tests SUCCESS in 5m 00s

@MooSayed1 MooSayed1 force-pushed the fix-validate-config branch from bf51b3b to 7ad7486 Compare March 17, 2025 15:09
Copy link
Contributor

Build succeeded.
https://softwarefactory-project.io/zuul/t/packit-service/buildset/bd17b739ca2b4ea89989119d448f4aa0

✔️ pre-commit SUCCESS in 2m 17s
✔️ packit-tests-rpm SUCCESS in 23m 23s
✔️ packit-tests-pip-deps SUCCESS in 24m 09s
✔️ packit-tests-git-main SUCCESS in 24m 28s
✔️ packit-tests-pip-deps-sess-rec SUCCESS in 3m 57s
✔️ packit-tests-git-main-sess-rec SUCCESS in 3m 15s
✔️ reverse-dep-packit-service-tests SUCCESS in 5m 17s

@MooSayed1
Copy link
Contributor Author
MooSayed1 commented Mar 22, 2025

@mfocko can you please review those changes

Copy link
Member
@lachmanfrantisek lachmanfrantisek left a comment

Choose a reason for hiding this comment

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

Thanks for all the improvements!

Just one code-style note and one about testing.

@lachmanfrantisek
Copy link
Member

And btw. can you please also rebase (some info e.g. here) your work so we have a nice linear history once merging your code?

(Also, an interactive rebase might be nice to clean the history so each commit is a logical part of the contribution without any unnecessary/work-in-progress/merging/fixup... commits.) Thanks!

@MooSayed1 MooSayed1 force-pushed the fix-validate-config branch from 7ad7486 to 2ad6ee5 Compare April 4, 2025 21:07
@MooSayed1
Copy link
Contributor Author
MooSayed1 commented Apr 4, 2025

@lachmanfrantisek i moved the logic to validate_config fucniton in PackitAPI class and make tests with flexmock on this function
and finally i make rebase to clean the history in one commit

Copy link
Contributor

Build succeeded.
https://softwarefactory-project.io/zuul/t/packit-service/buildset/4794d1097ce84d71af384ca49a258bcd

✔️ pre-commit SUCCESS in 2m 04s
✔️ packit-tests-rpm SUCCESS in 23m 21s
✔️ packit-tests-pip-deps SUCCESS in 23m 10s
✔️ packit-tests-git-main SUCCESS in 23m 10s
✔️ packit-tests-pip-deps-sess-rec SUCCESS in 2m 45s
✔️ packit-tests-git-main-sess-rec SUCCESS in 2m 55s
✔️ reverse-dep-packit-service-tests SUCCESS in 5m 01s

Copy link
Contributor

Build succeeded.
https://softwarefactory-project.io/zuul/t/packit-service/buildset/4e240162e82d4018a24a894544151035

✔️ pre-commit SUCCESS in 2m 06s
✔️ packit-tests-rpm SUCCESS in 22m 59s
✔️ packit-tests-pip-deps SUCCESS in 22m 58s
✔️ packit-tests-git-main SUCCESS in 22m 59s
✔️ packit-tests-pip-deps-sess-rec SUCCESS in 2m 43s
✔️ packit-tests-git-main-sess-rec SUCCESS in 2m 57s
✔️ reverse-dep-packit-service-tests SUCCESS in 4m 41s

8000 Copy link
Member
@lachmanfrantisek lachmanfrantisek left a comment

Choose a reason for hiding this comment

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

Sounds good!

Just one code suggestion.

Otherwise, the last step is to clean up the git history a bit:

  • Can you please rebase your code instead of merging it so we have a clean history? (The commit(s) will start on the current main branch HEAD.)
  • If you setup pre-commit (documented here, you can avoid attaching the fix commit by the CI.
  • Also, we don't need the prettier cache file.

Thanks!

Copy link
Contributor

Build succeeded.
https://softwarefactory-project.io/zuul/t/packit-service/buildset/858145c9e7b342559577adc25a74b0a6

✔️ pre-commit SUCCESS in 2m 07s
✔️ packit-tests-rpm SUCCESS in 23m 22s
✔️ packit-tests-pip-deps SUCCESS in 23m 26s
✔️ packit-tests-git-main SUCCESS in 23m 33s
✔️ packit-tests-pip-deps-sess-rec SUCCESS in 2m 44s
✔️ packit-tests-git-main-sess-rec SUCCESS in 2m 59s
✔️ reverse-dep-packit-service-tests SUCCESS in 4m 54s

@MooSayed1 MooSayed1 force-pushed the fix-validate-config branch 2 times, most recently from 051113a to 7259e0d Compare April 7, 2025 13:19
Copy link
Contributor

Build succeeded.
https://softwarefactory-project.io/zuul/t/packit-service/buildset/694d4ccd10254accb41e0ca57956d4d4

✔️ pre-commit SUCCESS in 2m 02s
✔️ packit-tests-rpm SUCCESS in 23m 07s
✔️ packit-tests-pip-deps SUCCESS in 23m 07s
✔️ packit-tests-git-main SUCCESS in 23m 13s
✔️ packit-tests-pip-deps-sess-rec SUCCESS in 2m 43s
✔️ packit-tests-git-main-sess-rec SUCCESS in 2m 52s
✔️ reverse-dep-packit-service-tests SUCCESS in 4m 45s

@MooSayed1
Copy link
Contributor Author

@lachmanfrantisek Done.

Copy link
Member
@lachmanfrantisek lachmanfrantisek left a comment

Choose a reason for hiding this comment

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

Just two small things to do:

Comment on lines 22 to 23
@click.command("validate", context_settings=get_context_settings())
@click.command("validate-config", context_settings=get_context_settings())
Copy link
Member

Choose a reason for hiding this comment

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

Looks like some leftovers from the rebase because of #2559

Copy link
Contributor Author

Choose a reason for hiding this comment

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

should i change it manually to be "validate" ?
or there's a better way

@MooSayed1 MooSayed1 force-pushed the fix-validate-config branch from e6803ba to 1327a4f Compare April 8, 2025 09:25
Copy link
Contributor

Build failed.
https://softwarefactory-project.io/zuul/t/packit-service/buildset/365266204b434dd48ed4dbe8e7881a65

✔️ pre-commit SUCCESS in 2m 07s
packit-tests-rpm FAILURE in 1m 44s
packit-tests-pip-deps RETRY_LIMIT in 1m 17s
packit-tests-git-main RETRY_LIMIT in 1m 31s
packit-tests-pip-deps-sess-rec RETRY_LIMIT in 1m 21s
packit-tests-git-main-sess-rec RETRY_LIMIT in 1m 33s
✔️ reverse-dep-packit-service-tests SUCCESS in 4m 49s

@MooSayed1 MooSayed1 force-pushed the fix-validate-config branch from 1327a4f to 207b3d0 Compare April 8, 2025 10:03
Copy link
Contributor

Build failed.
https://softwarefactory-project.io/zuul/t/packit-service/buildset/3b48e2cec3ea4c4a9be20e3fb45c3854

✔️ pre-commit SUCCESS in 2m 06s
packit-tests-rpm FAILURE in 1m 43s
packit-tests-pip-deps FAILURE in 2m 43s
packit-tests-git-main RETRY_LIMIT in 1m 48s
packit-tests-pip-deps-sess-rec FAILURE in 2m 28s
packit-tests-git-main-sess-rec RETRY_LIMIT in 1m 46s
✔️ reverse-dep-packit-service-tests SUCCESS in 4m 54s

@MooSayed1
Copy link
Contributor Author

@lachmanfrantisek there’s a CI issue? or i made a problem.

@lachmanfrantisek
Copy link
Member

Let's rerun it but it might be caused by a fresh fedora-distro-aliases not being available.

@lachmanfrantisek
Copy link
Member

recheck

Copy link
Contributor

Build succeeded.
https://softwarefactory-project.io/zuul/t/packit-service/buildset/7f11891e48c24270a2cd34879317841a

✔️ pre-commit SUCCESS in 2m 07s
✔️ packit-tests-rpm SUCCESS in 23m 33s
✔️ packit-tests-pip-deps SUCCESS in 23m 24s
✔️ packit-tests-git-main SUCCESS in 23m 36s
✔️ packit-tests-pip-deps-sess-rec SUCCESS in 2m 50s
✔️ packit-tests-git-main-sess-rec SUCCESS in 2m 56s
✔️ reverse-dep-packit-service-tests SUCCESS in 4m 51s

@MooSayed1
Copy link
Contributor Author

@lachmanfrantisek all good now? or anything else

Copy link
Member
@lachmanfrantisek lachmanfrantisek left a comment

Choose a reason for hiding this comment

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

All fine from me. Thanks a lot!

Can you please rebase one again since something else got merged in the meantime?

@MooSayed1 MooSayed1 force-pushed the fix-validate-config branch 2 times, most recently from 1327a4f to e2e83f7 Compare April 10, 2025 07:53
@MooSayed1
Copy link
Contributor Author

@lachmanfrantisek Done.

Copy link
Contributor

Build succeeded.
https://softwarefactory-project.io/zuul/t/packit-service/buildset/93a953701b904034931c55ec203c708d

✔️ pre-commit SUCCESS in 2m 05s
✔️ packit-tests-rpm SUCCESS in 24m 32s
✔️ packit-tests-pip-deps SUCCESS in 23m 58s
✔️ packit-tests-git-main SUCCESS in 24m 45s
✔️ packit-tests-pip-deps-sess-rec SUCCESS in 2m 55s
✔️ packit-tests-git-main-sess-rec SUCCESS in 3m 01s
✔️ reverse-dep-packit-service-tests SUCCESS in 4m 59s

@lachmanfrantisek
Copy link
Member

Sorry for missing the message. I'll take care of the rebasing this time..;)

Copy link
Contributor

Build failed.
https://softwarefactory-project.io/zuul/t/packit-service/buildset/a23aeb08136a41e7992554b812407986

✔️ pre-commit SUCCESS in 2m 12s
packit-tests-rpm FAILURE in 1m 48s
packit-tests-pip-deps FAILURE in 2m 04s
packit-tests-git-main FAILURE in 2m 13s
packit-tests-pip-deps-sess-rec FAILURE in 2m 15s
packit-tests-git-main-sess-rec FAILURE in 2m 31s
✔️ reverse-dep-packit-service-tests SUCCESS in 4m 46s

@MooSayed1
Copy link
Contributor Author

@lachmanfrantisek okay no problem but why CI take so long ..;)

@mfocko
Copy link
Member
mfocko commented May 7, 2025

taking over as it was supposed to merged

fix pre-commit

Add -c / --config-path option to validate_config and corresponding tests
@mfocko mfocko force-pushed the fix-validate-config branch from 822b269 to da483a8 Compare May 7, 2025 13:15
Copy link
Contributor

Build succeeded.
https://softwarefactory-project.io/zuul/t/packit-service/buildset/dcf70632d72d499a9201125e867ed500

✔️ pre-commit SUCCESS in 2m 07s
✔️ packit-tests-rpm SUCCESS in 23m 50s
✔️ packit-tests-pip-deps SUCCESS in 23m 42s
✔️ packit-tests-git-main SUCCESS in 23m 58s
✔️ packit-tests-pip-deps-sess-rec SUCCESS in 2m 44s
✔️ packit-tests-git-main-sess-rec SUCCESS in 3m 02s
✔️ reverse-dep-packit-service-tests SUCCESS in 5m 33s

@mfocko mfocko added the mergeit Merge via Zuul label May 7, 2025
Copy link
Contributor

Build succeeded (gate pipeline).
https://softwarefactory-project.io/zuul/t/packit-service/buildset/88c22df458ff404cba031a8540360367

✔️ pre-commit SUCCESS in 2m 03s

@softwarefactory-project-zuul softwarefactory-project-zuul bot merged commit 7368453 into packit:main May 7, 2025
29 of 31 checks passed
@lachmanfrantisek
Copy link
Member

Thanks Matěj for taking care of this. And thanks @MooSayed1 for the work on this.

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

Successfully merging this pull request may close these issues.

packit validate-config ignores the -c/--config option
3 participants
0