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

review pr 124 #1

Merged
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
30 changes: 30 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# http://editorconfig.org

root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

[*.{py,rst,ini}]
indent_style = space
indent_size = 4

[*.{html,css,scss,json,yml,xml}]
indent_style = space
indent_size = 2

[*.md]
trim_trailing_whitespace = false

[default.conf]
indent_style = space
indent_size = 2

["Makefile"]
indent_style = tab

[*.{diff,patch}]
trim_trailing_whitespace = false
2 changes: 1 addition & 1 deletion .makim.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -475,4 +475,4 @@ groups:
run: |
# it requires the password manually
ssh-keygen -R "[localhost]:2222" || true
ssh -o StrictHostKeyChecking=no testuser@localhost -p 2222
ssh -o StrictHostKeyChecking=no testuser@localhost -p 2222 'pwd'
8 changes: 6 additions & 2 deletions src/makim/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,10 +186,14 @@ def _call_shell_remote(self, cmd: str, host_config: Any) -> None:
port=host_config.get('port', 22),
)

stdin, stdout, stderr = ssh.exec_command(cmd)
stdin, stdout, stderr = ssh.exec_command(
cmd, environment=os.environ
)

if self.verbose:
MakimLogs.print_info(stdout.read().decode('utf-8'))
MakimLogs.print_info(cmd)

MakimLogs.print_info(stdout.read().decode('utf-8'))

error = stderr.read().decode('utf-8')
if error:
Expand Down
22 changes: 17 additions & 5 deletions tests/smoke/.makim-ssh.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,40 @@ hosts:
port: 2222
user: testuser
password: testpassword
backend: bash
groups:
docker:
help: Tasks with docker
tasks:
build:
help: Build the dockerfile for ssh tests
dir: containers
run: docker build -t ssh-test .

start:
help: Start a service from the dockerfile for ssh tests
dir: containers
hooks:
pre-run:
- task: docker.build
run: docker run -d -p 2222:22 --rm ssh-test
run: docker run -d -p 2222:22 --rm --name ssh-test ssh-test

build:
help: Build the dockerfile for ssh tests
stop:
help: Start a service from the dockerfile for ssh tests
dir: containers
run: docker build -t ssh-test .
env:
DOCKER_BUILDKIT: "0"
run: docker stop ssh-test

remote_test:
tasks:
echo_test:
hooks:
pre-run:
- task: docker.start
post-run:
- task: docker.stop
remote: test_container
run: echo "Hello from remote host"
run: |
hostname
pwd