Jinho Yoo
Jinho Yoo

Reputation: 1530

Running unit test in bitbucket pipeline has error for dependency

I'm using Poetry 1.18.2. Currently, I'm working on a Python project called ProjectA and managing it through a private repository on Bitbucket. ProjectA uses two Python libraries, M0 and M1, which are both hosted on GitHub. M0 has a dependency on M1.

So, I cloned M0 and M1 from GitHub and pushed them to a private repository on Bitbucket. Then, I modified M0 to point to M1 in the Bitbucket private repository. Finally, I updated ProjectA to point to M0 in the Bitbucket private repository.

I successfully built the package for ProjectA locally using Poetry. However, an odd issue occurred during the Bitbucket pipeline. The installation of the project's dependencies and unit tests started well, but it failed to install M1 during installing M0.

Here's the pyproject.toml for ProjectA.

[tool.poetry.group.dev.dependencies]
python = ">=3.12,<3.13"
M0 = { git = "[email protected]:my_company_dev/M0.git" }

M0's pyproject.toml looks like this:

[tool.poetry.group.dependencies]
python = ">=3.12,<3.13"
M1 = { git = "[email protected]:my_company_dev/M1.git" }

This is the log from terminal in Bitbucket pipeline of ProjectA.

poetry config virtualenvs.in-project true
poetry install
Creating virtualenv ProjectA in /opt/atlassian/pipelines/agent/build/.venv
Installing dependencies from lock file
Package operations: 127 installs, 0 updates, 0 removals
  - Installing certifi (2024.12.14)
  - Installing charset-normalizer (3.4.1)
  - Installing idna (3.10)
  - Installing urllib3 (2.3.0)
  - Installing attrs (24.3.0)
 .........
  - Installing M1 (3.0.0)
  HangupException
  The remote server unexpectedly closed the connection.
  at /usr/local/lib/python3.12/site-packages/dulwich/protocol.py:215 in read_pkt_line
      211│ 
      212│         try:
      213│             sizestr = read(4)
      214│             if not sizestr:
    → 215│                 raise HangupException
      216│             size = int(sizestr, 16)
      217│             if size == 0 or size == 1:  # flush-pkt or delim-pkt
      218│                 if self.report_activity:
      219│                     self.report_activity(4, "read")
The following error occurred when trying to handle this error:
  HangupException
  [email protected]: Permission denied (publickey).
  at /usr/local/lib/python3.12/site-packages/dulwich/client.py:1154 in fetch_pack
      1150│         with proto:
      1151│             try:
      1152│                 refs, server_capabilities = read_pkt_refs(proto.read_pkt_seq())
      1153│             except HangupException as exc:
    → 1154│                 raise _remote_error_from_stderr(stderr) from exc
      1155│             (
      1156│                 negotiated_capabilities,
      1157│                 symrefs,
      1158│                 agent,
Cannot install M1.
  - Installing jiter (0.8.2)
  - Installing marko (2.1.2)
  - Installing nodeenv (1.9.1)
....

I suppose that need to configure SSH public key in Bitbucket pipeline. Is it correct?

Upvotes: -1

Views: 42

Answers (0)

Related Questions