You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@devlake.apache.org by "oguzgu (via GitHub)" <gi...@apache.org> on 2025/10/31 05:28:18 UTC

[I] [Bug][gitextractor] Bitbucket connection fails on Git clone [incubator-devlake]

oguzgu opened a new issue, #8627:
URL: https://github.com/apache/incubator-devlake/issues/8627

   ### Search before asking
   
   - [x] I had searched in the [issues](https://github.com/apache/incubator-devlake/issues?q=is%3Aissue) and found no similar issues.
   
   
   ### What happened
   
   ### Issue Description
   Bitbucket connection authentication works inconsistently between API calls and Git clone operations.
   
   ### Steps to Reproduce
   1. Create Bitbucket connection using email address + API token with proper scopes (as required by the UI)
   2. Add a Bitbucket repository to a blueprint
   3. Run the blueprint
   
   ### Actual Behavior
   - **First run**: Clone fails because DevLake uses **email address** for Git clone, but Bitbucket requires **username**
   - **Workaround attempt**: Update `_devlake_blueprints` table to set mode='ADVANCED', then edit blueprint JSON to replace email with username in the git URL
   - **Result**: Clone succeeds once, then fails on subsequent syncs (reverts back to email)
   
   ### Alternative Approach Tried: SSH
   Configured `privateKey` in advanced blueprint mode with SSH URL format.
   - **First run**: Works
   - **Subsequent runs**: Fails with error: `Identity file /tmp/gitext-pk* not accessible: No such file or directory`
   
   The temporary SSH key file gets created but then becomes inaccessible, causing permission denied errors.
   
   ### Environment
   - DevLake version: v1.0.3-beta7
   - Connection type: Bitbucket Cloud
   - Authentication: API token with proper scopes
   
   ### Expected Fix
   DevLake should either:
   1. Allow specifying both email (for API) and username (for Git) in Bitbucket connection settings, OR
   2. Automatically resolve username from email via Bitbucket API, OR
   3. Fix SSH privateKey handling to persist properly across multiple runs
   
   ### What do you expect to happen
   
   Connection should work for both API calls and Git clone operations using the same credentials.
   
   ### How to reproduce
   
   ### Steps to Reproduce
   1. Create Bitbucket connection using email address + API token with proper scopes (as required by the UI)
   2. Add a Bitbucket repository to a blueprint
   3. Run the blueprint
   
   ### Anything else
   
   _No response_
   
   ### Version
   
    v1.0.3-beta7
   
   ### Are you willing to submit PR?
   
   - [ ] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [x] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
   


-- 
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: dev-unsubscribe@devlake.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Bug][gitextractor] Bitbucket connection fails on Git clone [incubator-devlake]

Posted by "dosubot[bot] (via GitHub)" <gi...@apache.org>.
dosubot[bot] commented on issue #8627:
URL: https://github.com/apache/incubator-devlake/issues/8627#issuecomment-3471407367

   <!-- Greeting -->
   Hi @oguzgu! I'm [Dosu](https://go.dosu.dev/dosubot) and I’m helping the incubator-devlake team.
   
   <!-- Answer -->
   You're running into two distinct issues with Bitbucket Cloud connections in DevLake:
   
   1. **Email vs. Username for Git Clone**: DevLake currently uses a single credential field for both API and Git clone operations. Bitbucket Cloud requires your Atlassian account email for API calls, but your Bitbucket username for Git clone. The code does not distinguish between these or automatically resolve the username from the email, so after manual edits, it reverts to using the email, causing clone failures. This is a known limitation in the credential handling logic ([source](https://github.com/apache/incubator-devlake/blob/2c15ad880dce830c6512fa58039527cbf4745b8b/backend/plugins/bitbucket/models/connection.go), [source](https://github.com/apache/incubator-devlake/pull/8604)).
   
   2. **SSH Key Persistence**: For SSH authentication, DevLake creates a temporary private key file for each run and deletes it immediately after use. This means the key file is not available for subsequent syncs, leading to "Identity file ... not accessible" errors ([source](https://github.com/apache/incubator-devlake/blob/2c15ad880dce830c6512fa58039527cbf4745b8b/backend/plugins/gitextractor/parser/clone_gitcli.go), [discussion](https://github.com/apache/incubator-devlake/discussions/8412)).
   
   **Current workarounds**:  
   - For HTTPS, you must manually edit the blueprint to use your Bitbucket username in the Git URL, but DevLake will overwrite this on the next run.
   - For SSH, you need to ensure the private key is injected for every run, as DevLake does not persist it.
   
   **Recent changes**:  
   A recent PR added support for Bitbucket API tokens and clarified the credential requirements, but did not address the dual credential issue or SSH key persistence ([source](https://github.com/apache/incubator-devlake/pull/8604)).
   
   **What’s needed for a robust fix**:  
   DevLake would need to support specifying both email (for API) and username (for Git) in the Bitbucket connection settings, or automatically resolve the username from the email via the Bitbucket API. For SSH, the private key handling logic would need to persist the key file across runs or reliably recreate it each time.
   
   Let me know if you want more details on the code paths or configuration options!
   
   
   <!-- Dosu Comment Footer -->
   *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).*
   
   ---
   <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/4f0d4b34-61e1-407c-b62d-887631a3a21b?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/4f0d4b34-61e1-407c-b62d-887631a3a21b?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/4f0d4b34-61e1-407c-b62d-887631a3a21b?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/4f0d4b34-61e1-407c-b62d-887631a3a21b?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/4f0d4b34-61e1-407c-b62d-887631a3a21b?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/4f0d4b34-61e1-407c-b62d-887631a3a21b?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/4f0d4b34-61e1-407c-b62d-887631a3a21b?feedback_type=other)</sup>&nbsp;&nbsp;[![Chat with Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/b4e8e847-d479-4541-83a8-d88d83fea5c9/ask?utm_source=githu
 b)&nbsp;[![Join Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share on X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/apache/incubator-devlake/issues/8627)


-- 
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: dev-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Bug][gitextractor] Bitbucket connection fails on Git clone [incubator-devlake]

Posted by "oguzgu (via GitHub)" <gi...@apache.org>.
oguzgu closed issue #8627: [Bug][gitextractor] Bitbucket connection fails on Git clone
URL: https://github.com/apache/incubator-devlake/issues/8627


-- 
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: dev-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org