Building Sessions
When building sessions, you can follow the same methods used in Building Workflows.
However, there is one important note: when creating a session, the top-level definition sessions
is required. Similar to the top-level definition jobs
, sessions
can be used to define multiple sessions with unique names. You can then use the session
context to call a session by name inside steps
.
In the example below, there is one session defined in sessions
, named expose
. That session is then referenced inside steps
inside jobs
with the context ${{ sessions.expose }}
. The expose
property redirect
designates whether the user will be redirected to a specific session, especially in the event that you define multiple sessions. The property prompt-for-name
determines whether a user will be prompted to name their session. If prompt-for-name
is excluded, a name will automatically be generated based on the run numbers.
sessions:
expose:
redirect: true
prompt-for-name: false
jobs:
main:
steps:
- name: Expose port
uses: parallelworks/update-session
with:
remotePort: '3001'
name: ${{ sessions.expose }}
status: running
target: ${{ inputs.target.id }}
- name: Run forever
run: ssh ${{ inputs.target.ip }} tail -f /dev/null
'on':
execute:
inputs:
target:
type: compute-clusters
default: ${{ app.target }}