Skip to content

Commit

Permalink
custom CA bundle for build-task
Browse files Browse the repository at this point in the history
  • Loading branch information
ashwindasr authored and gbenhaim committed May 29, 2024
1 parent 6fa633c commit 650ee6e
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 0 deletions.
26 changes: 26 additions & 0 deletions task/buildah-remote/0.1/buildah-remote.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,15 @@ spec:
description: Path to a file with build arguments, see https://www.mankier.com/1/buildah-build#--build-arg-file
name: BUILD_ARGS_FILE
type: string
- default: trusted-ca
description: The name of the ConfigMap to read CA bundle data from.
name: caTrustConfigMapName
type: string
- default: ca-bundle.crt
description: The name of the key in the ConfigMap that contains the CA bundle
data.
name: caTrustConfigMapKey
type: string
- description: The platform to build on
name: PLATFORM
type: string
Expand Down Expand Up @@ -191,6 +200,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"
Expand Down Expand Up @@ -365,6 +381,9 @@ spec:
name: varlibcontainers
- mountPath: /entitlement
name: etc-pki-entitlement
- mountPath: /mnt/trusted-ca
name: trusted-ca
readOnly: true
- mountPath: /ssh
name: ssh
readOnly: true
Expand Down Expand Up @@ -537,6 +556,13 @@ spec:
secret:
optional: true
secretName: $(params.ENTITLEMENT_SECRET)
- configMap:
items:
- key: $(params.caTrustConfigMapKey)
path: ca-bundle.crt
name: $(params.caTrustConfigMapName)
optional: true
name: trusted-ca
- name: ssh
secret:
optional: false
Expand Down
25 changes: 25 additions & 0 deletions task/buildah/0.1/buildah.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
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
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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.

0 comments on commit 650ee6e

Please sign in to comment.