Skip to content

Commit 06a857e

Browse files
committed
Add DOMAIN_PROXY, BYTE_BUFFER_SIZE, PROXY_TARGET_WHITELIST params to buildah-oci-ta. Correct naming of domain proxy tmp directory.
1 parent 33bca19 commit 06a857e

File tree

4 files changed

+57
-9
lines changed

4 files changed

+57
-9
lines changed

deploy/tasks/buildah-oci-ta.yaml

Lines changed: 33 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,16 @@ spec:
135135
description: The buildah image to use.
136136
type: string
137137
default: quay.io/konflux-ci/buildah-task:latest@sha256:5cbd487022fb7ac476cbfdea25513b810f7e343ec48f89dc6a4e8c3c39fa37a2
138+
- name: DOMAIN_PROXY
139+
description: Determines if domain proxy will be used when hermetic mode is enabled.
140+
type: string
141+
default: "false"
142+
- name: BYTE_BUFFER_SIZE
143+
description: The byte buffer size to use for the domain proxy.
144+
type: string
145+
- name: PROXY_TARGET_WHITELIST
146+
description: Comma separated whitelist of target hosts for the domain proxy.
147+
type: string
138148
results:
139149
- name: IMAGE_DIGEST
140150
description: Digest of the image just built
@@ -354,6 +364,8 @@ spec:
354364
)
355365
356366
BUILDAH_ARGS=()
367+
use_domain_proxy=false
368+
DOMAIN_PROXY_ARGS=()
357369
358370
if [ "${HERMETIC}" == "true" ]; then
359371
BUILDAH_ARGS+=("--pull=never")
@@ -362,8 +374,19 @@ spec:
362374
unshare -Ufp --keep-caps -r --map-users 1,1,65536 --map-groups 1,1,65536 -- buildah pull $image
363375
done
364376
echo "Build will be executed with network isolation"
365-
/app/domain-proxy-server-runner &
366-
server_pid=$!
377+
if [ "${DOMAIN_PROXY}" == "true" ]; then
378+
use_domain_proxy=true
379+
if [ -n "${BYTE_BUFFER_SIZE}" ]; then
380+
DOMAIN_PROXY_ARGS+=("BYTE_BUFFER_SIZE=${BYTE_BUFFER_SIZE}")
381+
fi
382+
if [ -n "${PROXY_TARGET_WHITELIST}" ]; then
383+
DOMAIN_PROXY_ARGS+=("PROXY_TARGET_WHITELIST=${PROXY_TARGET_WHITELIST}")
384+
fi
385+
echo "Build will be executed with domain proxy"
386+
echo ${DOMAIN_PROXY_ARGS[@]} # TODO remove
387+
${DOMAIN_PROXY_ARGS[@]} /app/domain-proxy-server-runner &
388+
server_pid=$!
389+
fi
367390
fi
368391
369392
if [ -n "${TARGET_STAGE}" ]; then
@@ -460,12 +483,16 @@ spec:
460483
# Prevent ShellCheck from giving a warning because 'image' is defined and 'IMAGE' is not.
461484
declare IMAGE
462485
463-
if [ "${HERMETIC}" == "true" ]; then
464-
# Without expansion
465-
cat > /app/build-script.sh << 'EOF'
486+
if [ "$use_domain_proxy" == "true" ]; then
487+
# With expansion
488+
cat >> /app/build-script.sh << EOF
466489
#!/bin/sh
467490
ip link set lo up
468-
/app/domain-proxy-client-runner &
491+
${DOMAIN_PROXY_ARGS[@]} /app/domain-proxy-client-runner &
492+
EOF
493+
494+
# Without expansion
495+
cat > /app/build-script.sh << 'EOF'
469496
client_pid=$!
470497
EOF
471498
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
client-domain-socket=${DOMAIN_SOCKET:/tmp/domainserver}
1+
client-domain-socket=${DOMAIN_SOCKET:/tmp/domain-server}
22
client-http-port=8080
33
byte-buffer-size=${BYTE_BUFFER_SIZE:1024}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
server-domain-socket=${DOMAIN_SOCKET:/tmp/domainserver}
1+
server-domain-socket=${DOMAIN_SOCKET:/tmp/domain-server}
22
server-http-port=2000
33
byte-buffer-size=${BYTE_BUFFER_SIZE:1024}
44
proxy-target-whitelist=${PROXY_TARGET_WHITELIST:repo.maven.apache.org,repository.jboss.org,packages.confluent.io,jitpack.io,repo.gradle.org,plugins.gradle.org}

pkg/reconciler/dependencybuild/buildrecipeyaml.go

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -523,6 +523,13 @@ func createPipelineSpec(log logr.Logger, tool string, commitTime int64, jbsConfi
523523
},
524524
},
525525
},
526+
{
527+
Name: "HERMETIC",
528+
Value: tektonpipeline.ParamValue{
529+
Type: tektonpipeline.ParamTypeString,
530+
StringVal: "true",
531+
},
532+
},
526533
{
527534
Name: "BUILD_IMAGE",
528535
Value: tektonpipeline.ParamValue{
@@ -531,12 +538,26 @@ func createPipelineSpec(log logr.Logger, tool string, commitTime int64, jbsConfi
531538
},
532539
},
533540
{
534-
Name: "HERMETIC",
541+
Name: "DOMAIN_PROXY",
535542
Value: tektonpipeline.ParamValue{
536543
Type: tektonpipeline.ParamTypeString,
537544
StringVal: "true",
538545
},
539546
},
547+
{
548+
Name: "BYTE_BUFFER_SIZE", // TODO remove
549+
Value: tektonpipeline.ParamValue{
550+
Type: tektonpipeline.ParamTypeString,
551+
StringVal: "1024",
552+
},
553+
},
554+
{
555+
Name: "PROXY_TARGET_WHITELIST",
556+
Value: tektonpipeline.ParamValue{
557+
Type: tektonpipeline.ParamTypeString,
558+
StringVal: cacheUrl,
559+
},
560+
},
540561
},
541562
}}, ps.Tasks...)
542563

0 commit comments

Comments
 (0)