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

Faciliate installation in the CI #384

Open
theofidry opened this issue Nov 30, 2022 · 6 comments
Open

Faciliate installation in the CI #384

theofidry opened this issue Nov 30, 2022 · 6 comments

Comments

@theofidry
Copy link

I've been giving another try to phive, locally I'm quite happy with it but the CI integration is a bit more annoying.

The GitHubAction shivammathur/setup-php does quite a good job at facilitating things and in fact allows to install multiple tools, but you have the following problems:

  • if you install those tools with that action:
    • I don't know if there are verified
    • It may be a different version than what you specified with phive
    • You need to be explicit (as opposed to $ phive install)
  • if you use phive in the CI:
    • you might get rate limited by the GitHub API
    • you need to specify the GPG key...

Do you have any suggestion/recommendation on how to make it easier?

@theseer
Copy link
Member

theseer commented Dec 5, 2022

Partially.

you might get rate limited by the GitHub API

I don't know why Github rate limits their own action subsystem and not auto-grants the same API access levels as when authenticating with an API token. But phive supports github auth tokens - simply ensure we have a valid token in GITHUB_AUTH_TOKEN set in the environment, for instance via the settings -> security: secrets -> actions.

you need to specify the GPG key...

This is indeed a bit annoying. I'm open for suggestions here, but it feels like a general conflict of interests:

When run locally, you want to interactively be asked whether to import an unknown key. In CI, no means of interaction exists yet auto-importing everything would kill the very idea of using keys. Our current compromise is to specify a list of trusted keys and with that have a means to auto-trust them for importing.

One might argue, we could persist the acceptance of the key in use when done locally. But that's dangerous, as long as we use a shared key storage as it would allow to poison the key store: When you phive install things from any open source project all the keys they accepted would be auto-imported. That would make you inherit their trust choices. Not exactly a good idea ;)

I'm not sure what the best option would be here? Maybe store the key id in the phive.xml and add an option to explicitly auto-imoport trusted keys from it?

@theofidry
Copy link
Author

I'm not sure easier.

From a practical PoV, I can see it as a show-stopper:

  1. There is https://github.com/bamarni/composer-bin-plugin that can help you to install such tools as their package version without polluting your code
  2. https://github.com/shivammathur/setup-php already helps to install such tools in the CI

The current reason why I would personally pick 1) over 2) is that I can make sure it's the same tools installed locally and in the CI: the least variation in setup and how things are running I have between my local environment and the CI the better. There is inevitable differences of course, but it's still something I'm striving for.


However I do like PHIVE so I would like to make it work more easily!

Maybe two possibilities:

  • Would it make sense to list the trusted keys within .phive and:
    • Add an option to take it as the list of trusted keys; not done by default, allowing to do so for the CI
    • When passing the option whilst not in the CI, show a fat warning which could link to a doc entry to discourage users from abusing it or accidentally use it without being aware of the problem?
  • Might be silly but do we care at all about the trusted keys in the CI? I.e. would it hurt to install those PHARs without have the keys checked at all there?

@theofidry
Copy link
Author

Coming back to this:

Would it make sense to list the trusted keys within .phive and:

This would also offer the benefit of being able to cache it and even create a GitHub Actions step that takes care of it (it would be quite a simple step: cache/restore that directory + run phive install)

Might be silly but do we care at all about the trusted keys in the CI? I.e. would it hurt to install those PHARs without have the keys checked at all there?

Still relevant IMO. At this point, which tool you added has been "acknowledged"/vetted already.

@theseer
Copy link
Member

theseer commented Nov 13, 2023

I totally see that we need to find a better automated/CI support. I'm just not sure yet what approach is feasible without sacrificing security ;)

Phive has quite some things that need to get addressed. This certainly one of them.

@theofidry
Copy link
Author

FWIW I'm happy to talk about that in a call too :)

@theseer
Copy link
Member

theseer commented Nov 13, 2023

Sounds like a plan :) Now we need to find a time slot :)

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