Skip to content

Commit

Permalink
Merge pull request #1 from xmnlab/review-pr-124
Browse files Browse the repository at this point in the history
review pr 124
  • Loading branch information
abhijeetSaroha authored Oct 29, 2024
2 parents 1f25f2b + 76c3091 commit 93e4cfc
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 8 deletions.
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

0 comments on commit 93e4cfc

Please sign in to comment.