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 support for a "detached" mode #162

Merged
merged 4 commits into from
May 18, 2023
Merged

Conversation

dscho
Copy link
Collaborator

@dscho dscho commented May 17, 2023

In #131, first, and then in #156, a change was proposed to support the same functionality as CircleCI, where a terminal is open concurrent to the running job's steps. And as I mentioned in the latter PR, I have found that feature quite useful (implementing it "manually", by having two shell: bash steps).

Here is a very small PR to propose a much simpler UI but essentially offer the same feature: by setting the input detached: true, the action-tmate step will start a new, detached tmate session, print the information how to connect to that, and then continue with the workflow job's next steps, keeping the tmate session running. In the post-job phase, action-tmate will then wait for the session to end (or, if nobody connected to the session within 10 minutes of that post-job Action, terminate anyway).

Sadly, this PR results in warnings about the usage of the save-state command that would only be solved by upgrading to @actions/core 1.10.0. However, in #152 we tried that and the same blockers are still there. So I'll punt on that, for now.

Sometimes it is nicer when things are quiet. In the upcoming commit, I
will introduce a caller that does want to consume the output of a shell
command without having its output clutter the job's logs.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
@dscho dscho requested a review from mxschmitt as a code owner May 17, 2023 21:04
@dscho dscho self-assigned this May 17, 2023
dscho added 3 commits May 17, 2023 23:06
In "detached" mode, the `tmate` session will be created, the Action will
then print the information how to connect, and then exit with success.

The workflow job's steps will run concurrently with the `tmate` session,
allowing the user to monitor the steps as they are progressing.

At the end of the job, the Action's newly-introduced post-job Action
will wait until the session is ended, or up to 10 minutes for any client
to connect at all.

This detached mode is inspired by CircleCI/CirrusCI's debugging support
that _only_ allows a concurrent shell terminal to be opened.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
To better assess how useful the detached mode is, and whether it handles
all of the corner cases correctly (client connects only during the post
job phase, job is canceled while waiting for the session to end, etc),
let's have a GitHub workflow that can be triggered manually.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Copy link
Owner

@mxschmitt mxschmitt left a comment

Choose a reason for hiding this comment

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

great work!

@dscho dscho merged commit 53a5c23 into mxschmitt:master May 18, 2023
1 check passed
@dscho dscho deleted the detached-mode branch May 18, 2023 11:50
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.

None yet

3 participants