Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion task-generator/remote/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,10 @@ if ! [[ $IS_LOCALHOST ]]; then
ret += "\nbuildah push \"$IMAGE\" \"oci:konflux-final-image:$IMAGE\""
ret += "\nREMOTESSHEOF"
ret += "\nchmod +x " + script + "\n"
ret += "\nPODMAN_NVIDIA_ARGS=()"
ret += "\nif [[ \"$PLATFORM\" == \"linux-g\"* ]]; then"
ret += "\n PODMAN_NVIDIA_ARGS+=(\"--device=nvidia.com/gpu=all\" \"--security-opt=label=disable\")"
ret += "\nfi\n"

if task.Spec.StepTemplate != nil {
for _, e := range task.Spec.StepTemplate.Env {
Expand All @@ -240,7 +244,7 @@ if ! [[ $IS_LOCALHOST ]]; then
env += " -e " + e.Name + "=\"$" + e.Name + "\" \\\n"
}
podmanArgs += " -v \"$BUILD_DIR/scripts:/scripts:Z\" \\\n"
ret += "\n ssh $SSH_ARGS \"$SSH_HOST\" $PORT_FORWARD podman run " + env + "" + podmanArgs + " --user=0 --rm \"$BUILDER_IMAGE\" /" + containerScript + ` "$@"`
ret += "\n ssh $SSH_ARGS \"$SSH_HOST\" $PORT_FORWARD podman run " + env + "" + podmanArgs + " --user=0 \"${PODMAN_NVIDIA_ARGS[@]}\" --rm \"$BUILDER_IMAGE\" /" + containerScript + ` "$@"`

// Sync the contents of the workspaces back so subsequent tasks can use them
for _, workspace := range task.Spec.Workspaces {
Expand Down
7 changes: 6 additions & 1 deletion task/buildah-remote-oci-ta/0.1/buildah-remote-oci-ta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,11 @@ spec:
REMOTESSHEOF
chmod +x scripts/script-build.sh

PODMAN_NVIDIA_ARGS=()
if [[ "$PLATFORM" == "linux-g"* ]]; then

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.

I have tried in the past to not depend on the semantics of the PLATFORM parameter. @ifireball @mshaposhnik, what do you think?

The use of the PLATFORM parameter like this would fall in line with the functionality requested in https://issues.redhat.com/browse/KONFLUX-4073.

PODMAN_NVIDIA_ARGS+=("--device=nvidia.com/gpu=all" "--security-opt=label=disable")
fi

if ! [[ $IS_LOCALHOST ]]; then
rsync -ra scripts "$SSH_HOST:$BUILD_DIR"
ssh $SSH_ARGS "$SSH_HOST" $PORT_FORWARD podman run $PODMAN_PORT_FORWARD \
Expand Down Expand Up @@ -477,7 +482,7 @@ spec:
-v "$BUILD_DIR/.docker/:/root/.docker:Z" \
-v "$BUILD_DIR/results/:/tekton/results:Z" \
-v "$BUILD_DIR/scripts:/scripts:Z" \
--user=0 --rm "$BUILDER_IMAGE" /scripts/script-build.sh "$@"
--user=0 "${PODMAN_NVIDIA_ARGS[@]}" --rm "$BUILDER_IMAGE" /scripts/script-build.sh "$@"
rsync -ra "$SSH_HOST:$BUILD_DIR/volumes/shared/" /shared/
rsync -ra "$SSH_HOST:$BUILD_DIR/volumes/workdir/" /var/workdir/
rsync -ra "$SSH_HOST:$BUILD_DIR/results/" "/tekton/results/"
Expand Down
7 changes: 6 additions & 1 deletion task/buildah-remote-oci-ta/0.2/buildah-remote-oci-ta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,11 @@ spec:
REMOTESSHEOF
chmod +x scripts/script-build.sh

PODMAN_NVIDIA_ARGS=()
if [[ "$PLATFORM" == "linux-g"* ]]; then
PODMAN_NVIDIA_ARGS+=("--device=nvidia.com/gpu=all" "--security-opt=label=disable")
fi

if ! [[ $IS_LOCALHOST ]]; then
rsync -ra scripts "$SSH_HOST:$BUILD_DIR"
ssh $SSH_ARGS "$SSH_HOST" $PORT_FORWARD podman run $PODMAN_PORT_FORWARD \
Expand Down Expand Up @@ -608,7 +613,7 @@ spec:
-v "$BUILD_DIR/.docker/:/root/.docker:Z" \
-v "$BUILD_DIR/results/:/tekton/results:Z" \
-v "$BUILD_DIR/scripts:/scripts:Z" \
--user=0 --rm "$BUILDER_IMAGE" /scripts/script-build.sh "$@"
--user=0 "${PODMAN_NVIDIA_ARGS[@]}" --rm "$BUILDER_IMAGE" /scripts/script-build.sh "$@"
rsync -ra "$SSH_HOST:$BUILD_DIR/volumes/shared/" /shared/
rsync -ra "$SSH_HOST:$BUILD_DIR/volumes/workdir/" /var/workdir/
rsync -ra "$SSH_HOST:$BUILD_DIR/results/" "/tekton/results/"
Expand Down
7 changes: 6 additions & 1 deletion task/buildah-remote/0.1/buildah-remote.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,11 @@ spec:
REMOTESSHEOF
chmod +x scripts/script-build.sh

PODMAN_NVIDIA_ARGS=()
if [[ "$PLATFORM" == "linux-g"* ]]; then
PODMAN_NVIDIA_ARGS+=("--device=nvidia.com/gpu=all" "--security-opt=label=disable")
fi

if ! [[ $IS_LOCALHOST ]]; then
rsync -ra scripts "$SSH_HOST:$BUILD_DIR"
ssh $SSH_ARGS "$SSH_HOST" $PORT_FORWARD podman run $PODMAN_PORT_FORWARD \
Expand Down Expand Up @@ -470,7 +475,7 @@ spec:
-v "$BUILD_DIR/.docker/:/root/.docker:Z" \
-v "$BUILD_DIR/results/:/tekton/results:Z" \
-v "$BUILD_DIR/scripts:/scripts:Z" \
--user=0 --rm "$BUILDER_IMAGE" /scripts/script-build.sh "$@"
--user=0 "${PODMAN_NVIDIA_ARGS[@]}" --rm "$BUILDER_IMAGE" /scripts/script-build.sh "$@"
rsync -ra "$SSH_HOST:$BUILD_DIR/workspaces/source/" "$(workspaces.source.path)/"
rsync -ra "$SSH_HOST:$BUILD_DIR/volumes/shared/" /shared/
rsync -ra "$SSH_HOST:$BUILD_DIR/results/" "/tekton/results/"
Expand Down
7 changes: 6 additions & 1 deletion task/buildah-remote/0.2/buildah-remote.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,11 @@ spec:
REMOTESSHEOF
chmod +x scripts/script-build.sh

PODMAN_NVIDIA_ARGS=()
if [[ "$PLATFORM" == "linux-g"* ]]; then
PODMAN_NVIDIA_ARGS+=("--device=nvidia.com/gpu=all" "--security-opt=label=disable")
fi

if ! [[ $IS_LOCALHOST ]]; then
rsync -ra scripts "$SSH_HOST:$BUILD_DIR"
ssh $SSH_ARGS "$SSH_HOST" $PORT_FORWARD podman run $PODMAN_PORT_FORWARD \
Expand Down Expand Up @@ -586,7 +591,7 @@ spec:
-v "$BUILD_DIR/.docker/:/root/.docker:Z" \
-v "$BUILD_DIR/results/:/tekton/results:Z" \
-v "$BUILD_DIR/scripts:/scripts:Z" \
--user=0 --rm "$BUILDER_IMAGE" /scripts/script-build.sh "$@"
--user=0 "${PODMAN_NVIDIA_ARGS[@]}" --rm "$BUILDER_IMAGE" /scripts/script-build.sh "$@"
rsync -ra "$SSH_HOST:$BUILD_DIR/workspaces/source/" "$(workspaces.source.path)/"
rsync -ra "$SSH_HOST:$BUILD_DIR/volumes/shared/" /shared/
rsync -ra "$SSH_HOST:$BUILD_DIR/results/" "/tekton/results/"
Expand Down