Failed to push built-in registry (401 Unauthorized) (OD-2273)
Vasiliy Kulikov opened 11 months ago

Purpose

Build and push a docker image of the project to the built-in docker registry

Problem

On the push stage of the build process, i get error:

#16 ERROR: failed to push ***/website/admin/admin:1.0.0: failed to authorize: failed to fetch oauth token: unexpected status from GET request to ***/v2/token?scope=%2A%3A%3A&scope=repository%3Awebsite%2Fadmin%2Fadmin%3Apull%2Cpush&service=onedev: 401 Unauthorized

Settings

  • Package Management for the project is true
  • Job Secrets access-token created
  • Configuring the build process follows the instructions in the OneDev documentation

изображение_2.png

Logs



22:04:21 No job executor defined, auto-discovering...
22:04:21 Discovered job executor type: Server Docker Executor
22:04:21 Pending resource allocation...
22:04:21 Executing job (executor: auto-discovered, server: ***, network: auto-discovered-16-121-3)...
22:04:21 Copying job dependencies...
22:04:21 Running step "Checkout Code"...
22:04:21 Checking out code...
22:04:22 Switched to branch 'main'
22:04:22 branch 'main' set up to track 'origin/main'.
22:04:22 Step "Checkout Code" is successful (0 seconds)
22:04:22 Running step "Set Environment"...
22:04:24 latest: Pulling from library/alpine
22:04:24 Status: Image is up to date for alpine:latest
22:04:25 Step "Set Environment" is successful (2 seconds)
22:04:25 Running step "Build Image"...
22:04:25 #0 building with "onedev" instance using docker-container driver
22:04:25 
22:04:25 #1 [internal] load build definition from Dockerfile
22:04:25 #1 transferring dockerfile: 584B 0.0s done
22:04:25 #1 DONE 0.0s
22:04:25 
22:04:25 #2 [internal] load metadata for docker.io/library/node:slim
22:04:26 #2 DONE 1.1s
22:04:26 
22:04:26 #3 [internal] load .dockerignore
22:04:26 #3 transferring context: 204B done
22:04:26 #3 DONE 0.0s
22:04:26 
22:04:26 #4 [prod_depends 1/4] FROM docker.io/library/node:slim@sha256:a5163af143b43b0da7572444bd49a22edb4cc1a74d3a46e1ef840f62bce07cac
22:04:26 #4 resolve docker.io/library/node:slim@sha256:a5163af143b43b0da7572444bd49a22edb4cc1a74d3a46e1ef840f62bce07cac 0.0s done
22:04:26 #4 DONE 0.0s
22:04:26 
22:04:26 #5 [internal] load build context
22:04:27 #5 transferring context: 2.85MB 0.1s done
22:04:27 #5 DONE 0.1s
22:04:27 
22:04:27 #6 [builder 5/5] RUN --mount=type=secret,id=secrets     export $(grep -v '^#' /run/secrets/secrets | xargs) &&     npm run build
22:04:27 #6 CACHED
22:04:27 
22:04:27 #7 [prod_depends 3/4] COPY --from=builder /app/package.json /app/package-lock.json ./
22:04:27 #7 CACHED
22:04:27 
22:04:27 #8 [builder 3/5] COPY . .
22:04:27 #8 CACHED
22:04:27 
22:04:27 #9 [prod_depends 4/4] RUN npm ci --omit=dev
22:04:27 #9 CACHED
22:04:27 
22:04:27 #10 [stage-2 4/5] COPY --from=prod_depends --chown=node:node /app/node_modules ./node_modules
22:04:27 #10 CACHED
22:04:27 
22:04:27 #11 [builder 4/5] RUN npm install
22:04:27 #11 CACHED
22:04:27 
22:04:27 #12 [stage-2 3/5] COPY --from=builder --chown=node:node /app/build ./build
22:04:27 #12 CACHED
22:04:27 
22:04:27 #13 [prod_depends 2/4] WORKDIR /app
22:04:27 #13 CACHED
22:04:27 
22:04:27 #14 [stage-2 2/5] WORKDIR /app
22:04:27 #14 CACHED
22:04:27 
22:04:27 #15 [stage-2 5/5] COPY package.json ./
22:04:27 #15 CACHED
22:04:27 
22:04:27 #16 exporting to image
22:04:27 #16 exporting layers done
22:04:27 #16 exporting manifest sha256:8ece63d14bf81ffffb487e430704068ac272c2256d69dab4248bd9f9dd4df3b4 done
22:04:27 #16 exporting config sha256:d8327502a85807a0d290618de81ca9de58eac8459c0338af2488099268328970 done
22:04:27 #16 exporting attestation manifest sha256:e513e4bab8fc198c833fd6abb7ccd5a6c268b47d699ed1f7aa40cf81b42196a5 0.0s done
22:04:27 #16 exporting manifest list sha256:aeb70cb02903e0e7c7f90ae7baecc74dd4f879c65fbca6673ef5bcf694086ac2 done
22:04:27 #16 pushing layers
22:04:27 #16 pushing layers 0.5s done
22:04:27 #16 ERROR: failed to push ***/website/admin/admin:1.0.0: failed to authorize: failed to fetch oauth token: unexpected status from GET request to ***/v2/token?scope=%2A%3A%3A&scope=repository%3Awebsite%2Fadmin%2Fadmin%3Apull%2Cpush&service=onedev: 401 Unauthorized
22:04:27 
22:04:27 #17 [auth] *:: website/admin/admin:pull,push token for ***
22:04:27 #17 DONE 0.0s
22:04:27 
22:04:27 #18 [auth] *:: website/admin/admin:pull,push token for ***
22:04:27 #18 DONE 0.0s
22:04:27 ------
22:04:27  > exporting to image:
22:04:27 ------
22:04:27 ERROR: failed to solve: failed to push ***/website/admin/admin:1.0.0: failed to authorize: failed to fetch oauth token: unexpected status from GET request to ***/v2/token?scope=%2A%3A%3A&scope=repository%3Awebsite%2Fadmin%2Fadmin%3Apull%2Cpush&service=onedev: 401 Unauthorized
22:04:27 Command execution failed (command: docker buildx build --builder onedev --pull --secret id=secrets,src=./secrets . --push -t ***/website/admin/admin:1.0.0, exit code: 1)
22:04:29 Job finished
  • Robin Shen commented 11 months ago

    Does the access token have package write permission over project website/admin (or any of its parent projects)?

  • Vasiliy Kulikov commented 11 months ago

    The problem was on my side. The access-token was expired, but i didnt see that. Thank you, for your help.

  • Vasiliy Kulikov changed state to 'Closed' 11 months ago
    Previous Value Current Value
    Open
    Closed
  • Vasiliy Kulikov removed comment 11 months ago
issue 1/1
Type
Question
Priority
Normal
Assignee
Labels
No labels
Issue Votes (0)
Watchers (2)
Reference
OD-2273
Please wait...
Connection lost or session expired, reload to recover
Page is in error, reload to recover