---
title: Create Loaner (Docker Worker Linux)
name: docker-worker-linux-loaner
description: >
  Create a clone of the task for use in interactive tasks.

  This does not update any dependencies or
  cause any downstream tasks to be retriggered.

  The new task will be altered to
    * Set task.payload.features.interactive = true
    * Strip task.payload.caches to avoid poisoning
    * Ensures task.payload.maxRunTime is minimum of 180 minutes
    * Strip task.routes to avoid side-effects
    * Set the environment variable TASKCLUSTER_INTERACTIVE=true
order: 1
context:
  - worker-implementation: docker-worker
    os: linux
---
$merge:
  - $map: {$eval: task}
    each(s):
      $if: '!(s.key in ["routes", "dependencies", "requires", "scopes", "payload"])'
      then: {'${s.key}': {$eval: s.val}}
  - {created: {$fromNow: ''}}
  - {deadline: {$fromNow: 12 hours}}
  - {expires: {$fromNow: 7 days}}
  - scopes:
      $map: {$eval: task.scopes}
      each(scope):
        $if: 'scope[:7] != "docker-worker:cache:"'
        then: '${scope}'
  - payload:
      $merge:
        - $map: {$eval: task.payload}
          each(s):
            $if: '!(s.key in ["artifacts", "cache"])'
            then: {'${s.key}': {$eval: s.val}}
        - maxRunTime: {$eval: 'max(task.payload.maxRunTime, 3 * 60 * 60)'}
          features:
            $merge:
              - $if: '"features" in task.payload'
                then:
                  $eval: task.payload.features
              - interactive: true
          env:
            $merge:
              - $if: '"env" in task.payload'
                then:
                  $eval: task.payload.env
              - TASKCLUSTER_INTERACTIVE: true
