Skip to content

Commit

Permalink
Merge pull request #8 from koendelaat/main
Browse files Browse the repository at this point in the history
Add pre-warm step to avoid first time crash
  • Loading branch information
edwardvandevorst-philips authored Oct 19, 2023
2 parents 51c1a6c + 35081bd commit 4bf04af
Showing 1 changed file with 22 additions and 3 deletions.
25 changes: 22 additions & 3 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,23 +37,42 @@ inputs:
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=46,col=1,endColumn=1::This action can only run on 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
if: runner.os == 'Windows'
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
if: runner.os == 'Windows'
run: >-
docker run ${{ steps.settings.outputs.extra_args }}
--rm
Expand Down

0 comments on commit 4bf04af

Please sign in to comment.