Skip to content

feat: add execution_result to /v1/status API - #6388

Merged
yorugac merged 1 commit into
masterfrom
feat/exec-code-in-status
Sep 18, 2026
Merged

yorugac merged 1 commit into
masterfrom
feat/exec-code-in-status

Conversation

@yorugac

@yorugac yorugac commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

What?

Adding a new field to HTTP status API, to have early access to expected exit code value. Esp. valuable in --linger mode.

Why?

Full context is in this issue:
grafana/k6-operator#796 (comment)

Checklist

  • I have performed a self-review of my code.
  • I have commented on my code, particularly in hard-to-understand areas.
  • I have added tests for my changes.
  • I have run linter and tests locally (make check) and all pass.

make check has failures, but they are pre-existing to this change.

Checklist: Documentation (only for k6 maintainers and if relevant)

Please do not merge this PR until the following items are filled out.

  • I have added the correct milestone and labels to the PR.
  • I have updated the release notes: link
  • I have updated or added an issue to the k6-documentation: grafana/k6-docs#NUMBER if applicable
  • I have updated or added an issue to the TypeScript definitions: grafana/k6-DefinitelyTyped#NUMBER if applicable

Related PR(s)/Issue(s)

@yorugac
yorugac temporarily deployed to azure-trusted-signing September 10, 2026 12:51 — with GitHub Actions Inactive
body, err := io.ReadAll(resp.Body)
require.NoError(t, err)
assert.Equal(t, int64(exitcodes.ScriptAborted),
gjson.GetBytes(body, "data.attributes.execution_result.exit_code").Int())

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

JSON testing is here to avoid importing v1 package for just 1 test. LMK if you're OK with the import instead.

@yorugac
yorugac temporarily deployed to azure-trusted-signing September 10, 2026 12:54 — with GitHub Actions Inactive
@yorugac
yorugac marked this pull request as ready for review September 16, 2026 10:46
@yorugac
yorugac requested a review from a team as a code owner September 16, 2026 10:46
@yorugac
yorugac requested review from AgnesToulet and joanlopez and removed request for a team September 16, 2026 10:46
@yorugac
yorugac force-pushed the feat/exec-code-in-status branch from 32517de to 2888dd1 Compare September 16, 2026 10:49
@yorugac
yorugac deployed to azure-trusted-signing September 16, 2026 10:54 — with GitHub Actions Active
@yorugac
yorugac deployed to azure-trusted-signing September 16, 2026 10:55 — with GitHub Actions Active
@yorugac

yorugac commented Sep 16, 2026

Copy link
Copy Markdown
Contributor Author

Hello! Marking this as ready for review. This PR was tested on k6-operator use case with the help of this PR grafana/k6-operator#901

The script contained deliberate exec.test.abort call. Without this change, such PLZ test gets stuck until Cloud times it out.
With this change, the exec status is noticed and acted on: the test gets aborted by notification from k6-operator and becomes "Aborted" instead of "Timeout".

There is no inter-dependency between PRs: they can be merged in any order. This PR in k6 CLI just unlocks a better UX.

@mstoykov

Copy link
Copy Markdown
Contributor

Can you please rebase this on latest master (we had a bunch of updates in recent days an I do not know if you are on top of it) and ten fix the lint issues.

@yorugac
yorugac force-pushed the feat/exec-code-in-status branch from 2888dd1 to 1945db7 Compare September 16, 2026 19:11
@yorugac
yorugac deployed to azure-trusted-signing September 16, 2026 19:17 — with GitHub Actions Active
@yorugac
yorugac deployed to azure-trusted-signing September 16, 2026 19:19 — with GitHub Actions Active
@yorugac

yorugac commented Sep 16, 2026

Copy link
Copy Markdown
Contributor Author

@mstoykov done 👍
The failing CI is browser tests: I don't think it's related, esp. since those seem connected to the runner type.

@mstoykov mstoykov left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM! thank you for the contribution

@szkiba
szkiba self-requested a review September 18, 2026 10:49

@szkiba szkiba left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@yorugac
yorugac merged commit 3fcf538 into master Sep 18, 2026
62 of 64 checks passed
@yorugac
yorugac deleted the feat/exec-code-in-status branch September 18, 2026 10:51
@inancgumus inancgumus added this to the v2.3.0 milestone Sep 18, 2026

This branch was successfully deployed

1 active deployment
azure-trusted-signing — 1945db7d Deployed Sep 16, 2026 by yorugac via sign-packages #10724
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.

4 participants