Compare commits
4 Commits
| Author | SHA1 | Date |
|---|---|---|
|
|
c9b539abea | |
|
|
5aa3c5e8d1 | |
|
|
1e8a5783bc | |
|
|
fed5e4953c |
|
|
@ -24,16 +24,14 @@ jobs:
|
||||||
with:
|
with:
|
||||||
host: ${{ secrets.DC_HOST }}
|
host: ${{ secrets.DC_HOST }}
|
||||||
user: ${{ secrets.DC_USER }}
|
user: ${{ secrets.DC_USER }}
|
||||||
key: ${{ secrets.DC_PASS }}
|
pass: ${{ secrets.DC_PASS }}
|
||||||
port: ${{ secrets.DC_PORT }}
|
port: ${{ secrets.DC_PORT }}
|
||||||
connect_timeout: 10s
|
connect_timeout: 10s
|
||||||
first_ssh: |-
|
first_ssh: |-
|
||||||
rm -rf /home/github/test
|
rm -rf /home/github/test
|
||||||
ls -la
|
ls -la
|
||||||
echo $WELCOME ||
|
echo $WELCOME
|
||||||
ls debug
|
|
||||||
mkdir -p /home/github/test/test1 &&
|
mkdir -p /home/github/test/test1 &&
|
||||||
ls debug
|
|
||||||
mkdir -p /home/github/test/test2 &&
|
mkdir -p /home/github/test/test2 &&
|
||||||
scp: |-
|
scp: |-
|
||||||
'./test/*' => /home/github/test/
|
'./test/*' => /home/github/test/
|
||||||
|
|
|
||||||
9
app.py
9
app.py
|
|
@ -86,10 +86,8 @@ def ssh_process(ssh, input_ssh):
|
||||||
c = path.expandvars(commands[i])
|
c = path.expandvars(commands[i])
|
||||||
if c == "":
|
if c == "":
|
||||||
continue
|
continue
|
||||||
if c.endswith('&&') or c.endswith('||'):
|
if c.endswith('&&') or c.endswith('||') or c.endswith(';'):
|
||||||
c = c[0:-2] if i == (l-1) else c
|
c = c[0:-2] if i == (l-1) else c
|
||||||
elif c.endswith(';'):
|
|
||||||
c = c[0:-1] if i == (l-1) else c
|
|
||||||
else:
|
else:
|
||||||
c = f"{c} &&" if i < (l-1) else c
|
c = f"{c} &&" if i < (l-1) else c
|
||||||
command_str = f"{command_str} {c}"
|
command_str = f"{command_str} {c}"
|
||||||
|
|
@ -98,6 +96,8 @@ def ssh_process(ssh, input_ssh):
|
||||||
|
|
||||||
stdin, stdout, stderr = ssh.exec_command(command_str)
|
stdin, stdout, stderr = ssh.exec_command(command_str)
|
||||||
|
|
||||||
|
ssh_exit_status = stdout.channel.recv_exit_status()
|
||||||
|
|
||||||
out = "".join(stdout.readlines())
|
out = "".join(stdout.readlines())
|
||||||
out = out.strip() if out is not None else None
|
out = out.strip() if out is not None else None
|
||||||
if out:
|
if out:
|
||||||
|
|
@ -107,6 +107,9 @@ def ssh_process(ssh, input_ssh):
|
||||||
err = err.strip() if err is not None else None
|
err = err.strip() if err is not None else None
|
||||||
if err:
|
if err:
|
||||||
print(f"Error: \n{err}")
|
print(f"Error: \n{err}")
|
||||||
|
|
||||||
|
if ssh_exit_status != 0:
|
||||||
|
print(f"ssh exit status: {ssh_exit_status}")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
pass
|
pass
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue