Skip to content

Commit 14e1f2b

Browse files
Merge pull request #22 from philips-software/feature/revert-version-2.0.0
feat: remove previous change
2 parents ffa77bf + 07ab26f commit 14e1f2b

File tree

3 files changed

+41
-80
lines changed

3 files changed

+41
-80
lines changed

.github/workflows/test.yml

Lines changed: 18 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,8 @@ jobs:
3636
image: ${{ matrix.docker_container }}
3737
mapping_path: 'c:\map'
3838
entrypoint: powershell.exe
39-
entrypoint_args: '-NoLogo -NonInteractive -NoProfile'
4039
env_names: TEST_MAPPING_PATH
41-
run: |
40+
run: >-
4241
c:\map\test\run_test.ps1 -testPath "c:\map\test\run_default.Tests.ps1";
4342
4443
- name: Test_ExtraArgs
@@ -48,28 +47,27 @@ jobs:
4847
mapping_path: 'c:\map'
4948
workspace_path: ${{ github.workspace }}
5049
extra_args: --entrypoint cmd.exe
51-
run: |
52-
echo Hello world & exit %ERRORLEVEL%
50+
run: >-
51+
echo "Hello world";
52+
exit %ERRORLEVEL%;
5353
5454
- name: Test_Environment
5555
uses: ./
5656
with:
5757
image: ${{ matrix.docker_container }}
5858
entrypoint: powershell.exe
59-
entrypoint_args: '-NoLogo -NonInteractive -NoProfile'
6059
mapping_path: 'c:\map'
6160
env_names: TEST1, TEST2, TEST3
62-
run: |
61+
run: >-
6362
c:\map\test\run_test.ps1 -testPath "c:\map\test\environment.Tests.ps1";
6463
6564
- name: Test_Default_Environment
6665
uses: ./
6766
with:
6867
image: ${{ matrix.docker_container }}
6968
entrypoint: powershell.exe
70-
entrypoint_args: '-NoLogo -NonInteractive -NoProfile'
7169
mapping_path: 'c:\map'
72-
run: |
70+
run: >-
7371
c:\map\test\run_test.ps1 -testPath "c:\map\test\default_environment.Tests.ps1";
7472
7573
- name: Test_WorkPath
@@ -79,9 +77,8 @@ jobs:
7977
mapping_path: 'c:\map'
8078
work_path: 'c:\temp'
8179
entrypoint: powershell.exe
82-
entrypoint_args: '-NoLogo -NonInteractive -NoProfile'
8380
memory: 3GB
84-
run: |
81+
run: >-
8582
c:\map\test\run_test.ps1 -testPath "c:\map\test\work_path.Tests.ps1";
8683
8784
- name: Test_MappingPath
@@ -91,9 +88,8 @@ jobs:
9188
mapping_path: 'c:\mapping'
9289
work_path: 'c:\temp'
9390
entrypoint: powershell.exe
94-
entrypoint_args: '-NoLogo -NonInteractive -NoProfile'
9591
memory: 3GB
96-
run: |
92+
run: >-
9793
c:\mapping\test\run_test.ps1 -testPath "c:\mapping\test\mapping_path.Tests.ps1";
9894
9995
- name: Test_WorkSpacePath
@@ -103,10 +99,9 @@ jobs:
10399
mapping_path: 'c:\map'
104100
workspace_path: ${{ github.workspace }}/test
105101
entrypoint: powershell.exe
106-
entrypoint_args: '-NoLogo -NonInteractive -NoProfile'
107102
memory: 3GB
108103
env_names: TEST_MAPPING_PATH
109-
run: |
104+
run: >-
110105
c:\map\run_test.ps1 -testPath "c:\map\workspace_path.Tests.ps1";
111106
112107
validate:
@@ -117,25 +112,25 @@ jobs:
117112
steps:
118113
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
119114
- name: Install
120-
shell: pwsh -NoLogo -NonInteractive -NoProfile -Command ". '{0}'"
121-
run: |
115+
shell: pwsh
116+
run: >-
122117
Set-PSRepository -Name 'PSGallery' -InstallationPolicy Trusted;
123118
Install-Module -Name Pester -Force -SkipPublisherCheck;
124119
Update-Module -Name Pester -Force;
125120
Install-Module -Name PSScriptAnalyzer -Force;
126121
Import-Module PSScriptAnalyzer -ErrorAction Stop
127122
- name: Linter src
128-
shell: pwsh -NoLogo -NonInteractive -NoProfile -Command ". '{0}'"
129-
run: |
123+
shell: pwsh
124+
run: >-
130125
Invoke-ScriptAnalyzer -Path src -EnableExit;
131126
- name: Linter test
132-
shell: pwsh -NoLogo -NonInteractive -NoProfile -Command ". '{0}'"
133-
run: |
127+
shell: pwsh
128+
run: >-
134129
Invoke-ScriptAnalyzer -Path test -EnableExit;
135130
- name: Test-Action-Scripts
136-
shell: pwsh -NoLogo -NonInteractive -NoProfile -Command ". '{0}'"
137-
run: |
138-
Set-Location src;
131+
shell: pwsh
132+
run: >-
133+
cd src;
139134
$config=New-PesterConfiguration;
140135
$config.Run.Exit=$true;
141136
Invoke-Pester -Configuration $config;

README.md

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -11,24 +11,8 @@ Composite action for running commands in windows docker containers.
1111

1212
## Usage
1313

14-
Simple 'Hello world' example using the default `cmd.exe` ENTRYPOINT with the `/C` option:
15-
```
16-
steps:
17-
- name: Checkout
18-
uses: actions/checkout@v3
19-
with:
20-
fetch-depth: 0
21-
- name: Test_Run
22-
uses: philips-software/run-windows-docker-container-action@<version>
23-
with:
24-
image: mcr.microsoft.com/windows/servercore:20H2
25-
entrypoint_args: /C
26-
run: >-
27-
echo Hello world &
28-
call run-test-script.bat;
29-
```
14+
Very simple hello world example:
3015

31-
Simple 'Hello world' example overriding the default ENTRYPOINT:
3216
```
3317
steps:
3418
- name: Checkout
@@ -41,7 +25,7 @@ Simple 'Hello world' example overriding the default ENTRYPOINT:
4125
image: mcr.microsoft.com/windows/servercore:20H2
4226
entrypoint: powershell.exe
4327
run: >-
44-
Write-Output "Hello world";
28+
echo "Hello world";
4529
./run-test-script.ps1;
4630
```
4731

@@ -60,17 +44,16 @@ and work path.
6044
| parameter | description | required | default |
6145
| - | - | - | - |
6246
| image | Docker image. | `true` | |
63-
| run | Command to execute. Must be single line for cmd.exe entry point (use &, && or \|\| operators to aggregate multiple commands). Can be multiline for entry points that support it, like powershell.exe. | `true` | |
47+
| run | Command to execute. | `true` | |
6448
| workspace_path | Workspace path. Default is root workspace path. | `false` | |
6549
| mapping_path | Mapping path, i.e. path to where the workspace path is mapped in the docker container. Defaults to workspace_path. | `false` | |
6650
| work_path | Work path, i.e. path where the command in the docker container is executed. Defaults to workspace_path. | `false` | |
6751
| memory | Memory limit. See docker documentation on --memory. | `false` | 4GB |
6852
| entrypoint | Overrides the default ENTRYPOINT in docker image. | `false` | |
69-
| entrypoint_args | Optional arguments for the ENTRYPOINT (default or overriden). For instance, `/S /C` for cmd.exe or `-NoLogo -NonInteractive -NoProfile` for powershell.exe. | `false` | |
7053
| env_names | Environment variable names passed to docker image as comma separated list, for example: NAME1, NAME2, NAME3 | `false` | |
7154
| extra_args | Extra arguments for docker run command. | `false` | |
7255
| pre-warm | Run a warming-up container (which might crash due to first time use failure) | `false` | true |
73-
| pre-warm-cmd | Pre warm command to run inside the container | `false` | Write-Output "warming up!" |
56+
| pre-warm-cmd | Pre warm command to run inside the container | `false` | echo "warming up!" |
7457
| registry_authentication | Authenticate against registry server | `false` | false |
7558
| registry_username | Docker registry username. | `false` | |
7659
| registry_token | Docker registry token | `false` | |

action.yml

Lines changed: 19 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ inputs:
1010
description: 'Docker image.'
1111
required: true
1212
run:
13-
description: 'Command to execute. Must be single line for cmd.exe entry point (use &, && or \|\| operators to aggregate multiple commands). Can be multiline for entry points that support it, like powershell.exe.'
13+
description: 'Command to execute.'
1414
required: true
1515
workspace_path:
1616
description: 'Workspace path. Default is root workspace path.'
@@ -29,10 +29,6 @@ inputs:
2929
description: "Overrides the default ENTRYPOINT in docker image."
3030
required: false
3131
default: ''
32-
entrypoint_args:
33-
description: "Optional arguments for the ENTRYPOINT (default or overriden). For instance, `/S /C` for cmd.exe or `-NoLogo -NonInteractive -NoProfile` for powershell.exe."
34-
required: false
35-
default: ''
3632
env_names:
3733
description: 'Environment variable names passed to docker image as comma separated list, for example: NAME1, NAME2, NAME3'
3834
required: false
@@ -48,7 +44,7 @@ inputs:
4844
pre-warm-cmd:
4945
description: 'Pre warm command to run inside the container'
5046
required: false
51-
default: 'Write-Output "warming up!"'
47+
default: 'echo "warming up!"'
5248
registry_authentication:
5349
description : 'Authenticate against registry server'
5450
required : false
@@ -74,41 +70,31 @@ runs:
7470
shell: bash
7571
- name: settings
7672
id: settings
77-
run: |
73+
run: >-
7874
${{ github.action_path }}/src/parse_input_paths.ps1 -githubWorkSpace "${{ github.workspace }}" -workspacePath "@${{ inputs.workspace_path }}" -mappingPath "@${{ inputs.mapping_path }}" -workPath "@${{ inputs.work_path }}";
7975
${{ github.action_path }}/src/parse_input_extra_args.ps1 -envNames "@${{ inputs.env_names }}" -entryPoint "@${{ inputs.entrypoint }}" -extraArgs "@${{ inputs.extra_args }}";
8076
${{ github.action_path }}/src/assign_default_environment_variables.ps1;
81-
shell: powershell -NoLogo -NonInteractive -NoProfile -Command ". '{0}'"
77+
shell: powershell
8278
- name: docker_login
8379
id: docker_login
8480
if: inputs.registry_authentication == 'true'
85-
shell: powershell -NoLogo -NonInteractive -NoProfile -Command ". '{0}'"
86-
run: |
81+
shell: powershell
82+
run: >-
8783
docker login ${{ inputs.registry_repository }} -u ${{ inputs.registry_username }} -p ${{ inputs.registry_token }}
8884
- name: Pre-warm
8985
if: inputs.pre-warm == 'true'
90-
run: >-
91-
docker run
92-
${{ steps.settings.outputs.extra_args }}
93-
--rm
94-
--memory=${{ inputs.memory }}
95-
-v ${{ steps.settings.outputs.workspace_path }}:${{ steps.settings.outputs.mapping_path }}
96-
-w ${{ steps.settings.outputs.work_path }}
97-
${{ inputs.image }}
98-
${{ inputs.entrypoint_args }}
99-
@"
100-
101-
${{ inputs.pre-warm-cmd }}
102-
103-
"@
104-
86+
run: |
87+
docker run ${{ steps.settings.outputs.extra_args }} `
88+
--rm --memory=${{ inputs.memory }} `
89+
-v ${{ steps.settings.outputs.workspace_path }}:${{ steps.settings.outputs.mapping_path }} `
90+
-w ${{ steps.settings.outputs.work_path }} `
91+
${{ inputs.image }} { ${{ inputs.pre-warm-cmd }} }
10592
exit 0
106-
shell: powershell -NoLogo -NonInteractive -NoProfile -Command ". '{0}'"
93+
shell: powershell
10794
- name: Run
10895
run: >-
10996
$runnerPathSource = Split-Path -Path "${env:RUNNER_TEMP}" -Parent;
110-
111-
$runnerPathTarget = $runnerPathSource.replace('D:', 'C:');
97+
$runnerPathTarget = $runnerPathSource.replace('D:', 'C:')
11298
11399
docker run
114100
${{ steps.settings.outputs.default_environment_variables }}
@@ -119,16 +105,13 @@ runs:
119105
-v ${{ steps.settings.outputs.workspace_path }}:${{ steps.settings.outputs.mapping_path }}
120106
-w ${{ steps.settings.outputs.work_path }}
121107
${{ inputs.image }}
122-
${{ inputs.entrypoint_args }}
123-
@"
124-
108+
{
125109
${{ inputs.run }}
126-
127-
"@
128-
shell: powershell -NoLogo -NonInteractive -NoProfile -Command ". '{0}'"
110+
}
111+
shell: powershell
129112
- name: docker_logout
130113
id: docker_logout
131114
if: inputs.registry_authentication == 'true'
132-
shell: powershell -NoLogo -NonInteractive -NoProfile -Command ". '{0}'"
133-
run: |
115+
shell: powershell
116+
run: >-
134117
docker logout ${{ inputs.registry_repository }}

0 commit comments

Comments
 (0)