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

Add in the initial configuration to add the image labels #1448

Merged

Conversation

alexbarbato
Copy link
Contributor

Closes #1442

@alexbarbato alexbarbato requested a review from a team as a code owner December 11, 2023 21:17
@alexbarbato
Copy link
Contributor Author

Mostly opening for feedback and to learn what I'm missing.

Open Q:

  • I intentionally put the custom images before the standard images so that way any conflict that a user were attempt to make would just get overwritten. Open to thoughts on if we should provide errors or something for "protected labels" - feels like overkill to me.
  • Anything I'm missing?

@@ -151,6 +152,8 @@ func (bb *builderBlder) WriteableImage() (v1.Image, error) {
return nil, err
}

image, err = imagehelpers.SetStringLabels(image, bb.additionalLabels)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add an error check here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated!

@@ -65,6 +65,8 @@ func (r *RemoteBuilderCreator) CreateBuilder(ctx context.Context, builderKeychai
builderBldr.AddGroup(buildpacks...)
}

builderBldr.additionalLabels = spec.AdditionalLabels
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All the other steps are modifications via setters on the builderBldr. Can we add a set additional labels?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

happy to, do you think it adds value though?

I guess said differently I'm probably going to have that setter effectively is going to say exactly what I say here - which may be because I'm not writing good go code or something

@alexbarbato
Copy link
Contributor Author

Thank you for the review btw @matthewmcnew

@alexbarbato
Copy link
Contributor Author

Anything else y'all needed from me here?

@@ -36,7 +36,8 @@ type BuilderSpec struct {
Stack corev1.ObjectReference `json:"stack,omitempty"`
Store corev1.ObjectReference `json:"store,omitempty"`
// +listType
Order []BuilderOrderEntry `json:"order,omitempty"`
Order []BuilderOrderEntry `json:"order,omitempty"`
AdditionalLabels map[string]string `json:"additionalLabels,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you regenerate the CRDs as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just added a new commit.

Please let me know if you think it's not the right place

@alexbarbato alexbarbato force-pushed the builder-additional-labels branch from f610a31 to 80f2e13 Compare December 29, 2023 16:56
Signed-off-by: Alex Barbato <abarbato@vmware.com>
@tomkennedy513 tomkennedy513 merged commit 2d3ff20 into buildpacks-community:main Jan 17, 2024
1 check passed
chenbh pushed a commit that referenced this pull request Jan 29, 2024
Add in the initial configuration to add the image labels
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

Successfully merging this pull request may close these issues.

Add the ability to add arbitrary image labels to a built Builder image
4 participants