From cc6df245122d9e637afea14f7a2c89e4ca9cf133 Mon Sep 17 00:00:00 2001 From: Samruddhi Khandale Date: Thu, 1 Apr 2021 18:01:24 +0000 Subject: [PATCH 01/29] Custom Container test changes --- .devcontainer/Dockerfile | 4 ++++ .devcontainer/devcontainer.json | 12 ++++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 .devcontainer/Dockerfile diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 0000000..5c4bc05 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,4 @@ +ARG VARIANT=focal +FROM mcr.microsoft.com/vscode/devcontainers/base:${VARIANT} +RUN useradd -ms /bin/bash mock-container +RUN useradd -ms /bin/bash mock-remote \ No newline at end of file diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 80777e0..6c022c1 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,9 +1,17 @@ { - "image": "mcr.microsoft.com/vscode/devcontainers/base:ubuntu", + "build": { + "dockerfile": "Dockerfile", + "args": { "VARIANT": "focal" } + }, "initializeCommand": "touch heythere.txt", "containerEnv": { "MY_LOCAL_HOME": "${localEnv:HOME}", "A_SIMPLE_KEY": "A_SIMPLE_VALUE" }, - "postCreateCommand": "bash ./run-me.sh" + "containerUser": "mock-container", + "remoteUser": "mock-remote", + "postCreateCommand": [ + "bash ./run-me.sh", + "echo `whoami`> whoami.txt" + ] } From 4093e199f3ffb656be8dfa6f32ce5b837790b825 Mon Sep 17 00:00:00 2001 From: Samruddhi Khandale Date: Thu, 1 Apr 2021 18:02:11 +0000 Subject: [PATCH 02/29] formatting --- .devcontainer/devcontainer.json | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 6c022c1..4f928d6 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,17 +1,19 @@ { "build": { - "dockerfile": "Dockerfile", - "args": { "VARIANT": "focal" } - }, + "dockerfile": "Dockerfile", + "args": { + "VARIANT": "focal" + } + }, "initializeCommand": "touch heythere.txt", - "containerEnv": { + "containerEnv": { "MY_LOCAL_HOME": "${localEnv:HOME}", "A_SIMPLE_KEY": "A_SIMPLE_VALUE" }, "containerUser": "mock-container", - "remoteUser": "mock-remote", + "remoteUser": "mock-remote", "postCreateCommand": [ "bash ./run-me.sh", "echo `whoami`> whoami.txt" ] -} +} \ No newline at end of file From 95a0eb63255671f945c30a982964f45b67e7f319 Mon Sep 17 00:00:00 2001 From: Samruddhi Khandale Date: Thu, 1 Apr 2021 18:23:44 +0000 Subject: [PATCH 03/29] fixing postcreate cmd --- .devcontainer/devcontainer.json | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 4f928d6..10ffdfb 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -12,8 +12,5 @@ }, "containerUser": "mock-container", "remoteUser": "mock-remote", - "postCreateCommand": [ - "bash ./run-me.sh", - "echo `whoami`> whoami.txt" - ] + "postCreateCommand": "bash ./run-me.sh && echo `whoami`> whoami.txt", } \ No newline at end of file From 9b166a6aea5c801b7e5fb8fc73f1b116c5c22129 Mon Sep 17 00:00:00 2001 From: Samruddhi Khandale Date: Thu, 1 Apr 2021 18:27:57 +0000 Subject: [PATCH 04/29] fixing post create --- .devcontainer/devcontainer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 10ffdfb..178855f 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -12,5 +12,5 @@ }, "containerUser": "mock-container", "remoteUser": "mock-remote", - "postCreateCommand": "bash ./run-me.sh && echo `whoami`> whoami.txt", + "postCreateCommand": "echo `whoami`> whoami.txt && bash ./run-me.sh", } \ No newline at end of file From 13e30051858b0ff1c951b25c3637af9f0ea71514 Mon Sep 17 00:00:00 2001 From: Samruddhi Khandale Date: Thu, 1 Apr 2021 18:34:41 +0000 Subject: [PATCH 05/29] testing changes --- .devcontainer/devcontainer.json | 2 +- run-me.sh | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 178855f..cfc4c69 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -12,5 +12,5 @@ }, "containerUser": "mock-container", "remoteUser": "mock-remote", - "postCreateCommand": "echo `whoami`> whoami.txt && bash ./run-me.sh", + "postCreateCommand": "bash ./run-me.sh" } \ No newline at end of file diff --git a/run-me.sh b/run-me.sh index 908f5a3..bf488b4 100644 --- a/run-me.sh +++ b/run-me.sh @@ -1,3 +1,4 @@ #!/bin/bash echo -n "I was triggered by the postcreate" >> ./postcreated.txt +echo `whoami`> whoami.txt \ No newline at end of file From 708e09ebfdba4fb77f8f21d09b49cf62e454d743 Mon Sep 17 00:00:00 2001 From: Samruddhi Khandale Date: Thu, 1 Apr 2021 18:37:11 +0000 Subject: [PATCH 06/29] testing changes --- .devcontainer/devcontainer.json | 2 +- run-me.sh | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index cfc4c69..fc5de34 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -12,5 +12,5 @@ }, "containerUser": "mock-container", "remoteUser": "mock-remote", - "postCreateCommand": "bash ./run-me.sh" + "postCreateCommand": "echo `whoami`> whoami.txt && bash ./run-me.sh" } \ No newline at end of file diff --git a/run-me.sh b/run-me.sh index bf488b4..741f072 100644 --- a/run-me.sh +++ b/run-me.sh @@ -1,4 +1,3 @@ #!/bin/bash -echo -n "I was triggered by the postcreate" >> ./postcreated.txt -echo `whoami`> whoami.txt \ No newline at end of file +echo -n "I was triggered by the postcreate" >> ./postcreated.txt \ No newline at end of file From 15a2239d7ab42ab5269348bdee819063c633ed09 Mon Sep 17 00:00:00 2001 From: Josh Spicer Date: Wed, 28 Apr 2021 13:59:44 -0400 Subject: [PATCH 07/29] Update devcontainer.json --- .devcontainer/devcontainer.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index fc5de34..685bf07 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -10,7 +10,6 @@ "MY_LOCAL_HOME": "${localEnv:HOME}", "A_SIMPLE_KEY": "A_SIMPLE_VALUE" }, - "containerUser": "mock-container", "remoteUser": "mock-remote", "postCreateCommand": "echo `whoami`> whoami.txt && bash ./run-me.sh" -} \ No newline at end of file +} From 6d5bc99a489c06243be5aaf51103330226498180 Mon Sep 17 00:00:00 2001 From: Josh Spicer Date: Wed, 28 Apr 2021 14:08:50 -0400 Subject: [PATCH 08/29] Update devcontainer.json --- .devcontainer/devcontainer.json | 1 + 1 file changed, 1 insertion(+) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 685bf07..07976ca 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -11,5 +11,6 @@ "A_SIMPLE_KEY": "A_SIMPLE_VALUE" }, "remoteUser": "mock-remote", + "containerUser": "mock-container", "postCreateCommand": "echo `whoami`> whoami.txt && bash ./run-me.sh" } From 572725ab8847c43dae387fb901020e04f382aaa2 Mon Sep 17 00:00:00 2001 From: David Gardiner Date: Tue, 24 Aug 2021 11:29:23 -0700 Subject: [PATCH 09/29] Update run-me.sh --- run-me.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/run-me.sh b/run-me.sh index 741f072..440fdc0 100644 --- a/run-me.sh +++ b/run-me.sh @@ -1,3 +1,5 @@ #!/bin/bash -echo -n "I was triggered by the postcreate" >> ./postcreated.txt \ No newline at end of file +echo -n "I was triggered by the postcreate" >> ./postcreated.txt +git add ./postcreated.txt +git commit -m "I am a git commit" From 518574f158d7668bb3c29a372428d20f8626e6ee Mon Sep 17 00:00:00 2001 From: David Gardiner Date: Mon, 20 Sep 2021 11:46:40 -0700 Subject: [PATCH 10/29] Update run-me.sh --- run-me.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/run-me.sh b/run-me.sh index 440fdc0..cc0ef10 100644 --- a/run-me.sh +++ b/run-me.sh @@ -2,4 +2,4 @@ echo -n "I was triggered by the postcreate" >> ./postcreated.txt git add ./postcreated.txt -git commit -m "I am a git commit" +git commit -m "I am a git commit" # Don't remove, this will break the GitStatusAsserts! From 67b8029fa20af6b93ad2305ff4240d3abdbbb483 Mon Sep 17 00:00:00 2001 From: Cody Russell Date: Sat, 25 Sep 2021 08:51:54 -0500 Subject: [PATCH 11/29] Print environment to file --- .devcontainer/devcontainer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 07976ca..0ec58f5 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -5,7 +5,7 @@ "VARIANT": "focal" } }, - "initializeCommand": "touch heythere.txt", + "initializeCommand": "touch heythere.txt && printenv > myenv.txt", "containerEnv": { "MY_LOCAL_HOME": "${localEnv:HOME}", "A_SIMPLE_KEY": "A_SIMPLE_VALUE" From d97edf1a4193f35888f5cd16ecf30b17ed283ec7 Mon Sep 17 00:00:00 2001 From: John Keech Date: Tue, 29 Mar 2022 02:49:46 +0000 Subject: [PATCH 12/29] Add ~/.docker to the custom image --- .devcontainer/Dockerfile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 5c4bc05..f5f053d 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,4 +1,8 @@ ARG VARIANT=focal FROM mcr.microsoft.com/vscode/devcontainers/base:${VARIANT} + RUN useradd -ms /bin/bash mock-container -RUN useradd -ms /bin/bash mock-remote \ No newline at end of file +RUN useradd -ms /bin/bash mock-remote + +# Add a pre-existing ~/.docker folder so we can verify the fix for https://github.com/github/codespaces/issues/7185 +RUN mkdir /home/mock-remote/.docker From 0ab58d422421d6ae8f9cb7528b75b2a4bac0130a Mon Sep 17 00:00:00 2001 From: Gideon Kibet Cheruiyot <36052056+GideonCheruiyot@users.noreply.github.com> Date: Tue, 10 May 2022 13:13:44 -0700 Subject: [PATCH 13/29] add onCreate command --- .devcontainer/devcontainer.json | 1 + 1 file changed, 1 insertion(+) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 0ec58f5..d840769 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -10,6 +10,7 @@ "MY_LOCAL_HOME": "${localEnv:HOME}", "A_SIMPLE_KEY": "A_SIMPLE_VALUE" }, + "onCreateCommand": "echo $USER > USER.txt", "remoteUser": "mock-remote", "containerUser": "mock-container", "postCreateCommand": "echo `whoami`> whoami.txt && bash ./run-me.sh" From 43e06cd28534f0662629dc1524f85c3be9478e13 Mon Sep 17 00:00:00 2001 From: Gideon Kibet Cheruiyot <36052056+GideonCheruiyot@users.noreply.github.com> Date: Thu, 1 Sep 2022 07:58:40 -0700 Subject: [PATCH 14/29] add postAttachCommand --- .devcontainer/devcontainer.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index d840769..b8f9880 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -13,5 +13,6 @@ "onCreateCommand": "echo $USER > USER.txt", "remoteUser": "mock-remote", "containerUser": "mock-container", - "postCreateCommand": "echo `whoami`> whoami.txt && bash ./run-me.sh" + "postCreateCommand": "echo `whoami`> whoami.txt && bash ./run-me.sh", + "postAttachCommand": "echo postAttach >> postAttach.txt" } From b9df220d189983611127d12efacc5b76b6122c2d Mon Sep 17 00:00:00 2001 From: Edmundo Gonzalez <51725820+edgonmsft@users.noreply.github.com> Date: Tue, 20 Sep 2022 16:15:08 -0700 Subject: [PATCH 15/29] Update devcontainer.json --- .devcontainer/devcontainer.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index b8f9880..efa3bfb 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -14,5 +14,7 @@ "remoteUser": "mock-remote", "containerUser": "mock-container", "postCreateCommand": "echo `whoami`> whoami.txt && bash ./run-me.sh", - "postAttachCommand": "echo postAttach >> postAttach.txt" + "postAttachCommand": "echo postAttach >> postAttach.txt", + "workspaceFolder": "/app", + "workspaceMount": "/app" } From 2040d69b872a9d3e3f4d993429886a11cea6c660 Mon Sep 17 00:00:00 2001 From: Edmundo Gonzalez <51725820+edgonmsft@users.noreply.github.com> Date: Thu, 22 Sep 2022 10:06:19 -0700 Subject: [PATCH 16/29] Update devcontainer.json --- .devcontainer/devcontainer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index efa3bfb..491bebe 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -16,5 +16,5 @@ "postCreateCommand": "echo `whoami`> whoami.txt && bash ./run-me.sh", "postAttachCommand": "echo postAttach >> postAttach.txt", "workspaceFolder": "/app", - "workspaceMount": "/app" + "workspaceMount" : "source=${localWorkspaceFolder},target=/app,type=bind,consistency=cached" } From 848a67d0f3d75dc2d3b7ce099283e1bf053bac6c Mon Sep 17 00:00:00 2001 From: Edmundo Gonzalez <51725820+edgonmsft@users.noreply.github.com> Date: Thu, 22 Sep 2022 21:14:01 -0700 Subject: [PATCH 17/29] Update devcontainer.json --- .devcontainer/devcontainer.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 491bebe..b9e5348 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -13,6 +13,9 @@ "onCreateCommand": "echo $USER > USER.txt", "remoteUser": "mock-remote", "containerUser": "mock-container", + "onCreateCommand": "echo onCreate >> onCreate.txt && sleep 30", + "updateContentCommand": "echo updateContent >> updateContent.txt && sleep 30", + "waitFor": "onCreateCommand", "postCreateCommand": "echo `whoami`> whoami.txt && bash ./run-me.sh", "postAttachCommand": "echo postAttach >> postAttach.txt", "workspaceFolder": "/app", From 644d78b5199e16ebc7f29d2643d884a1c345aa8a Mon Sep 17 00:00:00 2001 From: Edmundo Gonzalez <51725820+edgonmsft@users.noreply.github.com> Date: Fri, 23 Sep 2022 04:17:19 +0000 Subject: [PATCH 18/29] I am a git commit --- postcreated.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 postcreated.txt diff --git a/postcreated.txt b/postcreated.txt new file mode 100644 index 0000000..1291f66 --- /dev/null +++ b/postcreated.txt @@ -0,0 +1 @@ +I was triggered by the postcreate \ No newline at end of file From e56f7e38b1af7a4da46775c67f07ef4f929bd3a5 Mon Sep 17 00:00:00 2001 From: Edmundo Gonzalez <51725820+edgonmsft@users.noreply.github.com> Date: Thu, 22 Sep 2022 21:18:51 -0700 Subject: [PATCH 19/29] Update devcontainer.json --- .devcontainer/devcontainer.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index b9e5348..22a1912 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -13,9 +13,9 @@ "onCreateCommand": "echo $USER > USER.txt", "remoteUser": "mock-remote", "containerUser": "mock-container", - "onCreateCommand": "echo onCreate >> onCreate.txt && sleep 30", - "updateContentCommand": "echo updateContent >> updateContent.txt && sleep 30", - "waitFor": "onCreateCommand", + "onCreateCommand": "echo onCreate && sleep 30 && echo finishedOnCreate", + "updateContentCommand": "echo updateContent && sleep 30 && finishedUpdateContent", + "waitFor": "updateContentCommand", "postCreateCommand": "echo `whoami`> whoami.txt && bash ./run-me.sh", "postAttachCommand": "echo postAttach >> postAttach.txt", "workspaceFolder": "/app", From d4de89f788d08b1973b293af3d1795d340f86592 Mon Sep 17 00:00:00 2001 From: Edmundo Gonzalez <51725820+edgonmsft@users.noreply.github.com> Date: Fri, 23 Sep 2022 04:25:14 +0000 Subject: [PATCH 20/29] I am a git commit --- postcreated.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/postcreated.txt b/postcreated.txt index 1291f66..79053c4 100644 --- a/postcreated.txt +++ b/postcreated.txt @@ -1 +1 @@ -I was triggered by the postcreate \ No newline at end of file +I was triggered by the postcreateI was triggered by the postcreate \ No newline at end of file From 82216888592e45f760af276f96aa4302b6d806ce Mon Sep 17 00:00:00 2001 From: Edmundo Gonzalez <51725820+edgonmsft@users.noreply.github.com> Date: Fri, 23 Sep 2022 04:26:08 +0000 Subject: [PATCH 21/29] Fix --- .devcontainer/devcontainer.json | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 22a1912..d25505c 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -10,12 +10,11 @@ "MY_LOCAL_HOME": "${localEnv:HOME}", "A_SIMPLE_KEY": "A_SIMPLE_VALUE" }, - "onCreateCommand": "echo $USER > USER.txt", "remoteUser": "mock-remote", "containerUser": "mock-container", "onCreateCommand": "echo onCreate && sleep 30 && echo finishedOnCreate", - "updateContentCommand": "echo updateContent && sleep 30 && finishedUpdateContent", - "waitFor": "updateContentCommand", + "updateContentCommand": "echo updateContent && sleep 30 && echo finishedUpdateContent", + "waitFor": "onCreateCommand", "postCreateCommand": "echo `whoami`> whoami.txt && bash ./run-me.sh", "postAttachCommand": "echo postAttach >> postAttach.txt", "workspaceFolder": "/app", From d4466d6c8ccc2d04eabccf64819a24c9f427be3a Mon Sep 17 00:00:00 2001 From: Edmundo Gonzalez <51725820+edgonmsft@users.noreply.github.com> Date: Fri, 23 Sep 2022 10:11:48 -0700 Subject: [PATCH 22/29] Update devcontainer.json --- .devcontainer/devcontainer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index d25505c..c22e484 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -14,7 +14,7 @@ "containerUser": "mock-container", "onCreateCommand": "echo onCreate && sleep 30 && echo finishedOnCreate", "updateContentCommand": "echo updateContent && sleep 30 && echo finishedUpdateContent", - "waitFor": "onCreateCommand", + "waitFor": "postCreateCommand", "postCreateCommand": "echo `whoami`> whoami.txt && bash ./run-me.sh", "postAttachCommand": "echo postAttach >> postAttach.txt", "workspaceFolder": "/app", From d8215ea274e53cc47337a1970faf38843ab853ed Mon Sep 17 00:00:00 2001 From: Edmundo Gonzalez <51725820+edgonmsft@users.noreply.github.com> Date: Mon, 26 Sep 2022 14:59:22 -0700 Subject: [PATCH 23/29] Delete postcreated.txt --- postcreated.txt | 1 - 1 file changed, 1 deletion(-) delete mode 100644 postcreated.txt diff --git a/postcreated.txt b/postcreated.txt deleted file mode 100644 index 79053c4..0000000 --- a/postcreated.txt +++ /dev/null @@ -1 +0,0 @@ -I was triggered by the postcreateI was triggered by the postcreate \ No newline at end of file From 143c7ac15804fae83cb508be7b9180ab327cf110 Mon Sep 17 00:00:00 2001 From: Edmundo Gonzalez <51725820+edgonmsft@users.noreply.github.com> Date: Mon, 26 Sep 2022 15:05:10 -0700 Subject: [PATCH 24/29] Update devcontainer.json --- .devcontainer/devcontainer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index c22e484..bdd000d 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -12,8 +12,8 @@ }, "remoteUser": "mock-remote", "containerUser": "mock-container", - "onCreateCommand": "echo onCreate && sleep 30 && echo finishedOnCreate", - "updateContentCommand": "echo updateContent && sleep 30 && echo finishedUpdateContent", + "onCreateCommand": "echo onCreate && sleep 2 && echo $USER > USER.txt", + "updateContentCommand": "echo updateContent && sleep 2 && echo finishedUpdateContent", "waitFor": "postCreateCommand", "postCreateCommand": "echo `whoami`> whoami.txt && bash ./run-me.sh", "postAttachCommand": "echo postAttach >> postAttach.txt", From 7a263b3eac4a642046e0db5128bbee0ab7ff2143 Mon Sep 17 00:00:00 2001 From: Edmundo Gonzalez Date: Fri, 30 Sep 2022 11:35:22 -0700 Subject: [PATCH 25/29] Update devcontainer.json --- .devcontainer/devcontainer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index bdd000d..a2ab2c9 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -14,7 +14,7 @@ "containerUser": "mock-container", "onCreateCommand": "echo onCreate && sleep 2 && echo $USER > USER.txt", "updateContentCommand": "echo updateContent && sleep 2 && echo finishedUpdateContent", - "waitFor": "postCreateCommand", + "waitFor": "onCreateCommand", "postCreateCommand": "echo `whoami`> whoami.txt && bash ./run-me.sh", "postAttachCommand": "echo postAttach >> postAttach.txt", "workspaceFolder": "/app", From 2b8ded12482e371027b0c90d4efdc2e6688ecb8f Mon Sep 17 00:00:00 2001 From: David Gardiner Date: Fri, 16 Dec 2022 08:03:38 -0800 Subject: [PATCH 26/29] Add remoteEnv --- .devcontainer/devcontainer.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index a2ab2c9..c3b9997 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -10,6 +10,10 @@ "MY_LOCAL_HOME": "${localEnv:HOME}", "A_SIMPLE_KEY": "A_SIMPLE_VALUE" }, + "remoteEnv": { + "PATH": "/test/path:${containerEnv:PATH}", + "TEST_REMOTE_ENV": "test" + }, "remoteUser": "mock-remote", "containerUser": "mock-container", "onCreateCommand": "echo onCreate && sleep 2 && echo $USER > USER.txt", From 0066c21d3b57cd7f72c456de2f92294d29c225a1 Mon Sep 17 00:00:00 2001 From: David Gardiner Date: Fri, 6 Jan 2023 19:28:28 +0000 Subject: [PATCH 27/29] Create python gRPC client for testing --- grpc-client/client.py | 12 ++++++ grpc-client/install_dependenices.sh | 3 ++ grpc-client/proto_pb2.py | 29 +++++++++++++ grpc-client/proto_pb2.pyi | 15 +++++++ grpc-client/proto_pb2_grpc.py | 66 +++++++++++++++++++++++++++++ 5 files changed, 125 insertions(+) create mode 100644 grpc-client/client.py create mode 100755 grpc-client/install_dependenices.sh create mode 100644 grpc-client/proto_pb2.py create mode 100644 grpc-client/proto_pb2.pyi create mode 100644 grpc-client/proto_pb2_grpc.py diff --git a/grpc-client/client.py b/grpc-client/client.py new file mode 100644 index 0000000..a0462d1 --- /dev/null +++ b/grpc-client/client.py @@ -0,0 +1,12 @@ +import grpc +import proto_pb2 +import proto_pb2_grpc + +print("Starting client and sending request...") + +with grpc.insecure_channel('unix:///workspaces/.codespaces/shared/cs-agent.sock') as channel: + stub = proto_pb2_grpc.CodespaceHostStub(channel) + metadata = (('Authorization', 'Bearer token')) + response = stub.ExportLogsAsync(proto_pb2.ExportLogsRequest(), metadata=(('authorization','Bearer token'),)) + +print("Logs file path: " + response.FilePath) \ No newline at end of file diff --git a/grpc-client/install_dependenices.sh b/grpc-client/install_dependenices.sh new file mode 100755 index 0000000..0cae2bc --- /dev/null +++ b/grpc-client/install_dependenices.sh @@ -0,0 +1,3 @@ +apt update +apt install -y python3-pip +pip3 install grpcio grpcio-tools \ No newline at end of file diff --git a/grpc-client/proto_pb2.py b/grpc-client/proto_pb2.py new file mode 100644 index 0000000..5768dce --- /dev/null +++ b/grpc-client/proto_pb2.py @@ -0,0 +1,29 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: proto.proto +"""Generated protocol buffer code.""" +from google.protobuf.internal import builder as _builder +from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import symbol_database as _symbol_database +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + + + +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x0bproto.proto\x12\'Codespaces.Grpc.CodespaceHostService.v1\"\x13\n\x11\x45xportLogsRequest\"&\n\x12\x45xportLogsResponse\x12\x10\n\x08\x46ilePath\x18\x01 \x01(\t2\x9c\x01\n\rCodespaceHost\x12\x8a\x01\n\x0f\x45xportLogsAsync\x12:.Codespaces.Grpc.CodespaceHostService.v1.ExportLogsRequest\x1a;.Codespaces.Grpc.CodespaceHostService.v1.ExportLogsResponseb\x06proto3') + +_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, globals()) +_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'proto_pb2', globals()) +if _descriptor._USE_C_DESCRIPTORS == False: + + DESCRIPTOR._options = None + _EXPORTLOGSREQUEST._serialized_start=56 + _EXPORTLOGSREQUEST._serialized_end=75 + _EXPORTLOGSRESPONSE._serialized_start=77 + _EXPORTLOGSRESPONSE._serialized_end=115 + _CODESPACEHOST._serialized_start=118 + _CODESPACEHOST._serialized_end=274 +# @@protoc_insertion_point(module_scope) diff --git a/grpc-client/proto_pb2.pyi b/grpc-client/proto_pb2.pyi new file mode 100644 index 0000000..de5ece5 --- /dev/null +++ b/grpc-client/proto_pb2.pyi @@ -0,0 +1,15 @@ +from google.protobuf import descriptor as _descriptor +from google.protobuf import message as _message +from typing import ClassVar as _ClassVar, Optional as _Optional + +DESCRIPTOR: _descriptor.FileDescriptor + +class ExportLogsRequest(_message.Message): + __slots__ = [] + def __init__(self) -> None: ... + +class ExportLogsResponse(_message.Message): + __slots__ = ["FilePath"] + FILEPATH_FIELD_NUMBER: _ClassVar[int] + FilePath: str + def __init__(self, FilePath: _Optional[str] = ...) -> None: ... diff --git a/grpc-client/proto_pb2_grpc.py b/grpc-client/proto_pb2_grpc.py new file mode 100644 index 0000000..56a3ca5 --- /dev/null +++ b/grpc-client/proto_pb2_grpc.py @@ -0,0 +1,66 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" +import grpc + +import proto_pb2 as proto__pb2 + + +class CodespaceHostStub(object): + """Missing associated documentation comment in .proto file.""" + + def __init__(self, channel): + """Constructor. + + Args: + channel: A grpc.Channel. + """ + self.ExportLogsAsync = channel.unary_unary( + '/Codespaces.Grpc.CodespaceHostService.v1.CodespaceHost/ExportLogsAsync', + request_serializer=proto__pb2.ExportLogsRequest.SerializeToString, + response_deserializer=proto__pb2.ExportLogsResponse.FromString, + ) + + +class CodespaceHostServicer(object): + """Missing associated documentation comment in .proto file.""" + + def ExportLogsAsync(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + +def add_CodespaceHostServicer_to_server(servicer, server): + rpc_method_handlers = { + 'ExportLogsAsync': grpc.unary_unary_rpc_method_handler( + servicer.ExportLogsAsync, + request_deserializer=proto__pb2.ExportLogsRequest.FromString, + response_serializer=proto__pb2.ExportLogsResponse.SerializeToString, + ), + } + generic_handler = grpc.method_handlers_generic_handler( + 'Codespaces.Grpc.CodespaceHostService.v1.CodespaceHost', rpc_method_handlers) + server.add_generic_rpc_handlers((generic_handler,)) + + + # This class is part of an EXPERIMENTAL API. +class CodespaceHost(object): + """Missing associated documentation comment in .proto file.""" + + @staticmethod + def ExportLogsAsync(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/Codespaces.Grpc.CodespaceHostService.v1.CodespaceHost/ExportLogsAsync', + proto__pb2.ExportLogsRequest.SerializeToString, + proto__pb2.ExportLogsResponse.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) From 0ce28158041b0938eef37609f813fe153d713a52 Mon Sep 17 00:00:00 2001 From: David Gardiner Date: Fri, 6 Jan 2023 12:13:37 -0800 Subject: [PATCH 28/29] Fix file name --- .../{install_dependenices.sh => install_dependencies.sh} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename grpc-client/{install_dependenices.sh => install_dependencies.sh} (53%) diff --git a/grpc-client/install_dependenices.sh b/grpc-client/install_dependencies.sh similarity index 53% rename from grpc-client/install_dependenices.sh rename to grpc-client/install_dependencies.sh index 0cae2bc..65c6c84 100755 --- a/grpc-client/install_dependenices.sh +++ b/grpc-client/install_dependencies.sh @@ -1,3 +1,3 @@ apt update apt install -y python3-pip -pip3 install grpcio grpcio-tools \ No newline at end of file +pip3 install grpcio grpcio-tools From 4e5b2939721805787f2d3606bf87f885bbdd8103 Mon Sep 17 00:00:00 2001 From: Eljo George Date: Thu, 10 Aug 2023 17:48:12 -0700 Subject: [PATCH 29/29] Pin to a working version of grpcio and grpcio-tools Pin to a working version of grpcio and grpcio-tools to prevent the following error. [X] Exit Code 1 -> docker exec CustomContainerTest-compute docker exec -u root e620d61c34a3 bash -c 'python3 /workspaces/cs-examples/grpc-client/client.py' stdout:: Starting client and sending request... stderr:: Traceback (most recent call last): File "/workspaces/cs-examples/grpc-client/client.py", line 10, in response = stub.ExportLogsAsync(proto_pb2.ExportLogsRequest(), metadata=(('authorization','Bearer token'),)) File "/usr/local/lib/python3.8/dist-packages/grpc/_channel.py", line 1161, in __call__ return _end_unary_response_blocking(state, call, False, None) File "/usr/local/lib/python3.8/dist-packages/grpc/_channel.py", line 1004, in _end_unary_response_blocking raise _InactiveRpcError(state) # pytype: disable=not-instantiable grpc._channel._InactiveRpcError: <_InactiveRpcError of RPC that terminated with: status = StatusCode.INTERNAL details = "Received RST_STREAM with error code 1" debug_error_string = "UNKNOWN:Error received from peer {grpc_message:"Received RST_STREAM with error code 1", grpc_status:13, created_time:"2023-08-11T00:25:34.808657353+00:00"}" > --- grpc-client/install_dependencies.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grpc-client/install_dependencies.sh b/grpc-client/install_dependencies.sh index 65c6c84..13b09cd 100755 --- a/grpc-client/install_dependencies.sh +++ b/grpc-client/install_dependencies.sh @@ -1,3 +1,3 @@ apt update apt install -y python3-pip -pip3 install grpcio grpcio-tools +pip3 install grpcio==1.56.2 grpcio-tools==1.56.2