Steps to replicate the issue (include links if applicable):
- Start a Toolforge build (toolforge build start SOME_REPO)
- Wait for it to finish
- Get its ID from toolforge build list
- Try to delete it with toolforge build delete ITS_ID
What happens?:
…
requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: https://k8s.tools.eqiad1.wikimedia.cloud:6443/api/v1/namespaces/image-build/pods?labelSelector=tekton.dev%2FpipelineRun%3Dlucaswerkmeister-wmde-test-buildpacks-pipelinerun-cwp4j
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/bin/toolforge", line 8, in <module>
sys.exit(main())
File "/usr/lib/python3/dist-packages/toolforge_cli/cli.py", line 809, in main
toolforge()
File "/usr/lib/python3/dist-packages/click/core.py", line 764, in __call__
return self.main(*args, **kwargs)
File "/usr/lib/python3/dist-packages/click/core.py", line 717, in main
rv = self.invoke(ctx)
File "/usr/lib/python3/dist-packages/click/core.py", line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/lib/python3/dist-packages/click/core.py", line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/lib/python3/dist-packages/click/core.py", line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/lib/python3/dist-packages/click/core.py", line 555, in invoke
return callback(*args, **kwargs)
File "/usr/lib/python3/dist-packages/toolforge_cli/cli.py", line 440, in wrapper
return func(*args, **kwargs)
File "/usr/lib/python3/dist-packages/toolforge_cli/cli.py", line 738, in build_delete
k8s_client.delete_objects(kind="pods", selector=f"tekton.dev/pipelineRun={run['metadata']['name']}")
File "/usr/lib/python3/dist-packages/toolforge_cli/k8sclient.py", line 220, in delete_objects
version=K8sAPIClient.KIND_TO_VERSION[kind],
File "/usr/lib/python3/dist-packages/toolforge_cli/k8sclient.py", line 55, in _inner
raise K8sError(toolforge_build.ERROR_STRINGS["UNKNOWN_ERROR"]) from error
toolforge_cli.k8sclient.K8sError: An unknown error occured while trying to perform this operation.
If the problem persists, please contact us or open a bug:
see https://phabricator.wikimedia.org/T324822What should have happened instead?:
The build should have been deleted.
Software version (skip for WMF-hosted wikis like Wikipedia):
Toolforge CLI, version 0.3.0
Other information (browser name/version, screenshots, etc.):
I tried this in the lucaswerkmeister-wmde-test tool with the lucaswerkmeister-wmde-test-buildpacks-pipelinerun-cwp4j build. (It’s now gone, but I don’t know if that’s because the delete actually worked or if it was cleaned up automatically after a while – I got distracted right after getting the error.)