-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yml
86 lines (83 loc) · 3.07 KB
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
name: Execute-in-windows-docker-container
description: Composite action for command execution with docker on windows
author: Edward van de Vorst
branding:
icon: "play"
color: "blue"
inputs:
image:
description: 'Docker image.'
required: true
run:
description: 'Command to execute.'
required: true
workspace_path:
description: 'Workspace path. Default is root workspace path.'
required: false
mapping_path:
description: 'Mapping path, i.e. path to where the workspace path is mapped in the docker container. Defaults to workspace_path.'
required: false
work_path:
description: 'Work path, i.e. path where the command in the docker container is executed. Defaults to workspace_path.'
required: false
memory:
description: 'Memory limit. See docker documentation on --memory.'
required: false
default: '4GB'
entrypoint:
description: "Overrides the default ENTRYPOINT in docker image."
required: false
default: ''
env_names:
description: 'Environment variable names passed to docker image as comma separated list, for example: NAME1, NAME2, NAME3'
required: false
default: ''
extra_args:
description: 'Extra arguments for docker run command.'
required: false
default: ''
pre-warm:
description: 'Run a warming-up container (which might crash due to first time use failure)'
required: false
default: 'true'
pre-warm-cmd:
description: 'Pre warm command to run inside the container'
required: false
default: 'echo "warming up!"'
runs:
using: "composite"
steps:
- name: check
if: runner.os != 'Windows'
run: |
echo "::error file=run-windows-docker-container-action/action.yml,line=52,col=1,endColumn=1::This action can only run on windows";
exit -1
shell: bash
- name: settings
id: settings
run: >-
${{github.action_path}}/src/parse_input_paths.ps1 -githubWorkSpace "${{ github.workspace }}" -workspacePath "@${{ inputs.workspace_path }}" -mappingPath "@${{ inputs.mapping_path }}" -workPath "@${{ inputs.work_path }}";
${{github.action_path}}/src/parse_input_extra_args.ps1 -envNames "@${{ inputs.env_names }}" -entryPoint "@${{ inputs.entrypoint }}" -extraArgs "@${{ inputs.extra_args }}";
shell: powershell
- name: Pre-warm
if: inputs.pre-warm == 'true'
run: |
docker run ${{ steps.settings.outputs.extra_args }} `
--rm --memory=${{ inputs.memory }} `
-v ${{ steps.settings.outputs.workspace_path }}:${{ steps.settings.outputs.mapping_path }} `
-w ${{ steps.settings.outputs.work_path }} `
${{ inputs.image }} { ${{ inputs.pre-warm-cmd }} }
exit 0
shell: powershell
- name: Run
run: >-
docker run ${{ steps.settings.outputs.extra_args }}
--rm
--memory=${{ inputs.memory }}
-v ${{ steps.settings.outputs.workspace_path }}:${{ steps.settings.outputs.mapping_path }}
-w ${{ steps.settings.outputs.work_path }}
${{ inputs.image }}
{
${{ inputs.run }}
}
shell: powershell