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

openqa-investigate: Fix dry-run depending on presence of comments #279

Merged

Conversation

okurz
Copy link
Member

@okurz okurz commented Jan 18, 2024

This fixes the dry-run mode by returning from functions early or
simulating the output of "openqa-clone-job" when we would call
openqa-clone-job and parse its output.

Before:

$ dry_run=1 ./openqa-investigate 3876947
jq (161 ./openqa-investigate): jq: parse error: Invalid numeric literal at line 1, column 11 (rc: 5 Input: >>>openqa-cli api --header User-Agent: openqa-investigate (https://github.com/os-autoinst/scripts) --host https://aquarius.suse.cz --retries=3 -X POST jobs/20047/comments text=Starting investigation for job 20047<<<)

After:

$ dry_run=1 ./openqa-investigate 3876947
openqa-cli api --header User-Agent: openqa-investigate (https://github.com/os-autoinst/scripts) --host https://openqa.opensuse.org -X PUT jobs/3876947/comments/ text=Automatic investigation jobs for job 3876947:

openqa-clone-job --json-output --skip-chained-deps --max-depth 0 --parental-inheritance --within-instance https://openqa.opensuse.org/tests/3876947 TEST+=:investigate:retry _TRIGGER_JOB_DONE_HOOK=1 _GROUP_ID=0 BUILD= OPENQA_INVESTIGATE_ORIGIN=https://openqa.opensuse.org/t3876947
* **krypton-live:investigate:retry**: https://openqa.opensuse.org/tnull
openqa-clone-job --json-output --skip-chained-deps --max-depth 0 --parental-inheritance --within-instance https://openqa.opensuse.org/tests/3876947 TEST+=:investigate:last_good_tests:b1712f3140cbe7ab8f30cf0647e54aa433e3c401 _TRIGGER_JOB_DONE_HOOK=1 _GROUP_ID=0 BUILD= CASEDIR=https://github.com/os-autoinst/os-autoinst-distri-opensuse.git#b1712f3140cbe7ab8f30cf0647e54aa433e3c401 OPENQA_INVESTIGATE_ORIGIN=https://openqa.opensuse.org/t3876947
* **krypton-live:investigate:last_good_tests:b1712f3140cbe7ab8f30cf0647e54aa433e3c401**: https://openqa.opensuse.org/tnull
openqa-clone-job --json-output --skip-chained-deps --max-depth 0 --parental-inheritance --within-instance https://openqa.opensuse.org/tests/3836309 TEST+=:investigate:last_good_build:10.44 _TRIGGER_JOB_DONE_HOOK=1 _GROUP_ID=0 BUILD= OPENQA_INVESTIGATE_ORIGIN=https://openqa.opensuse.org/t3876947
* **krypton-live:investigate:last_good_build:10.44**: https://openqa.opensuse.org/tnull
openqa-clone-job --json-output --skip-chained-deps --max-depth 0 --parental-inheritance --within-instance https://openqa.opensuse.org/tests/3836309 TEST+=:investigate:last_good_tests_and_build:b1712f3140cbe7ab8f30cf0647e54aa433e3c401+10.44 _TRIGGER_JOB_DONE_HOOK=1 _GROUP_ID=0 BUILD= CASEDIR=https://github.com/os-autoinst/os-autoinst-distri-opensuse.git#b1712f3140cbe7ab8f30cf0647e54aa433e3c401 OPENQA_INVESTIGATE_ORIGIN=https://openqa.opensuse.org/t3876947
* **krypton-live:investigate:last_good_tests_and_build:b1712f3140cbe7ab8f30cf0647e54aa433e3c401+10.44**: https://openqa.opensuse.org/tnull

[*Detailed explanation of this comment*](https://github.com/os-autoinst/scripts#More-details-and-examples-about-openqa-investigate-comments)

Related progress issue: https://progress.opensuse.org/issues/153763

Copy link
Contributor

mergify bot commented Jan 18, 2024

This pull request is now in conflicts. Could you fix it? 🙏

This fixes the dry-run mode by returning from functions early or
simulating the output of "openqa-clone-job" when we would call
openqa-clone-job and parse its output.

Before:

```
$ dry_run=1 ./openqa-investigate 3876947
jq (161 ./openqa-investigate): jq: parse error: Invalid numeric literal at line 1, column 11 (rc: 5 Input: >>>openqa-cli api --header User-Agent: openqa-investigate (https://github.com/os-autoinst/scripts) --host https://aquarius.suse.cz --retries=3 -X POST jobs/20047/comments text=Starting investigation for job 20047<<<)
```

After:

```
$ dry_run=1 ./openqa-investigate 3876947
openqa-cli api --header User-Agent: openqa-investigate (https://github.com/os-autoinst/scripts) --host https://openqa.opensuse.org -X PUT jobs/3876947/comments/ text=Automatic investigation jobs for job 3876947:

openqa-clone-job --json-output --skip-chained-deps --max-depth 0 --parental-inheritance --within-instance https://openqa.opensuse.org/tests/3876947 TEST+=:investigate:retry _TRIGGER_JOB_DONE_HOOK=1 _GROUP_ID=0 BUILD= OPENQA_INVESTIGATE_ORIGIN=https://openqa.opensuse.org/t3876947
* **krypton-live:investigate:retry**: https://openqa.opensuse.org/tnull
openqa-clone-job --json-output --skip-chained-deps --max-depth 0 --parental-inheritance --within-instance https://openqa.opensuse.org/tests/3876947 TEST+=:investigate:last_good_tests:b1712f3140cbe7ab8f30cf0647e54aa433e3c401 _TRIGGER_JOB_DONE_HOOK=1 _GROUP_ID=0 BUILD= CASEDIR=https://github.com/os-autoinst/os-autoinst-distri-opensuse.git#b1712f3140cbe7ab8f30cf0647e54aa433e3c401 OPENQA_INVESTIGATE_ORIGIN=https://openqa.opensuse.org/t3876947
* **krypton-live:investigate:last_good_tests:b1712f3140cbe7ab8f30cf0647e54aa433e3c401**: https://openqa.opensuse.org/tnull
openqa-clone-job --json-output --skip-chained-deps --max-depth 0 --parental-inheritance --within-instance https://openqa.opensuse.org/tests/3836309 TEST+=:investigate:last_good_build:10.44 _TRIGGER_JOB_DONE_HOOK=1 _GROUP_ID=0 BUILD= OPENQA_INVESTIGATE_ORIGIN=https://openqa.opensuse.org/t3876947
* **krypton-live:investigate:last_good_build:10.44**: https://openqa.opensuse.org/tnull
openqa-clone-job --json-output --skip-chained-deps --max-depth 0 --parental-inheritance --within-instance https://openqa.opensuse.org/tests/3836309 TEST+=:investigate:last_good_tests_and_build:b1712f3140cbe7ab8f30cf0647e54aa433e3c401+10.44 _TRIGGER_JOB_DONE_HOOK=1 _GROUP_ID=0 BUILD= CASEDIR=https://github.com/os-autoinst/os-autoinst-distri-opensuse.git#b1712f3140cbe7ab8f30cf0647e54aa433e3c401 OPENQA_INVESTIGATE_ORIGIN=https://openqa.opensuse.org/t3876947
* **krypton-live:investigate:last_good_tests_and_build:b1712f3140cbe7ab8f30cf0647e54aa433e3c401+10.44**: https://openqa.opensuse.org/tnull

[*Detailed explanation of this comment*](https://github.com/os-autoinst/scripts#More-details-and-examples-about-openqa-investigate-comments)
```

Related progress issue: https://progress.opensuse.org/issues/153763
@okurz okurz force-pushed the feature/fix_openqa_investigate_dry_run branch from 5021f80 to ee4fbf2 Compare January 18, 2024 11:09
Copy link
Contributor

@perlpunk perlpunk left a comment

Choose a reason for hiding this comment

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

Can you provide example output?
Do you get any output in case of calling it on an investigate:retry job?

@okurz
Copy link
Member Author

okurz commented Jan 18, 2024

Can you provide example output? Do you get any output in case of calling it on an investigate:retry job?

Yes, tried with https://openqa.opensuse.org/tests/3877133 . Then I am getting "Not found" which I consider acceptable as it does not show errors but that's just limitations.

@mergify mergify bot merged commit 87f9a97 into os-autoinst:master Jan 18, 2024
4 checks passed
@okurz okurz deleted the feature/fix_openqa_investigate_dry_run branch January 19, 2024 10:21
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.

3 participants