Drone 0.8.1 - Can't pull from a Bitbucket private repository

Hello,

I’ve read this topic, Cannot clone private gitea repo (could not read Username for…) 0.8.0-rc.3, gitea 1.2.0-rc2. And I’m still facing the issue at the clone step:

fatal: could not read Username for 'https://bitbucket.org': No such device or address
exit status 128

I wanted to debug it but I don’t understand how I can debug the plugins/git with the Bitbucket credentials.

I tried with my own personal credentials and it worked:

$ docker run --rm \
   -e DRONE_REMOTE_URL='https://me:[email protected]/ORG/PROJECT.git' \
   -e DRONE_WORKSPACE=/go/src/bitbucket.org/ORG/PROJECT \
   -e DRONE_BUILD_EVENT=push \
   -e DRONE_COMMIT_SHA=<COMMIT_ID> \
   -e DRONE_COMMIT_REF=refs/heads/<BRANCH> \
   -e DRONE_DEBUG=true \
   -e DRONE_DEBUG_PRETTY=true \
   plugins/git
+ git init
Initialized empty Git repository in /go/src/bitbucket.org/ORG/PROJECT/.git/
+ git remote add origin https://me:[email protected]/ORG/PROJECT.git
+ git fetch --no-tags origin +refs/heads/<BRANCH>:
From https://bitbucket.org/ORG/PROJECT
 * branch                <BRANCH> -> FETCH_HEAD
 * [new branch]          <BRANCH> -> origin/<BRANCH>
+ git reset --hard -q <COMMIT_ID>
+ git submodule update --init --recursive

But how can I test the plugins/git with the Bitbucket environment variables (DRONE_BITBUCKET, DRONE_BITBUCKET_CLIENT and DRONE_BITBUCKET_SECRET) ?

I’m using docker-compose to run the server and the agent on the same server. This is the yaml configuration:

version: '2'

services:
  drone-server:
    image: drone/drone:0.8.1
    ports:
      - 8000:8000
      - 9000:9000
    volumes:
      - /var/lib/drone:/var/lib/drone
    restart: always
    environment:
      - DRONE_OPEN=true
      - DRONE_HOST=https://my.domain.com
      - DRONE_BITBUCKET=true
      - DRONE_BITBUCKET_CLIENT=<CLIENT_ID>
      - DRONE_BITBUCKET_SECRET=<CLIENT_SECRET>
      - DRONE_SECRET=<DRONE_SECRET>
      - DRONE_ADMIN=me,you
      - DRONE_DEBUG=true
      - DRONE_DEBUG_PRETTY=true

  drone-agent:
    image: drone/agent:0.8.1
    restart: always
    depends_on: [ drone-server ]
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    environment:
      - DRONE_HOST=https://my.domain.com
      - DRONE_SERVER=drone-server:9000
      - DRONE_SECRET=<DRONE_SECRET>
      - DRONE_DEBUG=true
      - DRONE_DEBUG_PRETTY=true

Could you help me on this, please?

Thanks,
Rasmey

when i tried to clone my private gitea repository i got the same exact exit status
i solved the issue using :
- DRONE_GOGS_GIT_USERNAME=${GITEA_USERNAME}
- DRONE_GOGS_GIT_PASSWORD=${GITEA_PASSWORD}

i know its a serious security risk. .but i havent found any other solution so far. .

@Fendi_D I do not think the gitea and bitbucket issues described here are related. Gitea introduced a code change that broke git+http authentication using netrc files. You can see the relevant Gitea issue here https://github.com/go-gitea/gitea/issues/2480

One of the gitea maintainers then submitted a patch to drone, which we merged. See https://github.com/drone/drone/pull/2241.

These changes are available in the latest docker image.

oh. .right. .sorry @bradrydzewski … i didnt know that. . i just have my attention on the error log and exit status … because i got the same exact error logs and i assume its the same thing. .haha . .silly me. .btw, ,thanks a lot for pointing out my mistake. .

Hello,

Sorry for the late response and thank you for your responses.

I fixed my problem. I need to remove the repo and re-added again. And everything works well.

BTW, @bradrydzewski, please put all the documentation in one place. It was really confusing to me.

Thank you,
Rasmey

Hey @bradrydzewski is this fixed yet? I linked bitbucket successfully but the repo list show its empty. None of my repositories are fetched.

What needs fixing? I am not aware of anything being broken with Bitbucket. The Bitbucket implementation has been in place for 3+ years and is being used by a number of teams. Also I believe this particular thread is about an error cloning a repository (likely related to a DNS issue on the host machine), not about the repository list being empty …

But if you think there might be an issue, you can see the Bitbucket code here. If you have any suggested improvements or patches please consider sending a pull request.