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

[question] Hooks and how are they working #17509

Open
1 task done
maitrey opened this issue Dec 19, 2024 · 5 comments
Open
1 task done

[question] Hooks and how are they working #17509

maitrey opened this issue Dec 19, 2024 · 5 comments
Assignees

Comments

@maitrey
Copy link

maitrey commented Dec 19, 2024

What is your question?

Dear Conan Folks,

I am again in need of an advice:

There is a seperate stage in Jenkins that is called after conan build + conan export-pkg.
This stages generates some documentation, is it possible to write a post package hook to add this file to the package?

Thanks!
Br,
Maitrey

Have you read the CONTRIBUTING guide?

  • I've read the CONTRIBUTING guide
@memsharded memsharded self-assigned this Dec 19, 2024
@memsharded
Copy link
Member

Hi @maitrey

Thanks for your question.

Yes, you can write a post_package hook that generates files and puts them inside the package.

It might also be possible to put it inside "metadata" files instead. Maybe for docs is not the best if you want it always downloaded, but the concept is similar, you can use a hook to save the metadata file see https://docs.conan.io/2/devops/metadata.html#creating-metadata-with-hooks

@maitrey
Copy link
Author

maitrey commented Dec 20, 2024

So the Jenkins stage runs after conan build + conan export-pkg , would it possible to still upload some generated pdf's ? Doesnot this then violate that package shall be immutable?

@memsharded
Copy link
Member

The post_package() hook works after the package() method, but before the conanmanifest.txt with the contents of the package and the package-revision is computed. Whatever the post_package() does to the package becomes part of the package before it is "frozen", so packages can still be immutable.

@memsharded
Copy link
Member

Regarding the documentation use case, if the files are heavy consider the following:

  • Metadata files are not downloaded everytime a package is conan install installed.
  • They are only downloaded when explicitly requested by users with conan download ... --metadata=<pattern>

This can save transfer, time and cost if the files are heavy and are not needed everytime. When a developer wants to read them, they can do the conan download --metadata to recover them.

@maitrey
Copy link
Author

maitrey commented Jan 2, 2025

Thank You for your answer, I was able to understand the feature bit better.

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

No branches or pull requests

2 participants