Skip to content

tf_scope should be auto-detected from the token and deprecated #315

@thrix

Description

@thrix

Type of issue

Improvement

Description

The user can currently easily use a private RH token for Testing Farm and forget to set tf_scope to the corresponding value. It would be better if the scope could be detected from the Testing Farm whoami endpoint and set the artifacts_url accordingly. Second option is to parse it out from the request, it is under run.artifacts field, but it will appear only after the request is running - what can take in case of issues quite a long time (an hour or more).

Example of a the whoami endpoint reply:

❯ http -A bearer -a $TESTING_FARM_API_TOKEN https://api.testing-farm.io/v0.1/whoami
{
    "token": {
        "created": "2025-01-14T22:50:54.124564",
        "enabled": true,
        "id": "1fc3a92a-f32f-4f75-bed9-96c8163215f5",
        "name": "token",
        "ranch": "public",
        "role": "user",
        "updated": "2025-01-14T22:50:54.124573",
        "user_id": "e42ad3aa-1769-402d-be8b-9fab3d10cc2"
    },
    "user": {
        "auth_id": "somebody",
        "auth_method": "fedora",
        "auth_name": "somebody",
        "created": "2024-08-08T04:01:20.227364",
        "enabled": true,
        "id": "e41ad3ab-1569-402d-bf8b-86fab3d10cc3",
        "updated": "2024-08-08T04:01:20.227369"
    }
}

Note the token.ranch value indicating the tf_scope.

Reproducer

No response

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions