Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add pre-warm step to avoid first time crash #8

Merged
merged 1 commit into from
Oct 19, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading