Skip to content

Commit 4bf04af

Browse files
Merge pull request #8 from koendelaat/main
Add pre-warm step to avoid first time crash
2 parents 51c1a6c + 35081bd commit 4bf04af

1 file changed

Lines changed: 22 additions & 3 deletions

File tree

action.yml

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,23 +37,42 @@ inputs:
3737
description: 'Extra arguments for docker run command.'
3838
required: false
3939
default: ''
40+
pre-warm:
41+
description: 'Run a warming-up container (which might crash due to first time use failure)'
42+
required: false
43+
default: 'true'
44+
pre-warm-cmd:
45+
description: 'Pre warm command to run inside the container'
46+
required: false
47+
default: 'echo "warming up!"'
48+
4049

4150
runs:
4251
using: "composite"
4352
steps:
4453
- name: check
4554
if: runner.os != 'Windows'
46-
run: echo "::error file=run-windows-docker-container-action/action.yml,line=46,col=1,endColumn=1::This action can only run on windows";
55+
run: |
56+
echo "::error file=run-windows-docker-container-action/action.yml,line=52,col=1,endColumn=1::This action can only run on windows";
57+
exit -1
4758
shell: bash
4859
- name: settings
49-
if: runner.os == 'Windows'
5060
id: settings
5161
run: >-
5262
${{github.action_path}}/src/parse_input_paths.ps1 -githubWorkSpace "${{ github.workspace }}" -workspacePath "@${{ inputs.workspace_path }}" -mappingPath "@${{ inputs.mapping_path }}" -workPath "@${{ inputs.work_path }}";
5363
${{github.action_path}}/src/parse_input_extra_args.ps1 -envNames "@${{ inputs.env_names }}" -entryPoint "@${{ inputs.entrypoint }}" -extraArgs "@${{ inputs.extra_args }}";
5464
shell: powershell
65+
- name: Pre-warm
66+
if: inputs.pre-warm == 'true'
67+
run: |
68+
docker run ${{ steps.settings.outputs.extra_args }} `
69+
--rm --memory=${{ inputs.memory }} `
70+
-v ${{ steps.settings.outputs.workspace_path }}:${{ steps.settings.outputs.mapping_path }} `
71+
-w ${{ steps.settings.outputs.work_path }} `
72+
${{ inputs.image }} { ${{ inputs.pre-warm-cmd }} }
73+
exit 0
74+
shell: powershell
5575
- name: Run
56-
if: runner.os == 'Windows'
5776
run: >-
5877
docker run ${{ steps.settings.outputs.extra_args }}
5978
--rm

0 commit comments

Comments
 (0)