kpack icon indicating copy to clipboard operation
kpack copied to clipboard

Is it possible to use build env to determine whether download source code in prepare stage or not

Open zhoufenqin opened this issue 2 years ago • 5 comments

When I config a cnb image with blob url, like

apiVersion: kpack.io/v1alpha2
kind: Image
metadata:
  name: default.test
spec:
build:
  cache:
    volume:
      size: 1536Mi
  source:
    blob:
      url: https://xx.file.core.windows.net/bab958c1e4444a409bd8b20a8f12e039/xxx?se=2022-09-08T10%3A12%3A47Z&sp=r&sv=2021-06-08&sr=f&sig=xxx
......

Then the source code will be downloaded in the Prepare stage when a build pod is triggered. Sometimes, if I need to do some migration, like upgrade the buildpack version in the clusterstore, then use kpack-controller to trigger a new build pod automatically to generate a new image, then the Prepare stage may be failed because the blob.url SAS token is expired.

So if I use cache to store source code in /workspace layer, then how can I determine not to pull the source code again and again, just use the cached workspace layer generated in previous builds? It may helpful for some maintenance work, like helping a customer to generate a new image without CVE issues or upgrading the buildpack version. The expired blob.url may block this kind of operation.

zhoufenqin avatar Oct 31 '22 09:10 zhoufenqin