Skip to content

feat: add insecure registries configuration for buildpacks buildstrategy#2159

Merged
openshift-merge-bot[bot] merged 6 commits into
shipwright-io:mainfrom
idiap:feat/insecure-registries-support-for-buildpacks-buildstrategy
May 18, 2026
Merged

feat: add insecure registries configuration for buildpacks buildstrategy#2159
openshift-merge-bot[bot] merged 6 commits into
shipwright-io:mainfrom
idiap:feat/insecure-registries-support-for-buildpacks-buildstrategy

Conversation

@sgaist

@sgaist sgaist commented Apr 15, 2026

Copy link
Copy Markdown
Contributor

Changes

This PR adds the insecure registries configuration option for buildpacks buildstrategy.

This is similar to what the buildah and source-to-image BuildStragegy provide and will allow people using local registries or registries behind self-signed certificate to use buildpacks to build their image.

Related Issue

Not a secure solution but partly related to #1835 while waiting for SHIP-0042 implementation.

Type of PR

/kind feature

Submitter Checklist

  • Includes tests if functionality changed/was added
  • Includes docs if changes are user-facing
  • Kind label has been set
  • Release notes block has been filled in, or marked NONE

See the contributor guide
for details on coding conventions, github and prow interactions, and the code review process.

Release Notes

The buildpacks sample build strategies now allow the configuration of insecure registries in a fashion similar to buildah and source-to-image.

@openshift-ci openshift-ci Bot added kind/feature Categorizes issue or PR as related to a new feature. release-note Label for when a PR has specified a release note labels Apr 15, 2026
@pull-request-size pull-request-size Bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Apr 15, 2026
@sgaist sgaist force-pushed the feat/insecure-registries-support-for-buildpacks-buildstrategy branch from f696fc0 to 0ad9f06 Compare April 15, 2026 12:40

@SaschaSchwarze0 SaschaSchwarze0 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks @sgaist for your contribution. Some ideas/questions/suggestions:

  • In a Build, one can set .spec.output.insecure = true. For a strategy-managed push buildstrategy (like buildpacks), we can pass this value to the build strategy using the system-defined parameter shp-output-insecure. Today, we only honor this in BuildKit's sample build strategy: https://github.com/shipwright-io/build/blob/v0.19.2/samples/v1beta1/buildstrategy/buildkit/buildstrategy_buildkit_cr.yaml#L69-L70. I think with the CNB variable you are using, we can also support it in Buildpacks with some scripting in the bash script. We should do this, though, it would only be for the output registry. In most scenarios, that is probably enough.
  • The parameter that you are added is a single string. Users will need to know the format that Buildpacks expect (like how to separate multiple registry hosts). For consistency, it would be nice to have it as an array like in BuildAh. Do you see blockers for this ?
  • Brings me to the question, whether you think this is only needed for the registry the image is pushed to (then I'd say supporting shp-output-insecure is enough), or if you think that users may also want to access other images (only the run-image comes to my mind) from an insecure registry.

@sgaist

sgaist commented Apr 17, 2026

Copy link
Copy Markdown
Contributor Author

Thanks @sgaist for your contribution. Some ideas/questions/suggestions:

* In a Build, one can set `.spec.output.insecure = true`. For a strategy-managed push buildstrategy (like buildpacks), we can pass this value to the build strategy using the [system-defined parameter `shp-output-insecure`](https://github.com/shipwright-io/build/blob/main/docs/buildstrategies.md#system-parameters). Today, we only honor this in BuildKit's sample build strategy: https://github.com/shipwright-io/build/blob/v0.19.2/samples/v1beta1/buildstrategy/buildkit/buildstrategy_buildkit_cr.yaml#L69-L70. I think with the CNB variable you are using, we can also support it in Buildpacks with some scripting in the bash script. We should do this, though, it would only be for the output registry. In most scenarios, that is probably enough.

Do you mean have an export CNB_INSECURE_REGISTRIES line based on shp-output-insecure in the script ?

* The parameter that you are added is a single string. Users will need to know the format that Buildpacks expect (like how to separate multiple registry hosts). For consistency, it would be nice to have it as an array like in BuildAh. Do you see blockers for this ?

My bad, I thought I had updated the description, it's a comma separated list. I will fix while we discuss design.

I wanted to use an array for it however it seems that it's something that is not possible for environment variable content but maybe I missed something during my tests.

* Brings me to the question, whether you think this is only needed for the registry the image is pushed to (then I'd say supporting `shp-output-insecure` is enough), or if you think that users may also want to access other images (only the run-image comes to my mind) from an insecure registry.

I completely missed that second scenario and I think that is also a valid use case.

@sgaist sgaist force-pushed the feat/insecure-registries-support-for-buildpacks-buildstrategy branch from 16eee1e to f90dda6 Compare April 17, 2026 19:24
@SaschaSchwarze0

Copy link
Copy Markdown
Member

@sgaist correct, it means to programmatically fill the content of the CNB_INSECURE_REGISTRIES environment variable depending on how shp-output-insecure is set. That way (= by adding logic to the bash script), you can also support an array like in the other sample strategies that do it for BuildAh.

@pull-request-size pull-request-size Bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels May 1, 2026
@sgaist sgaist force-pushed the feat/insecure-registries-support-for-buildpacks-buildstrategy branch from c56cb3b to 2976db7 Compare May 1, 2026 11:27
@sgaist

sgaist commented May 3, 2026

Copy link
Copy Markdown
Contributor Author

@SaschaSchwarze0 There's another thing that could be done to simplify things in these BuildStrategies: pack's lifecycle now also has the creator executable that run the five phases in order.
That would shorten the code.
Since it's not directly related to this change, it could be done in a follow PR. What do you think ?

@SaschaSchwarze0

Copy link
Copy Markdown
Member

@SaschaSchwarze0 There's another thing that could be done to simplify things in these BuildStrategies: pack's lifecycle now also has the creator executable that run the five phases in order. That would shorten the code. Since it's not directly related to this change, it could be done in a follow PR. What do you think ?

We had gone the other way in #990 for reasons related to the process type. Whether creator arguments these days would allow us to go back, I do not know.

@SaschaSchwarze0

Copy link
Copy Markdown
Member

@sgaist you have not permitted maintainers to make changes to your pull request. Can you either allow this, or rebase your branch and cherry-pick SaschaSchwarze0@9cc2c1d. Tyia.

sgaist and others added 6 commits May 18, 2026 08:53
This is similar to what the buildah and source-to-image
BuildStragegy provide.

Signed-off-by: Samuel Gaist <samuel.gaist@idiap.ch>
Signed-off-by: Samuel Gaist <samuel.gaist@idiap.ch>
This is required to have the insecure registries support.

Signed-off-by: Samuel Gaist <samuel.gaist@idiap.ch>
Move the handling logic into the script part.

This allows users users to use a list in their Build/BuildRun
and also matches other implementations.

Signed-off-by: Samuel Gaist <samuel.gaist@idiap.ch>
Signed-off-by: Samuel Gaist <samuel.gaist@idiap.ch>
… as desired.

Assisted by: GitHub Copilot/Claude Opus 4.7
Signed-off-by: Sascha Schwarze <schwarzs@de.ibm.com>
@sgaist sgaist force-pushed the feat/insecure-registries-support-for-buildpacks-buildstrategy branch from b49deb7 to 48bc810 Compare May 18, 2026 06:59
@sgaist

sgaist commented May 18, 2026

Copy link
Copy Markdown
Contributor Author

@SaschaSchwarze0 There's another thing that could be done to simplify things in these BuildStrategies: pack's lifecycle now also has the creator executable that run the five phases in order. That would shorten the code. Since it's not directly related to this change, it could be done in a follow PR. What do you think ?

We had gone the other way in #990 for reasons related to the process type. Whether creator arguments these days would allow us to go back, I do not know.

Thanks for the pointer.
I'll have to do some more checks so it's clearly out of scope for this specific PR.

@sgaist you have not permitted maintainers to make changes to your pull request. Can you either allow this, or rebase your branch and cherry-pick SaschaSchwarze0@9cc2c1d. Tyia.

Done !
I cannot change that setting as it's a PR done from my institute's GitHub organization and not a personal fork but happy to integrate your changes.

@SaschaSchwarze0 SaschaSchwarze0 added this to the release-v0.20.0 milestone May 18, 2026

@SaschaSchwarze0 SaschaSchwarze0 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

/approve
/lgtm

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label May 18, 2026
@openshift-ci

openshift-ci Bot commented May 18, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: SaschaSchwarze0

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 18, 2026
@openshift-merge-bot openshift-merge-bot Bot merged commit 7bf7da8 into shipwright-io:main May 18, 2026
15 checks passed
@github-project-automation github-project-automation Bot moved this to Done in Issues May 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. kind/feature Categorizes issue or PR as related to a new feature. lgtm Indicates that a PR is ready to be merged. release-note Label for when a PR has specified a release note size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants