Wednesday, January 23, 2019

Wercker Build panic: runtime error: index out of range

Symptom:

 When we run wercker build to build a new docker image. We hit below error:
panic: runtime error: index out of range
goroutine 1 [running]:
github.com/wercker/wercker/docker.(*DockerBuildStep).configure(0xc4202086e0, 0xc42029a510, 0xf15920, 0x120baa0)
        /go/src/github.com/wercker/wercker/docker/docker_build.go:117 +0x1563

export  POSTGRES_BUILD_ARGES="foo=a  bar=b"
wercker.yml is as:
box: python:2.7
build:
   steps:
      - internal/docker-build:
        dockerfile: Postgres-Dockerfile
        image-name: postgresimage
        build-args: $POSTGRES_BUILD_ARGES

Solution:

 For some reasons, when wercker invoke docker build, $POSTGRES_BUILD_ARGES is not recognized. After I replace it with a string ,it works (build-args: "foo=a  bar=b")

No comments: