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

Add authentication to CLI when submitting jobs with priority #360

Conversation

val500
Copy link
Contributor

@val500 val500 commented Sep 12, 2024

Description

Requires #335 and #361. This updates the submit command in the Testflinger CLI to authenticate clients and authorize jobs that specify a job_priority in the yaml. For these jobs, the CLI will first get a token from the server, which requires a client_id and client-key. These can be specified as an environment variable, in the command line options, or in the config. The CLI will submit this token with the job.

Resolved issues

Resolves https://warthogs.atlassian.net/browse/CERTTF-372

Documentation

Documentation was added to the CLI README and submit-job documentation in docs/

Web service API changes

N/A

Tests

Unit tests were added to test_cli.py. These tests test that the JWT received from the authentication endpoint is passed with the job for jobs with priority, and jobs with priority are rejected when client credentials aren't specified in the CLI.

@val500 val500 marked this pull request as draft September 12, 2024 18:03
@val500 val500 force-pushed the CERTTF-370-Create-new-endpoint-in-Testflinger-Server-to-authenticate-clients-and-distribute-tokens-for-submitting-jobs-with-priority branch from 442a39b to 6aee42d Compare September 12, 2024 23:10
@val500 val500 force-pushed the CERTTF-372-Update-Testflinger-CLI-to-authenticate-jobs-with-priority-with-the-server branch from 8bf4431 to 7fd149f Compare September 12, 2024 23:18
@val500 val500 force-pushed the CERTTF-370-Create-new-endpoint-in-Testflinger-Server-to-authenticate-clients-and-distribute-tokens-for-submitting-jobs-with-priority branch 2 times, most recently from b2c6537 to 98ea5c0 Compare September 17, 2024 21:24
@val500 val500 force-pushed the CERTTF-372-Update-Testflinger-CLI-to-authenticate-jobs-with-priority-with-the-server branch from 7fd149f to 6607d5a Compare September 18, 2024 20:19
@val500 val500 changed the base branch from CERTTF-370-Create-new-endpoint-in-Testflinger-Server-to-authenticate-clients-and-distribute-tokens-for-submitting-jobs-with-priority to CERTTF-371 September 18, 2024 20:21
@val500 val500 force-pushed the CERTTF-372-Update-Testflinger-CLI-to-authenticate-jobs-with-priority-with-the-server branch from 6607d5a to 4cbe5e4 Compare September 18, 2024 22:15
@val500 val500 force-pushed the CERTTF-371 branch 2 times, most recently from 6719eb5 to aca7c23 Compare October 2, 2024 17:00
@val500 val500 force-pushed the CERTTF-372-Update-Testflinger-CLI-to-authenticate-jobs-with-priority-with-the-server branch from 4cbe5e4 to 5133174 Compare October 2, 2024 19:51
Base automatically changed from CERTTF-371 to main October 8, 2024 16:16
@val500 val500 force-pushed the CERTTF-372-Update-Testflinger-CLI-to-authenticate-jobs-with-priority-with-the-server branch 3 times, most recently from d27c81d to 47630d1 Compare October 8, 2024 18:08
@val500 val500 force-pushed the CERTTF-372-Update-Testflinger-CLI-to-authenticate-jobs-with-priority-with-the-server branch from 626b2ee to 3df30ea Compare October 28, 2024 10:38
@val500 val500 requested a review from plars October 28, 2024 10:40
@val500 val500 marked this pull request as ready for review October 28, 2024 10:41
Copy link
Contributor

@plars plars left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haven't looked at all of this yet, but I noticed the tests section is completely empty. Can we get more details on how you tested this? I think it's also good to have some sort of unit tests that cover the new code here too.

@val500
Copy link
Contributor Author

val500 commented Oct 28, 2024

Haven't looked at all of this yet, but I noticed the tests section is completely empty. Can we get more details on how you tested this? I think it's also good to have some sort of unit tests that cover the new code here too.

Just added 2 unit tests - is there any other functionality you think it would be beneficial to test?

@val500 val500 requested a review from plars October 28, 2024 16:20
docs/how-to/submit-job.rst Outdated Show resolved Hide resolved
docs/how-to/submit-job.rst Outdated Show resolved Hide resolved
@val500 val500 force-pushed the CERTTF-372-Update-Testflinger-CLI-to-authenticate-jobs-with-priority-with-the-server branch from 69c322e to ae353c2 Compare October 30, 2024 10:52
@val500 val500 requested a review from plars October 30, 2024 13:50
Copy link
Contributor

@plars plars left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a couple of very minor things

docs/how-to/job-priority.rst Outdated Show resolved Hide resolved
docs/reference/job-schema.rst Outdated Show resolved Hide resolved
@val500 val500 requested a review from plars October 31, 2024 16:02
Copy link
Contributor

@plars plars left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

checkmate, +1 :)

@plars plars merged commit 66b231f into main Nov 1, 2024
5 checks passed
@plars plars deleted the CERTTF-372-Update-Testflinger-CLI-to-authenticate-jobs-with-priority-with-the-server branch November 1, 2024 09:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants