Uploaded image for project: 'OpenShift Bugs'
  1. OpenShift Bugs
  2. OCPBUGS-62210

BuildConfig inline Dockerfile fails with heredoc syntax

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Undefined Undefined
    • None
    • 4.18.z, 4.19.z
    • Build
    • Quality / Stability / Reliability
    • False
    • Hide

      None

      Show
      None
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Description of problem:

      BuildConfig inline Dockerfile fails with heredoc syntax

      Version-Release number of selected component (if applicable):

      4.17, 4.18, 4.19

      How reproducible:

          Always

      Steps to Reproduce:

       1. Apply the following resources:
      ```
      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 --chmod=+x <<EOF /entrypoint.sh
            #!/bin/bash
            printf "hello world!"
            EOF
            ENTRYPOINT ["/entrypoint.sh"]   strategy:
          type: Docker
      ```
      
      2. Start the build:
      ```
      $ oc start-build foo --follow
      ```

      Actual results:

      Build fails with:
      error: EOF: unterminated heredoc

      Expected results:

      The heredoc (<<EOF … EOF) in the inline Dockerfile should be parsed and passed correctly into the build process, resulting in a valid /entrypoint.sh.

      Additional info:

          

              rh-ee-kmemane Kunal Memane
              rhn-support-disharma Diksha Sharma
              None
              None
              Moe Basim Moe Basim
              None
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated: