Skip to content

Docker build fails with: version "v2.0.0" invalid: should be v0 or v1, not v2 #1514

@leomeinel

Description

@leomeinel

Describe the bug

Custom build using ANSWER_MODULE failing with: replace github.com/apache/answer: version "v2.0.0" invalid: should be v0 or v1, not v2

To Reproduce

Steps to reproduce the behavior:

  1. Specify ARG ANSWER_MODULE=github.com/apache/answer@v2.0.0 and build apache answer
  2. See build fail with error

Expected behavior

A working build.

CI/CD log

#15 43.92 go: downloading github.com/apache/answer-plugins/reviewer-basic v1.0.8
#15 44.20 go: added github.com/apache/answer-plugins/reviewer-basic v1.0.8
#15 44.21 [go mod edit -replace github.com/apache/answer=github.com/apache/answer@v2.0.0]
#15 44.23 [go mod tidy]
#15 44.24 go: errors parsing go.mod:
#15 44.24 go.mod:73: replace github.com/apache/answer: version "v2.0.0" invalid: should be v0 or v1, not v2
#15 44.24 build failed exit status 1
#15 ERROR: process "/bin/bash -c /scripts/build.sh" did not complete successfully: exit code: 1

Dockerfile

# Initialize /usr/bin/answer
# INFO: Replace version
FROM docker.io/apache/answer:2.0.0 AS answer-builder
# INFO: Replace version
FROM code.forgejo.org/oci/golang:1.26-alpine3.23 AS golang-builder
COPY --from=answer-builder /usr/bin/answer /usr/bin/answer

# Set build time variables
# INFO: Replace version
ARG PNPM_VERSION=10.32.1
ARG ANSWER_MODULE=github.com/apache/answer@v2.0.0

# Install dependencies
RUN apk --no-cache add \
    build-base git bash nodejs npm go && \
    npm install -g pnpm@${PNPM_VERSION}

# Build /usr/bin/new_answer
COPY scripts/ /scripts
RUN chmod 755 /scripts/*.sh
RUN ["/bin/bash","-c","/scripts/build.sh"]

# Defaults from https://github.com/apache/answer/blob/main/Dockerfile
# INFO: Replace version
FROM code.forgejo.org/oci/alpine:latest
LABEL maintainer="linkinstar@apache.org"

ARG TIMEZONE
ENV TIMEZONE=${TIMEZONE:-"Asia/Shanghai"}

RUN apk update \
    && apk --no-cache add \
        bash \
        ca-certificates \
        curl \
        dumb-init \
        gettext \
        openssh \
        sqlite \
        gnupg \
        tzdata \
    && ln -sf /usr/share/zoneinfo/${TIMEZONE} /etc/localtime \
    && echo "${TIMEZONE}" > /etc/timezone

# Defaults from https://answer.apache.org/docs/plugins/#build-with-plugin-from-answer-base-image
COPY --from=golang-builder /usr/bin/new_answer /usr/bin/answer
COPY --from=answer-builder /data /data
COPY --from=answer-builder /entrypoint.sh /entrypoint.sh
RUN chmod 755 /entrypoint.sh

VOLUME /data
ENTRYPOINT ["/entrypoint.sh"]

Problem

As far as I understand, go requires a /v2 suffix after a major version bump. Also see this.

If you want met to submit a PR, please let me know, but I think this is better handled by maintainers. Also my understanding of go is limited so this problem description might not be 100% accurate.

Platform

  • Device: n.a
  • OS: n.a
  • Browser and version: n.a
  • Version: v2.0.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions