Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

with drone in a docker compose, on restart, after first drone login, I need to delete gogs Personal Access Tokens in order to login again #7172

Open
1 task done
magowiz opened this issue Oct 6, 2022 · 15 comments
Labels
💊 bug Something isn't working

Comments

@magowiz
Copy link

magowiz commented Oct 6, 2022

Gogs version

0.13.0+dev

Git version

  • Server: 2.32.3
  • Client: 2.34.1

Operating system

Ubuntu 22.04

Database

SQLite 3

Describe the bug

I can, from drone, register to gogs, a Personal Account Token is created, I'm able to run pipelines and so on, after I restart the infrastructure, if from drone I try to login I get "Unauthorized", in order to login again I have to delete Personal Access Token from gogs and perform a new registration.

mine docker-compose.yml:

version: "3"
services:
  gogs:
    container_name: 'gogs'
    image: gogs/gogs
    ports:
      - "3000:3000"
      - "8022:22"
      - '8443:443'
    volumes:
      - ./gogs:/data
    networks:
      - cicd

  drone-server:
    container_name: 'drone-server'
    image: drone/drone
    ports:
      - "8080:80"
      - "8843:443"
    volumes:
      - ./drone:/var/lib/drone/
    depends_on:
      - gogs
    environment:
      - DRONE_GOGS_SERVER=http://gogs:3000
      - DRONE_RPC_SECRET=XXXXXXX
      - DRONE_SERVER_HOST=drone-server
      - DRONE_SERVER_PROTO=http
      - DRONE_GOGS_URL=http://gogs:3000
      - DRONE_GOGS=true
        #- DRONE_LOGS_DEBUG=true
    networks:
      - cicd

  drone-agent:
    container_name: 'drone-agent'
    image: drone/drone-runner-docker:1
    command: agent
    depends_on: [drone-server]
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    environment:
      - DRONE_RPC_HOST=drone-server
      - DRONE_RPC_PROTO=http
      - DRONE_RPC_SECRET=XXXXXXX
      - DRONE_RUNNER_NAME=facchino
      - DRONE_GOGS_URL=http://gogs:3000/
      - DRONE_DOCKER_NETWORK_ID=cicd
      - DRONE_RUNNER_NETWORKS=cicd
    networks:
      - cicd


networks:
  cicd:
    name: cicd

To reproduce

  1. launch above docker compose with docker compose up
  2. configure gogs, setup a repository
  3. login via drone.io into gogs
  4. do things like commit and push, to trigger drone
  5. it works
  6. stop the compose
  7. start the compose
  8. go with browser into drone page and try to login ("Unauthorized")

Expected behavior

on second run (restart) I should be able to login inside gogs via drone

Additional context

gogs.log

Code of Conduct

  • I agree to follow this project's Code of Conduct
@magowiz magowiz added the 💊 bug Something isn't working label Oct 6, 2022
@vaecebyZ
Copy link

I'm also getting this error and it hasn't been fixed until now. XD

@robert-m-johnson
Copy link

I'm also getting the same issue.

  • OS: Pop OS 22.04
  • Database: SQLite3

docker-compose.yaml:

version: '3'

services:
  gogs:
    image: gogs/gogs:0.13.0
    volumes:
      - ./gogs:/data
    ports:
      - "3002:3000"

  drone-server:
    image: drone/drone:2.16.0
    ports:
      - "8000:80"
    restart: always
    environment:
      - DRONE_AGENTS_ENABLED=true
      - DRONE_GOGS_SERVER=http://gogs:3000
      - DRONE_RPC_SECRET=mysecret
      - DRONE_SERVER_HOST=drone-server
      - DRONE_SERVER_PROTO=http
      - DRONE_GOGS_SKIP_VERIFY=false

  drone-runner:
    image: drone/drone-runner-docker:1.8.3
    restart: always
    depends_on:
      - drone-server
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    environment:
      - DRONE_RPC_PROTO=http
      - DRONE_RPC_HOST=drone-server
      - DRONE_RPC_SECRET=mysecret
      - DRONE_RUNNER_CAPACITY=1
      - DRONE_RUNNER_NAME=my-first-runner

@JerryLiao26
Copy link

Same on a Debian 10 server, can anyone take a look into this?

@JerryLiao26
Copy link

When I directly give the token value to Sha1, the problem solved, but I don't know exactly why😂

accessToken := &AccessToken{
UserID: userID,
Name: name,
Sha1: sha256[:40], // To pass the column unique constraint, keep the length of SHA1.
SHA256: sha256,
}
if err = db.WithContext(ctx).Create(accessToken).Error; err != nil {
return nil, err
}
// Set back the raw access token value, for the sake of the caller.
accessToken.Sha1 = token
return accessToken, nil

@xtqxk
Copy link

xtqxk commented May 11, 2023

I'm also getting the same issue too.

@pav5000
Copy link

pav5000 commented Jun 18, 2023

Same issue here. Does anyone has a clue for a temporary dirty fix?

@QZAiXH
Copy link

QZAiXH commented Jun 30, 2023

@unknwon I see that this bug is discussed on the drone forum. Is oAuth supported in gogs to solve this problem? https://discuss.harness.io/t/drone-io-issues-in-docker-compose-with-token-in-bundle-with-gogs/12648/3

@wcccWT
Copy link

wcccWT commented Sep 5, 2023

I'm also getting the same issue

@jerrita
Copy link

jerrita commented Dec 17, 2023

same issue, any update?

@littlerokie
Copy link

the same , how to deal with

@ResourceHog
Copy link

Just want to poke my head in and say I'm experiencing this also. I guess I should start trying to find this token. Wherever it is.

@FatNik329
Copy link

Write me down as one of those who have faced this problem.

@tobias-graf-p
Copy link

tobias-graf-p commented Aug 31, 2024

Same issue here, I guess Gogs should support OAuth in order to seamlessly integrate with Drone. See "step 5" at https://docs.drone.io/server/provider/gogs/

See also #4602

@drakeshin
Copy link

I deleted all my aplication's token and drone worked again

@tobias-graf-p
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💊 bug Something isn't working
Projects
None yet
Development

No branches or pull requests