Skip to content

[BUG] nil pointer dereference when using local source build with 0.16 CLI #332

@avinal

Description

@avinal

Is there an existing issue for this?

  • I have searched the existing issues

Kubernetes Version

No response

Shipwright Version

v0.16

Current Behavior

➜  temp bash builds.sh
Flag --dockerfile has been deprecated, dockerfile parameter is deprecated
ERROR: builds.shipwright.io "sample-python-buildah-1-0" already exists
2025/07/15 17:35:15 Creating a BuildRun for 'builds/sample-python-buildah-1-0' Build...
2025/07/15 17:35:16 BuildRun 'sample-python-buildah-1-0-qhbfk' created!
Pod "sample-python-buildah-1-0-qhbfk-2vjfk-pod" is in state "Pending"...
Pod "sample-python-buildah-1-0-qhbfk-2vjfk-pod" is in state "Pending"...
Pod "sample-python-buildah-1-0-qhbfk-2vjfk-pod" is in state "Pending"...
Pod "sample-python-buildah-1-0-qhbfk-2vjfk-pod" in "Running" state, starting up log tail
Streaming "/home/avinal/Documents/redhat/github.com/temp/cust" to the Build POD "sample-python-buildah-1-0-qhbfk-2
Uploading local source... 100% [===============] (499 GB/s)
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0x1eaca25]

goroutine 1 [running]:
github.com/shipwright-io/cli/pkg/shp/streamer.(*Streamer).Stream(0x0, 0xc000ee7748, 0xc000da81a0, 0xa9200)
        github.com/shipwright-io/cli/pkg/shp/streamer/streamer.go:101 +0x545
github.com/shipwright-io/cli/pkg/shp/cmd/build.(*UploadCommand).performDataStreaming(0xc00017f180, 0xc000ee7748)
        github.com/shipwright-io/cli/pkg/shp/cmd/build/upload.go:223 +0x19e
github.com/shipwright-io/cli/pkg/shp/cmd/build.(*UploadCommand).onPodModifiedEventStreaming(0xc00017f180, 0xc0004a7b08?)
        github.com/shipwright-io/cli/pkg/shp/cmd/build/upload.go:251 +0x1b6
github.com/shipwright-io/cli/pkg/shp/reactor.(*PodWatcher).handleEvent(0xc0003f5380?, 0xc0004a7b08, {{0xc00087a8e8?, 0x0?}, {0x2a195b8?, 0xc0004a7b08?}})
        github.com/shipwright-io/cli/pkg/shp/reactor/pod_watcher.go:107 +0x148
github.com/shipwright-io/cli/pkg/shp/reactor.(*PodWatcher).WaitForCompletion(0xc0003f5380)
        github.com/shipwright-io/cli/pkg/shp/reactor/pod_watcher.go:162 +0x4a6
github.com/shipwright-io/cli/pkg/shp/reactor.(*PodWatcher).Start(0xc0003f5380, {{{0x0, 0x0}, {0x0, 0x0}}, {0xc000a965b0, 0x6e}, {0x0, 0x0}, 0x0, ...})
        github.com/shipwright-io/cli/pkg/shp/reactor/pod_watcher.go:213 +0x68
github.com/shipwright-io/cli/pkg/shp/cmd/build.(*UploadCommand).Run(0xc00017f180, 0xc00011f500, 0xc000423380)
        github.com/shipwright-io/cli/pkg/shp/cmd/build/upload.go:322 +0x445
github.com/shipwright-io/cli/pkg/shp/cmd/runner.(*Runner).RunE(0xc000420780, 0xc00077db40?, {0xc00011fbc0?, 0x0?, 0x0?})
        github.com/shipwright-io/cli/pkg/shp/cmd/runner/runner.go:35 +0x7f
github.com/spf13/cobra.(*Command).execute(0xc0001ba908, {0xc00011fb60, 0x6, 0x6})
        github.com/spf13/cobra@v1.9.1/command.go:1015 +0xa94
github.com/spf13/cobra.(*Command).ExecuteC(0x3ed1680)
        github.com/spf13/cobra@v1.9.1/command.go:1148 +0x40c
github.com/spf13/cobra.(*Command).Execute(0xc000423380?)
        github.com/spf13/cobra@v1.9.1/command.go:1071 +0x13
main.main()
        ./main.go:46 +0x125

Expected Behavior

There should be no nil pointer dereference or segmentation fault.

Steps To Reproduce

I am using local source build. Here are the Files

#!/bin/bash
BUILD_NAME="sample-python-buildah-1-0"
BUILD_NAMESPACE="test"
OUTPUT_IMAGE="ttl.sh/sample-python-builah:1h"
SOURCE_DIR="/home/avinal/Documents/redhat/github.com/temp/samples/buildpack"
SOURCE_PATH="platforms/paas/shared/artifacts/ms2ms/ms1"
# Create Build
shp build create $BUILD_NAME \
--namespace="$BUILD_NAMESPACE" \
--request-timeout="10m" \
--strategy-kind="ClusterBuildStrategy" \
--strategy-name="buildah" \
--dockerfile="Dockerfile" \
--output-image="$OUTPUT_IMAGE" \
--retention-failed-limit=5 \
--retention-succeeded-limit=10
# Upload Source
shp build upload ${BUILD_NAME} $SOURCE_DIR --follow \
--buildref-name="$BUILD_NAME" \
--namespace="$BUILD_NAMESPACE" \
--output-image="$OUTPUT_IMAGE" 
FROM python:3.11-slim
COPY requirements.txt server.py vendor/ /usr/src/app/
RUN pip install -r /usr/src/app/requirements.txt --no-index --find-links file:///usr/src/app/vendor
WORKDIR /usr/src/app
EXPOSE 8080
ENTRYPOINT ["python3", "server.py"]

Anything else?

This issue doesn't happen with 0.15 CLI.

Metadata

Metadata

Assignees

Labels

kind/bugCategorizes issue or PR as related to a bug.

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions