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

executor/ssh: introduce TIUP_SSH_PATH,TIUP_SCP_PATH #734

Merged
merged 6 commits into from
Sep 4, 2020

Conversation

9547
Copy link
Contributor

@9547 9547 commented Aug 31, 2020

What problem does this PR solve?

#711

What is changed and how it works?

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code

Code changes

  • Has exported function/method change
  • Has exported variable/fields change
  • Has interface methods change
  • Has persistent data change

Side effects

  • Possible performance regression
  • Increased code complexity
  • Breaking backward compatibility

Related changes

  • Need to cherry-pick to the release branch
  • Need to update the documentation

Release notes:

NONE

@CLAassistant
Copy link

CLAassistant commented Aug 31, 2020

CLA assistant check
All committers have signed the CLA.

@9547
Copy link
Contributor Author

9547 commented Aug 31, 2020

@lucklove PTAL

pkg/cluster/executor/ssh.go Outdated Show resolved Hide resolved
pkg/cluster/executor/ssh.go Outdated Show resolved Hide resolved
@lucklove
Copy link
Member

lucklove commented Sep 1, 2020

BTW, the integrate tests failed, seems caused by this PR, all tests with --native-ssh flag failed

pkg/cluster/executor/ssh.go Outdated Show resolved Hide resolved
pkg/cluster/executor/ssh.go Outdated Show resolved Hide resolved
pkg/localdata/constant.go Outdated Show resolved Hide resolved
@9547
Copy link
Contributor Author

9547 commented Sep 1, 2020

BTW, the integrate tests failed, seems caused by this PR, all tests with --native-ssh flag failed

Seems all failed to command-line line 0: missing argument. Could you give me some points, where I'm missing?

@lucklove
Copy link
Member

lucklove commented Sep 2, 2020

IMO, the biggest challenge for you is that you can't check the error log.

There always been an error message such as Verbose debug logs has been written to /tiup-cluster/tests/tiup-dm/logs/tiup-cluster-debug-2020-09-01-18-15-18.log. but you just can't get /tiup-cluster/tests/tiup-dm/logs/tiup-cluster-debug-2020-09-01-18-15-18.log because it's in github CI.

So you can try to reproduce that in your local host:

# the first step is to build the integrate env
cd tiup/docker
./up.sh --daemon --dev --compose ./docker-compose.dm.yml

# then get into the control node
docker exec -it tiup-cluster-control /bin/sh

# and replay the failed case, eg: dm --native-ssh --do-cases test_cmd
bash /tiup-cluster/tests/tiup-dm/run.sh --native-ssh --do-cases test_cmd

Then you can get the error log (if the bug can be reproduced):
屏幕快照 2020-09-02 上午11 34 18

I found that the last error log is:

2020-09-02T03:33:07.686Z        INFO    Execute command finished        {"code": 1, "error": "task.env_init.failed: Failed to initialize TiDB environment on remote host '172.19.0.101', cause: module.user.user_add_failed: Failed to create new system user 'tidb' on remote host, cause: executor.ssh.execute_failed: Failed to execute command over SSH for 'root@172.19.0.101:22' {ssh_stderr: command-line line 0: missing argument.\r\n, ssh_stdout: , ssh_command: export LANG=C; PATH=$PATH:/usr/bin:/usr/sbin sudo -H bash -c \"id -u tidb > /dev/null 2>&1 || (/usr/sbin/groupadd -f tidb && /usr/sbin/useradd -m -s /bin/bash -g tidb tidb) && echo 'tidb ALL=(ALL) NOPASSWD:ALL' > /etc/sudoers.d/tidb\"}, cause: exit status 255", "errorVerbose": "task.env_init.failed: Failed to initialize TiDB environment on remote host '172.19.0.101', cause: module.user.user_add_failed: Failed to create new system user 'tidb' on remote host, cause: executor.ssh.execute_failed: Failed to execute command over SSH for 'root@172.19.0.101:22' {ssh_stderr: command-line line 0: missing argument.\r\n, ssh_stdout: , ssh_command: export LANG=C; PATH=$PATH:/usr/bin:/usr/sbin sudo -H bash -c \"id -u tidb > /dev/null 2>&1 || (/usr/sbin/groupadd -f tidb && /usr/sbin/useradd -m -s /bin/bash -g tidb tidb) && echo 'tidb ALL=(ALL) NOPASSWD:ALL' > /etc/sudoers.d/tidb\"}, cause: exit status 255\n at github.com/pingcap/tiup/pkg/cluster/executor.(*NativeSSHExecutor).Execute()\n\t/Users/joshua/Desktop/Code/tiup/pkg/cluster/executor/ssh.go:337\n at github.com/pingcap/tiup/pkg/cluster/module.(*UserModule).Execute()\n\t/Users/joshua/Desktop/Code/tiup/pkg/cluster/module/user.go:126\n at github.com/pingcap/tiup/pkg/cluster/task.(*EnvInit).execute()\n\t/Users/joshua/Desktop/Code/tiup/pkg/cluster/task/env_init.go:67\n at github.com/pingcap/tiup/pkg/cluster/task.(*EnvInit).Execute()\n\t/Users/joshua/Desktop/Code/tiup/pkg/cluster/task/env_init.go:46\n at github.com/pingcap/tiup/pkg/cluster/task.(*Serial).Execute()\n\t/Users/joshua/Desktop/Code/tiup/pkg/cluster/task/task.go:189\n at github.com/pingcap/tiup/pkg/cluster/task.(*StepDisplay).Execute()\n\t/Users/joshua/Desktop/Code/tiup/pkg/cluster/task/step.go:85\n at github.com/pingcap/tiup/pkg/cluster/task.(*Parallel).Execute.func1()\n\t/Users/joshua/Desktop/Code/tiup/pkg/cluster/task/task.go:242\n at runtime.goexit()\n\t/Users/joshua/Desktop/Code/go-darwin-amd64-bootstrap/src/runtime/asm_amd64.s:1374"}

However, I have no ideal why it report this now, because I can execute

export LANG=C; PATH=$PATH:/usr/bin:/usr/sbin sudo -H bash -c \"id -u tidb > /dev/null 2>&1 || (/usr/sbin/groupadd -f tidb && /usr/sbin/useradd -m -s /bin/bash -g tidb tidb) && echo 'tidb ALL=(ALL) NOPASSWD:ALL' > /etc/sudoers.d/tidb

on 172.19.0.101 successfully

@9547
Copy link
Contributor Author

9547 commented Sep 2, 2020

@lucklove thank you for the way to create the integrate env, I can reproduce it locally, and I'll
fix ASAP

@lucklove lucklove added this to the v1.2.0 milestone Sep 2, 2020
@codecov-commenter
Copy link

codecov-commenter commented Sep 3, 2020

Codecov Report

Merging #734 into master will decrease coverage by 0.04%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #734      +/-   ##
==========================================
- Coverage   58.07%   58.03%   -0.05%     
==========================================
  Files         255      255              
  Lines       18904    18919      +15     
==========================================
+ Hits        10978    10979       +1     
- Misses       6473     6482       +9     
- Partials     1453     1458       +5     
Flag Coverage Δ
#coverage 58.03% <ø> (-0.05%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...ithub.com/pingcap/tiup/pkg/cluster/executor/ssh.go 63.05% <0.00%> (-2.24%) ⬇️
...c/github.com/pingcap/tiup/pkg/cluster/api/pdapi.go 53.65% <0.00%> (-1.83%) ⬇️
go/src/github.com/pingcap/tiup/pkg/utils/ioutil.go 49.60% <0.00%> (+0.42%) ⬆️
...c/github.com/pingcap/tiup/pkg/cluster/api/dmapi.go 62.77% <0.00%> (+1.45%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 760091f...f89b8db. Read the comment docs.

pkg/cluster/executor/ssh.go Outdated Show resolved Hide resolved
pkg/cluster/executor/ssh.go Outdated Show resolved Hide resolved
Copy link
Contributor

@lonng lonng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rest LGTM

@9547 9547 changed the title executor/ssh: introduce TIUP_NATIVE_SSH_PATH,TIUP_NATIVE_SCP_PATH executor/ssh: introduce TIUP_SSH_PATH,TIUP_SCP_PATH Sep 3, 2020
Copy link
Contributor

@lonng lonng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ti-srebot ti-srebot added the status/LGT1 Indicates that a PR has LGTM 1. label Sep 3, 2020
@lucklove lucklove merged commit f645c99 into pingcap:master Sep 4, 2020
@9547 9547 deleted the feature/ssh-path branch September 4, 2020 07:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status/LGT1 Indicates that a PR has LGTM 1.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants