func icon indicating copy to clipboard operation
func copied to clipboard

On-cluster build: Enable custom buildpacks

Open zroubalik opened this issue 3 years ago • 24 comments

Currently there's no way how we can build a funcion on cluster with a custom buildpack. For example Go runtime specifies these additional builpacks:

buildpacks:
- paketo-buildpacks/go-dist
- ghcr.io/boson-project/go-function-buildpack:tip

pack library used for local build handles this properly and pulls those additional builpacks.

Though /cnb/lifecycle/* binaries used by buildpack Tekton Task has only access to builpacks that are copyied into the buillder image:

 /cnb/lifecycle/creator --help
Usage of lifecycle:
  -buildpacks string
    	path to buildpacks directory (default "/cnb/buildpacks")
...

We probably need to pull and copy these builpacks to this directory before we initiate the build.

zroubalik avatar Apr 20 '22 12:04 zroubalik

This issue is stale because it has been open for 90 days with no activity. It will automatically close after 30 more days of inactivity. Reopen the issue with /reopen. Mark the issue as fresh by adding the comment /remove-lifecycle stale.

github-actions[bot] avatar Jul 20 '22 01:07 github-actions[bot]

/remove-lifecycle stale

lance avatar Jul 20 '22 17:07 lance

/kind feature-request

lance avatar Jul 28 '22 19:07 lance

/assign

grafvonb avatar Oct 24 '22 06:10 grafvonb

related: https://github.com/buildpacks/tekton-integration/issues/30

matejvasek avatar Oct 26 '22 12:10 matejvasek

Status quo:

  • https://github.com/knative/func/blob/main/pipelines/resources/tekton/task/func-buildpacks/0.1/func-buildpacks.yaml
  • https://github.com/tektoncd/catalog/blob/main/task/buildpacks/0.5/buildpacks.yaml

grafvonb avatar Nov 02 '22 21:11 grafvonb

Our challenge here, in my opinion, is that from a UX perspective, switching between local and on-cluster builds by simply adding the --remote flag should be seamless for the user, i.e. provide the same functionality.

However, we use the pack library locally, while buildpacks Tekton Task uses the lifecycle directly, as mentioned by @zroubalik above (https://github.com/tektoncd/catalog/blob/main/task/buildpacks/0.5/buildpacks.yaml#L136), which does not provide "the power" of pack.

If we look at the ways buildpacks can be specified for pack (https://buildpacks.io/docs/app-developer-guide/specify-buildpacks/) and the implementation behind it (https://github.com/buildpacks/pack/tree/main/pkg/buildpack), it will take some time to recreate even the loading and extracting functionality for all the cases.

So, how do we deal with this issue? Maybe we should start small and initially just support one (it's better than nothing), simple URI format, like URL for the custom buildbacks, and extend our func-buildpacks.yaml accordingly?

grafvonb avatar Nov 08 '22 05:11 grafvonb

@grafvonb you are right, my idea was to extend func-buildpacks Tekton task, so it will pull, extract and copy (we can probably use skopeo for this?) buildpacks from theirs images to some directory mounted to a volume. The lifecycle binary has a parameter that can point to a directory that contains additional buildpacks (so we just need to copy/link the additional buildpacks there). I concur this is not the nicest solution, but I haven't found anything better.

Btw there's some ongoing work to improve buildpacks on this front, not sure about the current status though: https://cloud-native.slack.com/archives/C032UM9DZV4/p1654790078405669?thread_ts=1654718175.599989&cid=C032UM9DZV4

zroubalik avatar Nov 08 '22 09:11 zroubalik

@zroubalik ok, I got it. Should I start with an initial implementation?

grafvonb avatar Nov 08 '22 09:11 grafvonb

@grafvonb it would be awesome if you can do so. Though might be worth checking that stuff I linked there ^, maybe there's some progress on that area that would enable us to use something nicer.

zroubalik avatar Nov 08 '22 10:11 zroubalik

@zroubalik great, I'll do it. Could you please invite me to this slack workspace? Thx.

grafvonb avatar Nov 08 '22 13:11 grafvonb

@grafvonb it would be awesome if you can do so. Though might be worth checking that stuff I linked there ^, maybe there's some progress on that area that would enable us to use something nicer.

@zroubalik very interesting, after 5 months the discussion about additional buildpacks support in Tekton's buildpacks task was started, yesterday came an update: https://cloud-native.slack.com/archives/C032UM9DZV4/p1667932092715799?thread_ts=1654718175.599989&cid=C032UM9DZV4. So there is no progress on this issue. Maybe we should take that over? Nevertheless, I will then start quite pragmatically with the first try for the scopeo solution.

grafvonb avatar Nov 09 '22 07:11 grafvonb

agree, thanks!

zroubalik avatar Nov 09 '22 11:11 zroubalik

Short update. The above discussion apparently ended a month ago with the sentence "I'll add the point to the agenda for the next one", which may simply mean "no-prio" status ;). As #1433 finally gets finalized I will get back to this topic.

grafvonb avatar Dec 12 '22 20:12 grafvonb

I am back from vacation and continue to work on the solution.

grafvonb avatar Jan 09 '23 07:01 grafvonb

@grafvonb any updates here?

lance avatar Mar 21 '23 13:03 lance

@lance sorry, there's no progress there; I was blocked by https://github.com/knative/func/pull/1598 but I think it's closed now from the standpoint of initial development so I can get back to this topic.

grafvonb avatar Mar 22 '23 06:03 grafvonb

For testing purposes of this issue, it would be nice to have https://github.com/knative/func/issues/1466 implemented, so I'm working on that issue first.

grafvonb avatar May 02 '23 14:05 grafvonb

For testing purposes of this issue, it would be nice to have #1466 implemented, so I'm working on that issue first.

Thanks so much for your contributions @grafvonb!

lance avatar May 02 '23 19:05 lance

Depends on #1466. Still in evaluation.

grafvonb avatar Jun 27 '23 13:06 grafvonb

This issue is stale because it has been open for 90 days with no activity. It will automatically close after 30 more days of inactivity. Reopen the issue with /reopen. Mark the issue as fresh by adding the comment /remove-lifecycle stale.

github-actions[bot] avatar Mar 06 '24 01:03 github-actions[bot]

This issue is stale because it has been open for 90 days with no activity. It will automatically close after 30 more days of inactivity. Reopen the issue with /reopen. Mark the issue as fresh by adding the comment /remove-lifecycle stale.

github-actions[bot] avatar Jun 21 '24 01:06 github-actions[bot]

/remove-lifecycle stale

matejvasek avatar Jun 21 '24 11:06 matejvasek

This issue is stale because it has been open for 90 days with no activity. It will automatically close after 30 more days of inactivity. Reopen the issue with /reopen. Mark the issue as fresh by adding the comment /remove-lifecycle stale.

github-actions[bot] avatar Sep 21 '24 01:09 github-actions[bot]