-
Notifications
You must be signed in to change notification settings - Fork 18
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
Add Source and Source256 fields to dependencies in buildpack.toml. #196
Add Source and Source256 fields to dependencies in buildpack.toml. #196
Conversation
- This is primarily used by third-party provenance tools which leverage these fields to determine what dependencies a buildpack ships.
I doubt there is one. There have never been many integration tests. It's fine if you just push what you can into the unit tests for carton.
I think my preference would be that if you don't set the flags then My preference would also be that if the fields are empty they do not get included. I think you can add
Flag processing is fine in the cmd.
Thanks 🤦 I was talking to @pivotal-david-osullivan about this and I think there are going to be more things to do here. This is probably one of the most painful changes to make in the pipelines because it has to filter through three different levels.
Hope that helps! |
Thanks for the detailed feedback @dmikusa The main reason I wanted to introduce the logic of "default to the values of uri/sha256" in this tool is precisely to simply the process of introducing these values: to avoid having to propagate that logic all the way upstream across the multiple steps as you describe. I'm not convinced that the value of keeping the buildpack dependency tool simple is worth the extra effort, but I'm happy to defer to your requests as a maintainer :) However, I do think there's something I'm missing: The way you describe the actions requiring custom logic per dependency to determine the source URI surprises me, and makes me think that I'm missing something in the way the URI field is being used. My mental model is that the actions find a URI for a dependency, calculate its SHA256, and write that into the buildpack.toml. I would expect those values to be sufficient for the As an example the bellsoft-liberica buildpack has this value for one of its dependencies: One possibility is that the pipelines do different things when creating offline buildpacks, but last time I looked a buildpack built using this infrastructure, it seemed like the URI in buildpack.toml didn't change - it always pointed to the upstream, source, URI. So, can you expand a bit more on what extra logic would have to go into the actions in order to identify values for these new source/source-sha fields? |
That's a good question, cause I'm starting to think that I'm not understanding the requirements here. My understanding, what you can base my previous comments on, is that |
Sure, so the high-level goal is to make it easier for some (proprietary) tooling to be able to perform provenance of open source components. We've already built tooling for the other Paketo buildpacks which uses the For buildpacks that provide a dependency directly - without compilation or pre-processing (and which I believe is all of the buildpacks created with this pipeline tooling) - the source URI would point to the precompiled/bytecode artifact, and therefore would be identical to the For buildpacks that do pre-processing/compilation, we host the resulting artifact on https://artifacts.paketo.io, and as such the Does that help clarify? Next, I'd like to clarify that all the buildpacks that are built with this tooling use upstream dependencies as-is - that they do not perform any pre-processing/compilation and therefore that they don't re-host artifacts on https://artifacts.paketo.io or elsewhere. If that is true then the source field will always be identical to the |
Yes, thanks. That helps. All of the Java buildpacks, utility buildpacks (watchexec, syft, etc..), and APM buildpacks all take upstream dependencies. We don't build any dependencies. I don't have a crystal ball or anything, but I don't see that changing in the future. There'd have to be a really strong reason since we don't have the infrastructure to do that, and it would be a considerable effort. Given that, can we just short-circuit all this and have you use the I also am concerned about the default values being non-blank because I feel like we'll get into a situation where the tooling is there to add the default value fields, but the tooling never gets updated to actually allow those to be properly controlled. In short, I'd like to make sure we get a full solution, not just a partial solution. |
@dmikusa the challenge with updating the tooling to just use Another argument for adding the Would you prefer me to open an RFC to codify these fields for all Paketo buildpacks, and have this discussion there? |
That can be done per buildpack. You have a list that never will, if it's in the list you're all set.
I don't have a problem adding the fields. I just had to ask, since it seemed like duplication of data for little benefit. If we add the fields, I would want to see it done the way I outlined above though, I don't like the idea of having the defaults to |
fixes test format issues
@dmikusa @robdimsdale I updated this PR based on the discussion here - the source fields will not be picked up if they are not set in the dependency and will not be updated if they aren't set. When running unit tests locally I found they were failing since the removal of the 'Focus' - this was causing failing tests to be skipped altogether. I updated the tests' format for their buildpack.toml data which I think was out-of-date, tests passed with this change. |
Signed-off-by: Daniel Mikusa <dan@mikusa.com>
Summary
This PR adds
source
andsource-sha256
fields to the dependencies inbuildpack.toml
. These fields are not used by buildpacks directly, but instead are used third-party provenance tools which leverage these fields to determine what dependencies a buildpack ships.Paketo buildpacks that use
packit
instead oflibpack
already support these fields - this PR brings thelibpack
-based buildpacks inline with the existing behavior for the other buildpacks.I believe that this should be a backwards-compatible change when bumped in the buildpacks and pipeline-builder. We don't rely on these fields for any buildpack logic, so whether they exist or not has no impact on the buildpack behavior. Whenever
libpack
is bumped inpipeline-builder
(and the pipelines are bumped in the buildpacks), it is my understanding that the next time dependencies are updated they will have these new fields.Implementation notes
I couldn't find an integration test for
cmd/update-buildpack-dependency/main.go
, but I updated relevant existing unit tests incarton
.I am open to discussion about the best way to handle missing
--source
and--source-256
fields when invokingcmd/update-buildpack-dependency/main.go
. I think using theuri
andsha256
is a sensible default when both fields are missing - this is consistent with other paketo buildpacks that already have values forsource
andsource-sha256
. I think at thecarton
level we should treat them as any other plain string.I'd be open to moving more logic into
carton
, but we already have a precedent for some initial flag processing incmd
so I wanted to follow that.As an aside, I removed an instance of
it.Focus
which was committed previously; likely inadvertently.Checklist