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

Set org.opencontainers.image.source From project.source-url #1049

Open
jamesward opened this issue Feb 2, 2021 · 9 comments
Open

Set org.opencontainers.image.source From project.source-url #1049

jamesward opened this issue Feb 2, 2021 · 9 comments
Labels
status/blocked Issue or PR that is blocked. See comments. type/enhancement Issue that requests a new feature or improvement.

Comments

@jamesward
Copy link

I was trying to set the org.opencontainers.image.source label in a container created by pack but it always gets set to the url for my buildpack despite setting the project.source-url: https://github.com/jamesward/easycloudrun/blob/main/project.toml

@jamesward jamesward added status/triage Issue or PR that requires contributor attention. type/bug Issue that reports an unexpected behaviour. labels Feb 2, 2021
@dfreilich
Copy link
Member

Wow. Looking at the schema, we definitely need to add more to fulfill the implementation of it.

I don't see, in the RFC (buildpacks/rfcs#32), a description of expected behavior with project.source-url@jkutner , is that what you would expect for project.source-url?

@dfreilich dfreilich added this to the 0.18.0 milestone Feb 3, 2021
@ekcasey
Copy link
Member

ekcasey commented Feb 3, 2021

@dfreilich Not sure how this interacts with source-url in project.toml and org.opencontainers.image.source but I thought at one point there was a plan to have pack read git metadata at pass project-metadata.toml to the lifecycle, which would in turn set io.buildpacks.project.metadata

@dfreilich dfreilich removed this from the 0.18.0 milestone Feb 9, 2021
@jromero
Copy link
Member

jromero commented Mar 5, 2021

  1. This seems like something the lifecycle should do. Is there an RFC or anything on the spec talking about setting predefined OCI annotations?
  2. As @dfreilich noticed, we are probably missing a good bit here in supporting project.toml and project-metadata.toml
  3. There is a related issue to @ekcasey comment here: Understand Spring Boot Git Properties #446

@jromero
Copy link
Member

jromero commented Mar 5, 2021

In an effort to reproduce the report here are the steps I took:

❯ gh repo clone jamesward/easycloudrun
Cloning into 'easycloudrun'...
...

/tmp on ☁️ rjavier@vmware.com
❯ cd easycloudrun/

easycloudrun on  main on ☁️ rjavier@vmware.com
❯ pack build ghcr.io/jamesward/easycloudrun --buildpack ghcr.io/jamesward/gcloud-buildpack --builder gcr.io/buildpacks/builder:v1 --run-image ghcr.io/jamesward/gcloud-buildpack-run
v1: Pulling from buildpacks/builder
9f2825a1003a: Pull complete
...
Digest: sha256:a71080cf7b7b14fac4557d157a374a07892dd531e07408fc95ee025c6bdd0741
Status: Downloaded newer image for gcr.io/buildpacks/builder:v1
latest: Pulling from jamesward/gcloud-buildpack-run
...
b898f13db3be: Pull complete
Digest: sha256:3cefe8fee6fa35551b0cf0b4d88b61feca5854fda57e06d73a88ea5fb542b519
Status: Downloaded newer image for ghcr.io/jamesward/gcloud-buildpack-run:latest
latest: Pulling from jamesward/gcloud-buildpack
678a08b66018: Pull complete
Digest: sha256:110efac0f1f629aff71be40f5a32c0dc6ccdd128872a84a8e9ac137898a790c3
Status: Downloaded newer image for ghcr.io/jamesward/gcloud-buildpack:latest
===> DETECTING
jamesward/gcloud 0.0.1
===> ANALYZING
Previous image with name "ghcr.io/jamesward/easycloudrun" not found
===> RESTORING
===> BUILDING
---> Creating process: appsecret
---> Creating process: deploywithenvs
---> Creating process: listservices
---> Creating process: multiregion
===> EXPORTING
Adding layer 'jamesward/gcloud:app'
Adding 1/1 app layer(s)
Adding layer 'launcher'
Adding layer 'config'
Adding layer 'process-types'
Adding label 'io.buildpacks.lifecycle.metadata'
Adding label 'io.buildpacks.build.metadata'
Adding label 'io.buildpacks.project.metadata'
Warning: default process type 'web' not present in list [appsecret deploywithenvs listservices multiregion]
*** Images (0eb884d3c2cb):
      ghcr.io/jamesward/easycloudrun
Successfully built image ghcr.io/jamesward/easycloudrun

easycloudrun on  main on ☁️ rjavier@vmware.com took 2m26s
❯ docker inspect ghcr.io/jamesward/easycloudrun | jq -r '.[0].Config.Labels'
{
  "io.buildpacks.build.metadata": "{\"bom\":null,\"buildpacks\":[{\"id\":\"jamesward/gcloud\",\"version\":\"0.0.1\",\"homepage\":\"https://github.com/jamesward/gcloud-buildpack\"}],\"launcher\":{\"version\":\"0.10.2\",\"source\":{\"git\":{\"repository\":\"github.com/buildpacks/lifecycle\",\"commit\":\"960cf58\"}}},\"processes\":[{\"type\":\"appsecret\",\"command\":\"/layers/jamesward_gcloud/app/appsecret.sh\",\"args\":null,\"direct\":true,\"buildpackID\":\"jamesward/gcloud\"},{\"type\":\"deploywithenvs\",\"command\":\"/layers/jamesward_gcloud/app/deploywithenvs.sh\",\"args\":null,\"direct\":true,\"buildpackID\":\"jamesward/gcloud\"},{\"type\":\"listservices\",\"command\":\"/layers/jamesward_gcloud/app/listservices.sh\",\"args\":null,\"direct\":true,\"buildpackID\":\"jamesward/gcloud\"},{\"type\":\"multiregion\",\"command\":\"/layers/jamesward_gcloud/app/multiregion.sh\",\"args\":null,\"direct\":true,\"buildpackID\":\"jamesward/gcloud\"}]}",
  "io.buildpacks.lifecycle.metadata": "{\"app\":[{\"sha\":\"sha256:7e38e40786d4aa9c7ffa2f5d61440a02b54e8cd07c5346eb67d2155fac97e8e8\"}],\"buildpacks\":[{\"key\":\"jamesward/gcloud\",\"version\":\"0.0.1\",\"layers\":{\"app\":{\"sha\":\"sha256:4071f8bbdd82f7a722b9d7d618a6579efc70a6481e89da51f9597d7eb08d618c\",\"data\":null,\"build\":false,\"launch\":true,\"cache\":false}}}],\"config\":{\"sha\":\"sha256:7496e66d5befcc216bc07b306c636da09eaa338eeba5ab153283340d4604679c\"},\"launcher\":{\"sha\":\"sha256:576e5f5696c6fcae9b679dca450d7ab127176f5c529bc9790b42abb9e3658cfa\"},\"process-types\":{\"sha\":\"sha256:0bea18cf40be4650397f350275053f59837eb3ded93927c9fc5c3758ed17d297\"},\"runImage\":{\"topLayer\":\"sha256:76e910db79bb06cfc4a0317db0b06e686295a58e242f62a3e63031261224ec2f\",\"reference\":\"90eec569e02884b967351b4c7b39bb68ea7f53bfeedf795a212dbc6b8b1eb5e2\"},\"stack\":{\"runImage\":{\"image\":\"gcr.io/buildpacks/gcp/run:v1\"}}}",
  "io.buildpacks.project.metadata": "{}",
  "io.buildpacks.stack.id": "google",
  "org.opencontainers.image.source": "https://github.com/jamesward/gcloud-buildpack"
}

Found that the label org.opencontainers.image.source is being set on the run image.

❯ docker inspect ghcr.io/jamesward/gcloud-buildpack-run | jq -r '.[0].Config.Labels'
{
  "io.buildpacks.stack.id": "google",
  "org.opencontainers.image.source": "https://github.com/jamesward/gcloud-buildpack"
}

@jromero
Copy link
Member

jromero commented Mar 5, 2021

@ekcasey given my comment above do you think it's best that we move this to the lifecycle and add the status/requires-rfc status?

@jromero jromero added status/requires-rfc Issue or PR that requires an RFC to be filed. and removed status/triage Issue or PR that requires contributor attention. labels Mar 5, 2021
@jromero
Copy link
Member

jromero commented May 27, 2021

Discussion started for this feature request. Please vote/contribute to it.

@jromero jromero added type/enhancement Issue that requests a new feature or improvement. and removed type/bug Issue that reports an unexpected behaviour. labels May 27, 2021
@jjbustamante
Copy link
Member

The following RFC proposes that a buildpack can add arbitrary annotations to an image, today buildpacks can add arbitrary labels to an image.

RFC is in draft state, if anyone in the community is willing to push it forward we are more than happy to help and guide you!

@jjbustamante jjbustamante added status/blocked Issue or PR that is blocked. See comments. and removed status/requires-rfc Issue or PR that requires an RFC to be filed. labels Aug 18, 2023
@jjbustamante
Copy link
Member

Block on RFC 196

@natalieparellano
Copy link
Member

buildpacks/rfcs#196 is superseded, please consult buildpacks/rfcs#314

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status/blocked Issue or PR that is blocked. See comments. type/enhancement Issue that requests a new feature or improvement.
Projects
None yet
Development

No branches or pull requests

6 participants