-
Notifications
You must be signed in to change notification settings - Fork 128
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
Custom CA bundle for build-task #1025
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -79,6 +79,14 @@ spec: | |
description: Path to a file with build arguments, see https://www.mankier.com/1/buildah-build#--build-arg-file | ||
type: string | ||
default: "" | ||
- name: caTrustConfigMapName | ||
type: string | ||
description: The name of the ConfigMap to read CA bundle data from. | ||
default: trusted-ca | ||
- name: caTrustConfigMapKey | ||
Comment on lines
+82
to
+86
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm conflicted about the consistency of these param names. On the one hand, the buildah task uses UPPERCASE_NAMES, so this is inconsistent. On the other hand, we already dropped the ball in #942 (And in the context of the whole pipeline, the params should be consistent across all the tasks.) For this PR, I don't really care what you choose. We really need to make the param casing across all tasks consistent. Breaking changes on that scale will be fun 🥲 |
||
type: string | ||
description: The name of the key in the ConfigMap that contains the CA bundle data. | ||
default: ca-bundle.crt | ||
|
||
results: | ||
- description: Digest of the image just built | ||
|
@@ -144,6 +152,13 @@ spec: | |
echo "WARNING: provided deprecated BUILDER_IMAGE parameter has no effect." | ||
fi | ||
|
||
ca_bundle=/mnt/trusted-ca/ca-bundle.crt | ||
if [ -f "$ca_bundle" ]; then | ||
echo "INFO: Using mounted CA bundle: $ca_bundle" | ||
cp -vf $ca_bundle /etc/pki/ca-trust/source/anchors | ||
update-ca-trust | ||
fi | ||
|
||
SOURCE_CODE_DIR=source | ||
if [ -e "$SOURCE_CODE_DIR/$CONTEXT/$DOCKERFILE" ]; then | ||
dockerfile_path="$(pwd)/$SOURCE_CODE_DIR/$CONTEXT/$DOCKERFILE" | ||
|
@@ -284,6 +299,9 @@ spec: | |
name: varlibcontainers | ||
- mountPath: "/entitlement" | ||
name: etc-pki-entitlement | ||
- name: trusted-ca | ||
mountPath: /mnt/trusted-ca | ||
readOnly: true | ||
workingDir: $(workspaces.source.path) | ||
|
||
- name: sbom-syft-generate | ||
|
@@ -457,6 +475,13 @@ spec: | |
secret: | ||
secretName: $(params.ENTITLEMENT_SECRET) | ||
optional: true | ||
- name: trusted-ca | ||
configMap: | ||
name: $(params.caTrustConfigMapName) | ||
items: | ||
- key: $(params.caTrustConfigMapKey) | ||
path: ca-bundle.crt | ||
optional: true | ||
workspaces: | ||
- name: source | ||
description: Workspace containing the source code to build. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps we can symlink instead of copy to avoid creating another copy of the entire bundle in RAM.
For now we end up with 3 copies at least:
/etc/pki/ca-trust/source/anchors
update-ca-trust
Maybe we can even mount the config map directly into
/etc/pki/ca-trust/source/anchors
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe, but we now that this approach works and I don't think the memory overhead is too big.
I think we should proceed with this PR for unblocking @ashwindasr
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How hard is it to test using
ln -s
instead ofcp
?