From f3a2d182d8b833e3621c8a104099b2e850ac06a9 Mon Sep 17 00:00:00 2001 From: Jonatan Heyman Date: Thu, 28 Jan 2021 16:22:09 +0100 Subject: [PATCH 1/7] Debug --- entrypoint.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/entrypoint.sh b/entrypoint.sh index c70c448..820921f 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -4,6 +4,8 @@ if [ ! -z $INPUT_USERNAME ]; then echo $INPUT_PASSWORD | docker login $INPUT_REGISTRY -u $INPUT_USERNAME --password-stdin fi +env + echo "$INPUT_RUN" | sed -e 's/\\n/;/g' > semicolon_delimited_script exec docker run -v "/var/run/docker.sock":"/var/run/docker.sock" $INPUT_OPTIONS --entrypoint=$INPUT_SHELL $INPUT_IMAGE -c "`cat semicolon_delimited_script`" From 8bce4aa10a03050401bb0d8831d5ba9ed89a8faa Mon Sep 17 00:00:00 2001 From: Jonatan Heyman Date: Thu, 28 Jan 2021 16:39:33 +0100 Subject: [PATCH 2/7] Add docker_network input --- action.yml | 4 ++++ entrypoint.sh | 1 + 2 files changed, 5 insertions(+) diff --git a/action.yml b/action.yml index 5e10193..5c1fd4f 100644 --- a/action.yml +++ b/action.yml @@ -24,6 +24,10 @@ inputs: password: description: 'Password' required: false + docker_network: + description: 'Docker Network ID' + default: ${{ job.container.network }} + retuired: false runs: using: 'docker' image: 'Dockerfile' diff --git a/entrypoint.sh b/entrypoint.sh index 820921f..ad90d8b 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -5,6 +5,7 @@ then echo $INPUT_PASSWORD | docker login $INPUT_REGISTRY -u $INPUT_USERNAME --pa fi env +docker network ls echo "$INPUT_RUN" | sed -e 's/\\n/;/g' > semicolon_delimited_script From faad629471214a6b26644e3ce76598c2d639e716 Mon Sep 17 00:00:00 2001 From: Jonatan Heyman Date: Thu, 28 Jan 2021 16:44:05 +0100 Subject: [PATCH 3/7] Connect container to github job docker network --- entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/entrypoint.sh b/entrypoint.sh index ad90d8b..ce72884 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -9,4 +9,4 @@ docker network ls echo "$INPUT_RUN" | sed -e 's/\\n/;/g' > semicolon_delimited_script -exec docker run -v "/var/run/docker.sock":"/var/run/docker.sock" $INPUT_OPTIONS --entrypoint=$INPUT_SHELL $INPUT_IMAGE -c "`cat semicolon_delimited_script`" +exec docker run -v "/var/run/docker.sock":"/var/run/docker.sock" --network=$INPUT_DOCKER_NETWORK $INPUT_OPTIONS --entrypoint=$INPUT_SHELL $INPUT_IMAGE -c "`cat semicolon_delimited_script`" From 23e2be876eb917ad164ddc37db6d66fe317d8e7d Mon Sep 17 00:00:00 2001 From: Jonatan Heyman Date: Thu, 28 Jan 2021 16:54:08 +0100 Subject: [PATCH 4/7] Use env variable for docker network id, instead of github action input --- action.yml | 6 ++---- entrypoint.sh | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/action.yml b/action.yml index 5c1fd4f..2dbebce 100644 --- a/action.yml +++ b/action.yml @@ -24,10 +24,8 @@ inputs: password: description: 'Password' required: false - docker_network: - description: 'Docker Network ID' - default: ${{ job.container.network }} - retuired: false runs: using: 'docker' image: 'Dockerfile' + env: + JOB_CONTAINER_NETWORK_ID: ${{ job.container.network }} diff --git a/entrypoint.sh b/entrypoint.sh index ce72884..0dbb387 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -9,4 +9,4 @@ docker network ls echo "$INPUT_RUN" | sed -e 's/\\n/;/g' > semicolon_delimited_script -exec docker run -v "/var/run/docker.sock":"/var/run/docker.sock" --network=$INPUT_DOCKER_NETWORK $INPUT_OPTIONS --entrypoint=$INPUT_SHELL $INPUT_IMAGE -c "`cat semicolon_delimited_script`" +exec docker run -v "/var/run/docker.sock":"/var/run/docker.sock" --network=$JOB_CONTAINER_NETWORK_ID $INPUT_OPTIONS --entrypoint=$INPUT_SHELL $INPUT_IMAGE -c "`cat semicolon_delimited_script`" From a42f5acd327d90a680c43cdabd094ed3a2c392f9 Mon Sep 17 00:00:00 2001 From: Jonatan Heyman Date: Thu, 28 Jan 2021 17:00:10 +0100 Subject: [PATCH 5/7] Revert "Use env variable for docker network id, instead of github action input" This reverts commit 23e2be876eb917ad164ddc37db6d66fe317d8e7d. --- action.yml | 6 ++++-- entrypoint.sh | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/action.yml b/action.yml index 2dbebce..5c1fd4f 100644 --- a/action.yml +++ b/action.yml @@ -24,8 +24,10 @@ inputs: password: description: 'Password' required: false + docker_network: + description: 'Docker Network ID' + default: ${{ job.container.network }} + retuired: false runs: using: 'docker' image: 'Dockerfile' - env: - JOB_CONTAINER_NETWORK_ID: ${{ job.container.network }} diff --git a/entrypoint.sh b/entrypoint.sh index 0dbb387..ce72884 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -9,4 +9,4 @@ docker network ls echo "$INPUT_RUN" | sed -e 's/\\n/;/g' > semicolon_delimited_script -exec docker run -v "/var/run/docker.sock":"/var/run/docker.sock" --network=$JOB_CONTAINER_NETWORK_ID $INPUT_OPTIONS --entrypoint=$INPUT_SHELL $INPUT_IMAGE -c "`cat semicolon_delimited_script`" +exec docker run -v "/var/run/docker.sock":"/var/run/docker.sock" --network=$INPUT_DOCKER_NETWORK $INPUT_OPTIONS --entrypoint=$INPUT_SHELL $INPUT_IMAGE -c "`cat semicolon_delimited_script`" From 3cf4359b928a93743b73f0dc4b10822fdef210aa Mon Sep 17 00:00:00 2001 From: Jonatan Heyman Date: Thu, 28 Jan 2021 17:01:59 +0100 Subject: [PATCH 6/7] Remove debug logging --- entrypoint.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index ce72884..9f7a820 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -4,8 +4,6 @@ if [ ! -z $INPUT_USERNAME ]; then echo $INPUT_PASSWORD | docker login $INPUT_REGISTRY -u $INPUT_USERNAME --password-stdin fi -env -docker network ls echo "$INPUT_RUN" | sed -e 's/\\n/;/g' > semicolon_delimited_script From c0e88e3a9a83f7fcd711152d2c062c7262a82a90 Mon Sep 17 00:00:00 2001 From: Jonatan Heyman Date: Thu, 28 Jan 2021 17:13:38 +0100 Subject: [PATCH 7/7] Remove whitespace change --- entrypoint.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/entrypoint.sh b/entrypoint.sh index 9f7a820..cb62a39 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -4,7 +4,6 @@ if [ ! -z $INPUT_USERNAME ]; then echo $INPUT_PASSWORD | docker login $INPUT_REGISTRY -u $INPUT_USERNAME --password-stdin fi - echo "$INPUT_RUN" | sed -e 's/\\n/;/g' > semicolon_delimited_script exec docker run -v "/var/run/docker.sock":"/var/run/docker.sock" --network=$INPUT_DOCKER_NETWORK $INPUT_OPTIONS --entrypoint=$INPUT_SHELL $INPUT_IMAGE -c "`cat semicolon_delimited_script`"