Uploaded image for project: 'RHEL'
  1. RHEL
  2. RHEL-36097

go-toolset-container: Builds fail if `.git` directory is present

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Undefined Undefined
    • None
    • rhel-9.4
    • golang
    • None
    • None
    • Low
    • 2
    • rhel-sst-pt-llvm-rust-go
    • ssg_platform_tools
    • 0
    • Dev ack
    • False
    • Hide

      None

      Show
      None
    • None
    • SST LLVM/Rust/Go Sprint 12, SST LLVM/Rust/Go Sprint 13
    • None
    • None
    • None

      What were you trying to do that didn't work?

      When building a go application within the go-toolset-container, the build fails if the go source code has the `.git` directory present.

      Please provide the package NVR for which bug is seen:

      go-toolset-1.20.12-4.el9_3.x86_64

      How reproducible:

      Always if `.git` repository is present

      Steps to reproduce

      1. Clone an example git repository - `git clone https://github.com/sclorg/golang-ex`
      2.  Create a Containerfile to build the application using the entire source tree:
        FROM registry.redhat.io/ubi9/go-toolset:1.20.12 AS builder
        COPY . .
        RUN go build -o /tmp/hello
        
        FROM registry.redhat.io/ubi9/ubi-minimal:9.4
        WORKDIR /app
        COPY --from=builder /tmp/hello .
        CMD ["./hello"]
        
      3.  Build the container using Podman build:
        podman build -t localhost/sclorg/hello-openshift:latest .
        

      Expected results

      Build succeeds

      Actual results

      Build fails with the following:

      [1/2] STEP 1/3: FROM registry.redhat.io/ubi9/go-toolset:1.20.12 AS builder
      [1/2] STEP 2/3: COPY . .
      --> 76206d3c3e1d
      [1/2] STEP 3/3: RUN go build -o /tmp/hello
      error obtaining VCS status: exit status 128
              Use -buildvcs=false to disable VCS stamping.
      Error: building at STEP "RUN go build -o /tmp/hello": while running runtime: exit status 1
      

      Additional Notes

      With the VCS Stamping feature, go developers may explicitly want `-buildvcs=auto` to work in all circumstances, so that git version information is automatically present in binary.

              dbenoit@redhat.com David Benoit
              adkaplan@redhat.com Adam Kaplan
              David Benoit David Benoit
              qe-baseos-tools-bugs@redhat.com qe-baseos-tools-bugs@redhat.com qe-baseos-tools-bugs@redhat.com qe-baseos-tools-bugs@redhat.com
              Votes:
              0 Vote for this issue
              Watchers:
              11 Start watching this issue

                Created:
                Updated: