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

Plugin not working? #16

Open
fatmcgav opened this issue Jul 19, 2024 · 0 comments
Open

Plugin not working? #16

fatmcgav opened this issue Jul 19, 2024 · 0 comments

Comments

@fatmcgav
Copy link

Hey there

Firstly, thank you for taking the time to publish this plugin :)

So I'm trying to use this plugin to support publishing a package to CodeArtifact on AWS.
I've installed the plugin, however request to publish the package are still failing.

circleci@4723f16037bd:~/repo$ poetry --version
Poetry (version 1.3.1)
circleci@4723f16037bd:~/repo$ poetry publish --repository codeartifact-pypi -vvv
Loading configuration file /home/circleci/.config/pypoetry/config.toml
Adding repository codeartifact-pypi (https://<domain>.d.codeartifact.eu-west-2.amazonaws.com/pypi/python)
Loading the poetry-codeartifact-plugin plugin
Loading the poetry-git-version-plugin plugin
poetry-git-version-plugin: Init
poetry-git-version-plugin: Find git current tag... fail
poetry-git-version-plugin: Make alpha version... [git.cmd] Popen(['git', 'cat-file', '--batch-check'], cwd=/home/circleci/repo, stdin=<valid stream>, shell=False, universal_newlines=False)
[git.cmd] Popen(['git', 'rev-list', '381b634858ce6d6b70101c13ad4d48309e594762', '--'], cwd=/home/circleci/repo, stdin=None, shell=False, universal_newlines=False)
[git.cmd] Popen(['git', 'rev-list', '381b634858ce6d6b70101c13ad4d48309e594762', '--'], cwd=/home/circleci/repo, stdin=None, shell=False, universal_newlines=False)
[git.cmd] Popen(['git', 'rev-list', 'f1d1d34d28346b3442d5bdfc0a7ab67b5553dffa..381b634858ce6d6b70101c13ad4d48309e594762', '--'], cwd=/home/circleci/repo, stdin=None, shell=False, universal_newlines=False)
[git.cmd] Popen(['git', 'name-rev', '381b634858ce6d6b70101c13ad4d48309e594762'], cwd=/home/circleci/repo, stdin=None, shell=False, universal_newlines=False)
success, setting dynamic version to: 0.0.0a8+381b634
Invalid Public PEP 440 version: "0.0.0a8+381b634". https://peps.python.org/pep-0440/#appendix-b-parsing-version-strings-with-regular-expressions
poetry-git-version-plugin: Finished


[keyring.backend] Loading KWallet
[keyring.backend] Loading SecretService
[keyring.backend] Loading Windows
[keyring.backend] Loading chainer
[keyring.backend] Loading libsecret
[keyring.backend] Loading macOS
No suitable keyring backend found
No suitable keyring backends were found
Keyring is not available, credentials will be stored and retrieved from configuration files as plaintext.
Found authentication information for codeartifact-pypi.
Publishing molo-python-common (0.0.0a8+381b634) to codeartifact-pypi
 - Uploading molo_python_common-0.0.0a8+381b634-py3-none-any.whl 0%[urllib3.connectionpool] Starting new HTTPS connection (1): <domain>.d.codeartifact.eu-west-2.amazonaws.com:443
 - Uploading molo_python_common-0.0.0a8+381b634-py3-none-any.whl 100%[urllib3.connectionpool] https://<domain>.d.codeartifact.eu-west-2.amazonaws.com:443 "POST /pypi/python/ HTTP/1.1" 401 98
 - Uploading molo_python_common-0.0.0a8+381b634-py3-none-any.whl FAILED

  Stack trace:

  1  ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/poetry/publishing/uploader.py:288 in _upload_file
      286│                     bar.display()
      287│                 else:
    → 288│                     resp.raise_for_status()
      289│             except (requests.ConnectionError, requests.HTTPError) as e:
      290│                 if self._io.output.is_decorated():

  HTTPError

  401 Client Error: Unauthorized for url: https://<domain>.d.codeartifact.eu-west-2.amazonaws.com/pypi/python/

  at ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/requests/models.py:1024 in raise_for_status
      1020│                 f"{self.status_code} Server Error: {reason} for url: {self.url}"
      1021│             )
      1022│
      1023│         if http_error_msg:
    → 1024│             raise HTTPError(http_error_msg, response=self)
      1025│
      1026│     def close(self):
      1027│         """Releases the connection back to the pool. Once this method has been
      1028│         called the underlying ``raw`` object must not be accessed again.

The following error occurred when trying to handle this error:


  Stack trace:

  11  ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/cleo/application.py:327 in run
       325│
       326│             try:
     → 327│                 exit_code = self._run(io)
       328│             except BrokenPipeError:
       329│                 # If we are piped to another process, it may close early and send a

  10  ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/poetry/console/application.py:190 in _run
       188│         self._load_plugins(io)
       189│
     → 190│         exit_code: int = super()._run(io)
       191│         return exit_code
       192│

   9  ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/cleo/application.py:431 in _run
       429│             io.input.interactive(interactive)
       430│
     → 431│         exit_code = self._run_command(command, io)
       432│         self._running_command = None
       433│

   8  ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/cleo/application.py:473 in _run_command
       471│
       472│         if error is not None:
     → 473│             raise error
       474│
       475│         return terminate_event.exit_code

   7  ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/cleo/application.py:457 in _run_command
       455│
       456│             if command_event.command_should_run():
     → 457│                 exit_code = command.run(io)
       458│             else:
       459│                 exit_code = ConsoleCommandEvent.RETURN_CODE_DISABLED

   6  ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/cleo/commands/base_command.py:117 in run
       115│         io.input.validate()
       116│
     → 117│         return self.execute(io) or 0
       118│
       119│     def merge_application_definition(self, merge_args: bool = True) -> None:

   5  ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/cleo/commands/command.py:61 in execute
        59│
        60│         try:
     →  61│             return self.handle()
        62│         except KeyboardInterrupt:
        63│             return 1

   4  ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/poetry/console/commands/publish.py:82 in handle
        80│         )
        81│
     →  82│         publisher.publish(
        83│             self.option("repository"),
        84│             self.option("username"),

   3  ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/poetry/publishing/publisher.py:86 in publish
        84│         )
        85│
     →  86│         self._uploader.upload(
        87│             url,
        88│             cert=resolved_cert,

   2  ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/poetry/publishing/uploader.py:125 in upload
       123│
       124│         try:
     → 125│             self._upload(session, url, dry_run, skip_existing)
       126│         finally:
       127│             session.close()

   1  ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/poetry/publishing/uploader.py:214 in _upload
       212│     ) -> None:
       213│         for file in self.files:
     → 214│             self._upload_file(session, url, file, dry_run, skip_existing)
       215│
       216│     def _upload_file(

  UploadError

  HTTP Error 401: Unauthorized | b'Unauthenticated: request did not include an Authorization header. Please provide your credentials.'

  at ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/poetry/publishing/uploader.py:294 in _upload_file
      290│                 if self._io.output.is_decorated():
      291│                     self._io.overwrite(
      292│                         f" - Uploading {file.name} FAILED"
      293│                     )
    → 294│                 raise UploadError(e)
      295│             finally:
      296│                 self._io.write_line("")
      297│
      298│     def _register(self, session: requests.Session, url: str) -> requests.Response:

My pyproject.toml looks like this:

[[tool.poetry.source]]
name = "codeartifact-pypi"
url = "https://***redacted-domain***.d.codeartifact.eu-west-2.amazonaws.com/pypi/python/"
secondary = true

Any ideas on what's going on? Or any further info I can provide to assist?

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant