GithubHelp home page GithubHelp logo

henry40408 / concourse-ssh-resource Goto Github PK

View Code? Open in Web Editor NEW
13.0 4.0 9.0 622 KB

SSH resource for Concourse CI

License: MIT License

Makefile 2.69% Go 95.38% Shell 1.93%
concourse-ci concourse-ci-resource ssh quay docker

concourse-ssh-resource's Introduction

Concourse SSH Resource

CircleCI codecov goreportcard Docker Repository on Quay GitHub release license stability-stable

SSH resource for Concourse CI

Source Configuration

  • host: host name of remote machine
  • port: port of SSH server on remote machine, 22 by default
  • user: user for executing shell script on remote machine
  • password: plain password for user on remote machine
  • private_key: private SSH key for user on remote machine

Caveats

According to appleboy/easyssh-proxy, if password and private_key both exists, password would be used first, then private_key.

Behavior

This is a put-only resource, check and in does nothing.

out: Run commands via SSH

Execute shell script on remote machine via SSH.

Parameters

  • interpreter: string, path to interpreter on remote machine, e.g. /usr/bin/python3, /bin/sh by default
  • script: string, shell script to run on remote machine
  • placeholders: Map of name and either value for a static value, or file for a dynamic value read from a file. Every string matches name in your script defintion will then be replaced by either the value or the content of file. If file 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"

Examples

---
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"

How to Test

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.

  1. docker run -d -p 22:22 quay.io/henry40408/alpine-ssh
  2. make test

Contributors

sorted in alphabetical order

License

MIT

concourse-ssh-resource's People

Contributors

eugenmayer avatar henry40408 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

concourse-ssh-resource's Issues

Pretty awesome!

Just a heads up, very nice resource. Thank you for sharing

Is it possible to specify shell script file at script part ?

Hello. I have a question.
Is it possible to specify shell script file at script part ?

If there is some method to specify, let me know how to do it.
Because I want to share script reusable in some pipeline.

jobs:
- name: echo
  plan:
  - put: staging-server
    params:
      interpreter: /bin/bash
      script: 
        path/to/somescript.sh  # <= this line

time out

Hello, I'm trying to use this resource to do a database backup by calling a script. This script takes longer than 10 minutes to run. Is there a way to make the time out a parameter ? or have time limit be reset with stdout ?

Thanks

Any plans on offering placeholders?

Sometimes you need placeholders / parameters in your SSH tasks.

Are you interested in implemented placeholder1, placeholder2, placeholder3 which are then useable in the command, readed from a file ( like an input ) ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.