SSH resource for Concourse CI
host
: host name of remote machineport
: port of SSH server on remote machine,22
by defaultuser
: user for executing shell script on remote machinepassword
: plain password for user on remote machineprivate_key
: private SSH key for user on remote machine
According to appleboy/easyssh-proxy, if password
and private_key
both exists, password
would be used first, then private_key
.
This is a put
-only resource, check
and in
does nothing.
Execute shell script on remote machine via SSH.
interpreter
: string, path to interpreter on remote machine, e.g./usr/bin/python3
,/bin/sh
by defaultscript
: string, shell script to run on remote machineplaceholders
: Map ofname
and eithervalue
for a static value, orfile
for a dynamic value read from a file. Every string matchesname
in your script defintion will then be replaced by either thevalue
or the content offile
. Iffile
is used, only the first line of file content would be used. Example:
---
- put: myserver
params:
interpreter: /bin/sh
script: |
echo "<MyPlaceHolder>"
echo "|dynamicPlaceHolder|"
placeholders:
- name: "<MyPlaceHolder>"
value: "somevalue"
- name: "|dynamicPlaceHolder|"
file: "myresource/somefile"
---
resource_types:
- name: ssh
type: docker-image
source:
repository: quay.io/henry40408/concourse-ssh-resource
resources:
- name: staging-server
type: ssh
source:
host: 127.0.0.1
user: root
password: ((ssh_password))
jobs:
- name: echo
plan:
# Basic usage
- put: staging-server
params:
interpreter: /usr/bin/env python3
script: |
print("Hello, world!")
# Placeholder usage
- put: staging-server
params:
interpreter: /bin/sh
script: |
echo "<static_value>"
echo "|dynamic_value|"
placeholders:
- name: "<static_value>"
value: "foo"
- name: "|dynamic_value|"
file: "bar"
We need to start a simple SSH server first. I assume there is no SSH server currently running on your laptop or workstation. For more information about the SSH server, please checkout henry40408/alpine-ssh.
docker run -d -p 22:22 quay.io/henry40408/alpine-ssh
make test
sorted in alphabetical order
MIT