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

PR for clone test #1

Open
wants to merge 35 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
cc6df24
Custom Container test changes
samruddhikhandale Apr 1, 2021
4093e19
formatting
samruddhikhandale Apr 1, 2021
95a0eb6
fixing postcreate cmd
samruddhikhandale Apr 1, 2021
9b166a6
fixing post create
samruddhikhandale Apr 1, 2021
13e3005
testing changes
samruddhikhandale Apr 1, 2021
708e09e
testing changes
samruddhikhandale Apr 1, 2021
15a2239
Update devcontainer.json
joshspicer Apr 28, 2021
6d5bc99
Update devcontainer.json
joshspicer Apr 28, 2021
572725a
Update run-me.sh
dmgardiner25 Aug 24, 2021
fa096d1
Merge pull request #2 from dmgardiner25/patch-2
dmgardiner25 Aug 24, 2021
518574f
Update run-me.sh
dmgardiner25 Sep 20, 2021
67b8029
Print environment to file
bratsche Sep 25, 2021
cbaaafe
Merge pull request #4 from bratsche/devcontainer
joshspicer Oct 8, 2021
d97edf1
Add ~/.docker to the custom image
jkeech Mar 29, 2022
c5ad166
Merge pull request #6 from vsls-contrib/jkeech/docker-config-in-devco…
jkeech Mar 29, 2022
0ab58d4
add onCreate command
GideonCheruiyot May 10, 2022
43e06cd
add postAttachCommand
GideonCheruiyot Sep 1, 2022
0de4d78
Merge pull request #7 from vsls-contrib/gicherui/addpostattachcommand
GideonCheruiyot Sep 1, 2022
b9df220
Update devcontainer.json
edgonmsft Sep 20, 2022
2040d69
Update devcontainer.json
edgonmsft Sep 22, 2022
848a67d
Update devcontainer.json
edgonmsft Sep 23, 2022
644d78b
I am a git commit
edgonmsft Sep 23, 2022
e56f7e3
Update devcontainer.json
edgonmsft Sep 23, 2022
09f7af7
Merge branch 'devcontainer' of https://github.com/edgonmsft/cs-exampl…
edgonmsft Sep 23, 2022
d4de89f
I am a git commit
edgonmsft Sep 23, 2022
8221688
Fix
edgonmsft Sep 23, 2022
d4466d6
Update devcontainer.json
edgonmsft Sep 23, 2022
d8215ea
Delete postcreated.txt
edgonmsft Sep 26, 2022
143c7ac
Update devcontainer.json
edgonmsft Sep 26, 2022
7a263b3
Update devcontainer.json
edgonmsft Sep 30, 2022
24dadce
Merge pull request #8 from edgonmsft/devcontainer
edgonmsft Oct 5, 2022
2b8ded1
Add remoteEnv
dmgardiner25 Dec 16, 2022
0066c21
Create python gRPC client for testing
dmgardiner25 Jan 6, 2023
0ce2815
Fix file name
dmgardiner25 Jan 6, 2023
4e5b293
Pin to a working version of grpcio and grpcio-tools
eljog Aug 11, 2023
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
8 changes: 8 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +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

# 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
25 changes: 21 additions & 4 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,26 @@
{
"image": "mcr.microsoft.com/vscode/devcontainers/base:ubuntu",
"initializeCommand": "touch heythere.txt",
"containerEnv": {
"build": {
"dockerfile": "Dockerfile",
"args": {
"VARIANT": "focal"
}
},
"initializeCommand": "touch heythere.txt && printenv > myenv.txt",
"containerEnv": {
"MY_LOCAL_HOME": "${localEnv:HOME}",
"A_SIMPLE_KEY": "A_SIMPLE_VALUE"
},
"postCreateCommand": "bash ./run-me.sh"
"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",
"updateContentCommand": "echo updateContent && sleep 2 && echo finishedUpdateContent",
"waitFor": "onCreateCommand",
"postCreateCommand": "echo `whoami`> whoami.txt && bash ./run-me.sh",
"postAttachCommand": "echo postAttach >> postAttach.txt",
"workspaceFolder": "/app",
"workspaceMount" : "source=${localWorkspaceFolder},target=/app,type=bind,consistency=cached"
}
12 changes: 12 additions & 0 deletions grpc-client/client.py
Original file line number Diff line number Diff line change
@@ -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)
3 changes: 3 additions & 0 deletions grpc-client/install_dependencies.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
apt update
apt install -y python3-pip
pip3 install grpcio==1.56.2 grpcio-tools==1.56.2
29 changes: 29 additions & 0 deletions grpc-client/proto_pb2.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions grpc-client/proto_pb2.pyi
Original file line number Diff line number Diff line change
@@ -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: ...
66 changes: 66 additions & 0 deletions grpc-client/proto_pb2_grpc.py
Original file line number Diff line number Diff line change
@@ -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)
2 changes: 2 additions & 0 deletions run-me.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/bin/bash

echo -n "I was triggered by the postcreate" >> ./postcreated.txt
git add ./postcreated.txt
git commit -m "I am a git commit" # Don't remove, this will break the GitStatusAsserts!