leomeinel opened a new issue, #1514:
URL: https://github.com/apache/answer/issues/1514

   ## 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`
   
   ### CI/CD log
   
   
   ```
   
   ## To Reproduce
   
   Steps to reproduce the behavior:
   
   1. Specify `ARG ANSWER_MODULE=github.com/apache/[email protected]` 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/[email protected]]
   #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
   
   ```docker
   # 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/[email protected]
   
   # 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="[email protected]"
   
   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](https://go.dev/blog/v2-go-modules).
   
   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
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to