Introduce task container selector#113
Open
vitolkachova wants to merge 2 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds support for targeting running task containers (ephemeral, activity-backed) via a new --task selector, enabling ssh, scp, and log to connect to a specific task run (optionally disambiguated via --activity).
Changes:
- Introduces
Selector::addTaskOption()and task-container resolution inSelector::selectRemoteContainer()based on in-progress/pendingenvironment.taskactivities. - Adds a new
RemoteContainer\Taskimplementation that derives an SSH URL for a task run. - Wires the new options into
environment:ssh,environment:scp, andenvironment:logscommands (plus an example inssh).
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| legacy/src/Selector/Selector.php | Adds --task/--activity options and implements selection logic for task-run containers. |
| legacy/src/Model/RemoteContainer/Task.php | New remote container type for SSH access to an in-progress task run. |
| legacy/src/Command/Environment/EnvironmentSshCommand.php | Exposes --task/--activity on ssh and adds a usage example. |
| legacy/src/Command/Environment/EnvironmentScpCommand.php | Exposes --task/--activity on scp. |
| legacy/src/Command/Environment/EnvironmentLogCommand.php | Exposes --task/--activity on log. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+963
to
+979
| private function matchTaskActivity(array $running, string $taskName, string $activityId): Activity | ||
| { | ||
| $matches = array_values(array_filter( | ||
| $running, | ||
| fn(Activity $activity): bool => $activity->id === $activityId, | ||
| )); | ||
| if (count($matches) === 1) { | ||
| return $matches[0]; | ||
| } | ||
| $ids = implode(', ', array_map(fn(Activity $activity): string => $activity->id, $running)); | ||
| throw new InvalidArgumentException(sprintf( | ||
| 'No running instance of the task "%s" matches the activity ID "%s". Running activity IDs: %s', | ||
| $taskName, | ||
| $activityId, | ||
| $ids, | ||
| )); | ||
| } |
Comment on lines
+939
to
+941
| $choices[$activity->id] = $activity->created_at !== '' | ||
| ? sprintf('%s (started %s)', $activity->id, $activity->created_at) | ||
| : $activity->id; |
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.
Add task container selector for commands
ssh,scpandlog. Proposes to choose from a task runs list if several are executed in parallel.activityID can be provided to specify exact task run: