From 66d708060d029057ebbc10199e30d250d7cf95b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Bouchex=20Bellomi=C3=A9?= Date: Tue, 22 Oct 2024 15:40:51 +0200 Subject: [PATCH 1/5] Added login and logout --- action.yml | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 768758f..d4898dc 100644 --- a/action.yml +++ b/action.yml @@ -45,7 +45,12 @@ inputs: description: 'Pre warm command to run inside the container' required: false default: 'echo "warming up!"' - + username: + description: 'Docker username.' + required: false + repository: + description: 'Docker repository.' + required: false runs: using: "composite" @@ -62,6 +67,11 @@ runs: ${{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: docker_login + id: docker_login + shell: powershell + run: >- + echo ${{ secrets.docker_secret }} | docker login ${{ inputs.repository }} -u ${{ inputs.username }} --password-stdin - name: Pre-warm if: inputs.pre-warm == 'true' run: | @@ -84,3 +94,8 @@ runs: ${{ inputs.run }} } shell: powershell + - name: docker_logout + id: docker_logout + shell: powershell + run: >- + docker logout ${{ inputs.repository }} From 2ba7a51763188b5a319c181b388b1c9740eea96f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Bouchex=20Bellomi=C3=A9?= Date: Tue, 22 Oct 2024 15:50:22 +0200 Subject: [PATCH 2/5] Added login and logout --- action.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/action.yml b/action.yml index d4898dc..0a1809a 100644 --- a/action.yml +++ b/action.yml @@ -48,6 +48,9 @@ inputs: username: description: 'Docker username.' required: false + auth_token: + description: 'Docker auth_token.' + required: false repository: description: 'Docker repository.' required: false @@ -71,7 +74,7 @@ runs: id: docker_login shell: powershell run: >- - echo ${{ secrets.docker_secret }} | docker login ${{ inputs.repository }} -u ${{ inputs.username }} --password-stdin + echo ${{ inputs.auth_token }} | docker login ${{ inputs.repository }} -u ${{ inputs.username }} --password-stdin - name: Pre-warm if: inputs.pre-warm == 'true' run: | From 0fb5e510ac401f66a31d0e506e43def5b4efc5a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Bouchex=20Bellomi=C3=A9?= Date: Tue, 22 Oct 2024 17:06:44 +0200 Subject: [PATCH 3/5] Added login and logout --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 0a1809a..5d30e55 100644 --- a/action.yml +++ b/action.yml @@ -74,7 +74,7 @@ runs: id: docker_login shell: powershell run: >- - echo ${{ inputs.auth_token }} | docker login ${{ inputs.repository }} -u ${{ inputs.username }} --password-stdin + docker login ${{ inputs.repository }} -u ${{ inputs.username }} -p ${{ inputs.auth_token }} - name: Pre-warm if: inputs.pre-warm == 'true' run: | From 0a2e0287583d05998065e51a2f548a648a7acba3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Bouchex=20Bellomi=C3=A9?= Date: Wed, 23 Oct 2024 08:39:33 +0200 Subject: [PATCH 4/5] Added login and logout --- action.yml | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/action.yml b/action.yml index 5d30e55..fc58f1d 100644 --- a/action.yml +++ b/action.yml @@ -45,14 +45,18 @@ inputs: description: 'Pre warm command to run inside the container' required: false default: 'echo "warming up!"' - username: - description: 'Docker username.' + registry_authentication: + description : 'Authenticate against registry server' + required : false + default: 'false' + registry_username: + description: 'Docker registry username.' required: false - auth_token: - description: 'Docker auth_token.' + registry_token: + description: 'Docker registry token' required: false - repository: - description: 'Docker repository.' + registry_repository: + description: 'Docker registry repository' required: false runs: @@ -72,9 +76,10 @@ runs: shell: powershell - name: docker_login id: docker_login + if: inputs.registry_authentication == 'true' shell: powershell run: >- - docker login ${{ inputs.repository }} -u ${{ inputs.username }} -p ${{ inputs.auth_token }} + docker login ${{ inputs.registry_repository }} -u ${{ inputs.registry_username }} -p ${{ inputs.registry_token }} - name: Pre-warm if: inputs.pre-warm == 'true' run: | @@ -99,6 +104,7 @@ runs: shell: powershell - name: docker_logout id: docker_logout + if: inputs.registry_authentication == 'true' shell: powershell run: >- - docker logout ${{ inputs.repository }} + docker logout ${{ inputs.registry_repository }} From 0939028f4693476e9ba5e41d5c4a0e098440af34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Bouchex=20Bellomi=C3=A9?= Date: Wed, 23 Oct 2024 13:30:22 +0200 Subject: [PATCH 5/5] Added login and logout --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 2597e3e..d1a67e0 100644 --- a/README.md +++ b/README.md @@ -48,6 +48,10 @@ and work path. | extra_args | Extra arguments for docker run command. | `false` | | | pre-warm | Run a warming-up container (which might crash due to first time use failure) | `false` | true | | pre-warm-cmd | Pre warm command to run inside the container | `false` | echo "warming up!" | +| registry_authentication | Enable authentication on the registry server | `false` | `false` +| registry_username | Registry server username | `false` +| registry_token | Registry server token | `false` +| registry_repository | Registry server repository | `false`