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

Make qualifiers extensible #39

Open
tomcoldrick-ct opened this issue Jun 21, 2024 · 0 comments
Open

Make qualifiers extensible #39

tomcoldrick-ct opened this issue Jun 21, 2024 · 0 comments

Comments

@tomcoldrick-ct
Copy link
Collaborator

Currently we support a few qualifiers, implemented explicitly within our code. It would be convenient to be able to support more. The difficulty here is that they're a bit vaguely specified, and the API isn't used enough for much to have been actually done with them for us to abstract them generically. This makes finding a point to hook them in a little tricky. Users wishing to add custom qualifiers are also going to struggle, and will need to fork (or upstream changes to) this repository to add them.

Thankfully, at least one of our implementations (remote executing fetcher) offers a simple enough API to hook around! The Remote Executing fetcher works by building a command to run as an Action in a REAPI cluster. In this world, qualifiers may be implemented entirely as modifying this command generically. We can exploit this by allowing operators to write some kind of script (Starlark maybe?) that takes a command and set of qualifiers, and returns a command and set of qualifiers, building an appropriate command. The set of qualifiers returned should be the input minus any qualifiers handled by the script. We can chain such scripts together to build complex commands, while each qualifier is handled simply.

For example, operators could add a script that handles resource_type and pops out a command appropriate for the specified resource (e.g. a git command, a hg command, a curl command). Another script could take checksum.sri, and append a sha256sum of the downloaded resource. I think this might be the most sensible way to handle the feature of packing/unpacking resources also, instead of the "transparent unpacking" allowed by the spec -- a qualifier can be added to do it that adds a zip or unzip or tar command etc.

This will only help us for the remote execution backend, however. I think for the regular backends we could possibly add something like pre and post-fetch hooks to have some functionality like packing and unpacking, but have something like resource_type controlled entirely by what we actually have implemented. We should strongly encourage the use of the REAPI backend anyhow.

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

1 participant