Page MenuHomePhabricator

`toolforge jobs load jobs.yaml` crashes
Closed, InvalidPublicBUG REPORT

Description

Steps to replicate the issue (include links if applicable):

What happens?:
The CLI crashes with the following error:

ERROR: An internal error occured while executing this command.
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/tjf_cli/cli.py", line 1113, in main
    run_subcommand(args=args, api=api)
  File "/usr/lib/python3/dist-packages/tjf_cli/cli.py", line 1049, in run_subcommand
    op_load(api, args.file, args.job)
  File "/usr/lib/python3/dist-packages/tjf_cli/cli.py", line 791, in op_load
    changes = calculate_changes(
              ^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/tjf_cli/loader.py", line 88, in calculate_changes
    LOGGER.warning(f"Unknown key '{key}' in job '{job['name']}' definition")
                                                  ~~~^^^^^^^^
TypeError: string indices must be integers, not 'str'

What should have happened instead?:

Probably not that :)

Event Timeline

taavi triaged this task as High priority.Jun 14 2024, 2:42 PM
taavi added subscribers: Slst2020, Raymond_Ndibe.

I rolled back today's jobs-api deployments. This includes:

8b4683d 4 days ago api: prefix endpoints with /tool/{toolname}/ [Slavina Stefanova] [Slavina Stefanova]
03ccd02 10 days ago openapi: refactor yaml [Slavina Stefanova] [Slavina Stefanova]
4ab0892 3 weeks ago [jobs-api] add messages to all responses [Ndibe Raymond Olisaemeka] [Slavina Stefanova]

@Slst2020 @Raymond_Ndibe could you please have a look which patch is the problematic one here and fix the issue?

Oh, no, nevermind, I too was testing with an invalid file. I'll file a separate bug for the validation issue.

@taavi thanks for the rollback. I'll take a look on Monday. The functional tests all passed, so probably we will need some additional ones to catch this.

Hmm, I have tested this in lima-kilo with jobs-api versions 0.0.307 and 0.0.308, and I am so far unable to reproduce this bug with either version.

slavina@lima-kilo:/home/slavina$ helm list -n jobs-api
NAME    	NAMESPACE	REVISION	UPDATED                               	STATUS  	CHART                     	APP VERSION
jobs-api	jobs-api 	4       	2024-06-17 08:40:39.80901208 +0000 UTC	deployed	jobs-api-0.0.308-dev-mr-92

slavina@lima-kilo:/home/slavina$ apt list --installed | grep toolforge-jobs-framework-cli

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

toolforge-jobs-framework-cli/bullseye-tools,bullseye-tools,now 16.0.10 all [installed]. # same version as in tools
local.tf-test@lima-kilo:~/qpqtool (d02b5418f43a5883f1a112a6fff387a5fa61c843)$ toolforge jobs load jobs.yaml
local.tf-test@lima-kilo:~/qpqtool (d02b5418f43a5883f1a112a6fff387a5fa61c843)$ toolforge jobs load jobs.yaml
local.tf-test@lima-kilo:~/qpqtool (d02b5418f43a5883f1a112a6fff387a5fa61c843)$

I should probably learn to read properly, y'all were testing with invalid yaml files and there's a reason this task was closed as invalid. (TIL there's no facepalm emoji in Phabricator) xd