Skip to content

Image builder fails when using a build config with an inline dockerfile containing a heredoc: "EOF: unterminated heredoc" #480

@lucastheisen

Description

@lucastheisen

I cannot find anything stating that this use case is not supported, and have found comments stating heredoc's have been supported by buildah for a couple years. So it seems like this should work:

---
apiVersion: image.openshift.io/v1
kind: ImageStream
metadata:
  labels:
    ad-hoc: build-inline-dockerfile-heredoc
  name: foo
---
apiVersion: build.openshift.io/v1
kind: BuildConfig
metadata:
  labels:
    ad-hoc: build-inline-dockerfile-heredoc
  name: foo
spec:
  output:
    to:
      kind: ImageStreamTag
      name: foo:latest
  resources:
    requests:
      cpu: .5
      memory: 10Mi
    limits:
      cpu: 1
      memory: 100Mi
  source:
    dockerfile: |
      FROM registry.access.redhat.com/ubi9/ubi:latest
      COPY <<EOF  /entrypoint.sh
      printf "hello world!" \
      EOF\
      ENTRYPOINT ["/entrypoint.sh"]
  strategy:
    type: Docker

But it results in this error:

ltheisen@PC ~/tmp/VSRPPROTO-893
$ oc --context epic --namespace pd-kube-ci apply --filename foo.yml
imagestream.image.openshift.io/foo unchanged
buildconfig.build.openshift.io/foo configured

ltheisen@PC ~/tmp/VSRPPROTO-893
$ oc --context epic --namespace pd-kube-ci start-build foo --follow
build.build.openshift.io/foo-2 started
Adding cluster TLS certificate authority to trust store
error: EOF: unterminated heredoc

Metadata

Metadata

Assignees

No one assigned

    Labels

    lifecycle/staleDenotes an issue or PR has remained open with no activity and has become stale.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions