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

Fix sshing into macos host #104

Merged
merged 2 commits into from
Sep 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 1 addition & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
if: needs.select_tests_to_run.outputs.run-workstation-test == 'true'
name: Workstation test
needs: select_tests_to_run
timeout-minutes: 120
timeout-minutes: 30
runs-on: macos-12
steps:
- uses: actions/checkout@v1
Expand All @@ -55,8 +55,6 @@ jobs:
- run: brew install docker colima
- run: colima start
- run: docker image ls
- name: Setup tmate session
uses: mxschmitt/action-tmate@v3
- run: bazel run //workstation:test

hypervisor-test:
Expand Down
9 changes: 8 additions & 1 deletion tools/docker/docker.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,20 @@ def docker_load_and_run(name, image, command, docker_args = []):
DOCKER_DIGEST=$$(cat $$DOCKER_DIGEST_FILE)
DOCKER_LOAD_FILE=$$(rlocation $(WORKSPACE_NAME)/$(rootpath {image_label}))

# if CLI_ARGS is set, then add interactive flag
if [[ ! -z "$$CLI_ARGS" ]]; then
DOCKER_INTERACTIVE_ARGS="-it"
else
DOCKER_INTERACTIVE_ARGS=""
fi

if ! docker image inspect $$DOCKER_DIGEST > /dev/null 2>&1 ; then
$$DOCKER_LOAD_FILE
else
echo "Image already exists"
fi

docker run --rm -t {docker_args} $$DOCKER_DIGEST $$ARGS
docker run --rm $$DOCKER_INTERACTIVE_ARGS {docker_args} $$DOCKER_DIGEST $$ARGS
""".format(
command = command,
docker_args = " ".join(docker_args),
Expand Down
5 changes: 4 additions & 1 deletion tools/macos/macos-remote-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,12 @@ fi
# if authorized_keys does not exist, create it
if [ ! -f "$AUTHORIZED_KEYS" ]; then
touch "$AUTHORIZED_KEYS"
chmod 600 "$AUTHORIZED_KEYS"
fi

# Ensure the right permissions are set for SSH
chmod 600 "$AUTHORIZED_KEYS"
chmod 700 "$HOME/.ssh"

# add the public key to the authorized_keys file if it is not already there
if ! grep -q "$(cat $SECRETS_DIR/id_rsa.pub)" $AUTHORIZED_KEYS; then
cat $SECRETS_DIR/id_rsa.pub >> $AUTHORIZED_KEYS
Expand Down