Skip to content

[BUG] orchestrion pin on clean repo breaks in pruneImports with vendoring #687

@RomainMuller

Description

@RomainMuller

Version of orchestrion
1.5.0

Describe what happened:
A Dockerfile with these characteristics:

# ...

ARG CGO
ARG OS
ARG ARCH
RUN mkdir /go/src/project
WORKDIR /go/src/project
COPY . ./
RUN go install github.com/DataDog/orchestrion@latest
RUN orchestrion pin
RUN go env
RUN echo "CGO = "$CGO
RUN echo "OS = "$OS
RUN echo "ARCH = "$ARCH
RUN CGO_ENABLED=$CGO GOOS=$OS GOARCH=$ARCH govvv build -mod vendor -toolexec='orchestrion toolexec' -a -installsuffix cgo -ldflags '-extldflags "-static"' -o ./bin/project ./cmd/project/project.go
RUN cp ./bin/project /bin/
RUN CGO_ENABLED=$CGO GOOS=$OS GOARCH=$ARCH govvv build -mod vendor -toolexec='orchestrion toolexec' -a -installsuffix cgo -ldflags '-extldflags "-static"' -o ./bin/projectcli ./cmd/projectcli/projectcli.go
RUN cp ./bin/projectcli /bin/

Results in the following error:

ERROR [project builder 6/14] RUN orchestrion pin 0.3s
------
> [project builder 6/14] RUN orchestrion pin:
0.258 pruning imports from "/go/src/project/orchestrion.tool.go": pruneImports: err: exit status 1: stderr: go: inconsistent vendoring in /go/src/project:
0.258 github.com/DataDog/dd-trace-go/orchestrion/all/[email protected]: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt
0.258 github.com/DataDog/[email protected]: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt
[...]
0.258 To ignore the vendor directory, use -mod=readonly or -mod=mod.
0.258 To sync the vendor directory, run:
0.258 go mod vendor
0.258
------
failed to solve: process "/bin/sh -c orchestrion pin" did not complete successfully: exit code: 255
make: *** [Makefile: 14 :  build] Error 17

Describe what you expected:

Expected go mod vendor to be automatically run at the right time in the process so this error does not occur.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions