Repository navigation
feat(stack): stack action list/run/log for custom actions (#155) - #165
Merged
Merged
Conversation
- stack action list: the custom actions of the hooks config with label, CAN RUN, JOB LOG and the parameters (type, options, required, default). - stack action run <stack> <action> [--param k=v] [--yes] [--wait]: types the declared parameters (bool, enum), fills defaults, passes undeclared ones as strings and refuses a missing required parameter before the request. Asks with the confirmation text unless --yes. A subscriber status >= 400 gives exit code 1. - --wait and stack action log --follow poll the job log every 3 s, with backoff on 429, 502, 503, 504 and network errors (Retry-After, else doubling up to 30 s). They stop on done, on other errors and at --timeout (default 60m). A failed final status gives exit code 1. The job ID goes to stderr before the poll starts. - client.SanitizeLogText: log text keeps line feeds and tabs; other control characters are removed or replaced. - Fix a race in renewIfExpiring: read the current token before the token file. TestRenew_ConcurrentGoroutinesOneClient failed now and then under load (a second refresh). Closes #155 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configuration
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Commands for the custom actions of the hooks config (
hooks.actions):stack action list <stack>: the actions with label,CAN RUN,JOB LOGand the parameters (type, enum options, required, default).-qprints the names.-o json|yamlprints the full response.stack action run <stack> <action> [--param key=value ...] [--yes] [--wait] [--timeout 60m]:can_invoke: falsestops before the request.bool,enum), fills declared defaults, passes undeclared parameters as strings, and refuses a missing required parameter.--yesskips the question.stack action log <stack> <action> <job-id> [--offset N] [--follow]: one log chunk (log text to stdout, status to stderr), or the full log with--follow.--waitand--follow, as the web UI does:Retry-After(at most 5 minutes), else a doubling delay from 3 s up to 30 s.done, on other errors (401, 403, 404, a response that is not JSON) and at--timeout. A final status outside the success set (succeeded,success,completed,done,ok, ...) gives exit code 1.-o json|yaml, the log goes to stderr and the result hasjob_status.Other changes
client.SanitizeLogText: log text keeps line feeds and tabs. Carriage returns and bidi controls are removed, other control characters become a space.APIError.RetryAfter().renewIfExpiring(pkg/client/auth.go): read the current token before the token file. Before, a parallel renewal between the two reads gave a second refresh, andTestRenew_ConcurrentGoroutinesOneClientfailed now and then under load.resetCmdFlagsresets slice and array flags withReplace.Tests
go test ./...passes.go test -shuffle=on ./cmdpasses.go test -race ./pkg/client -count=5passes.TestRenew_ConcurrentGoroutinesOneClient -count=100passes.cli/cmd/stack_action_test.go(parameters, confirmation, refusal,--waitwith backoff, timeouts, truncated chunks, JSON output,log --follow) and client tests incli/pkg/client/stack_inspect_test.go.Closes #155
🤖 Generated with Claude Code