Skip to content
This repository was archived by the owner on Sep 18, 2024. It is now read-only.

Commit

Permalink
Initial commit of extracted Rundeck versions of JSCH Node Executor an…
Browse files Browse the repository at this point in the history
…d File Copier plugins.
  • Loading branch information
sjrd218 committed Jan 7, 2021
0 parents commit e388c4a
Show file tree
Hide file tree
Showing 16 changed files with 2,445 additions and 0 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Java CI

on: [push]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Get Fetch Tags
run: git -c protocol.version=2 fetch --tags --progress --no-recurse-submodules origin
if: "!contains(github.ref, 'refs/tags')"
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew build
- name: Get Release Version
id: get_version
run: VERSION=$(./gradlew currentVersion -q -Prelease.quiet) && echo ::set-output name=VERSION::$VERSION
- name: Upload jsch-plugin jar
uses: actions/[email protected]
with:
# Artifact name
name: Grails-Plugin-${{ steps.get_version.outputs.VERSION }}
# Directory containing files to upload
path: build/libs/jsch-plugin-${{ steps.get_version.outputs.VERSION }}.jar
46 changes: 46 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
on:
push:
# Sequence of patterns matched against refs/tags
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10

name: Upload Release Asset

jobs:
build:
name: Upload Release Asset
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Build with Gradle
run: ./gradlew build
- name: Get Release Version
id: get_version
run: VERSION=$(./gradlew currentVersion -q -Prelease.quiet) && echo ::set-output name=VERSION::$VERSION
- name: Create Release
id: create_release
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ steps.get_version.outputs.VERSION }}
draft: false
prerelease: false
- name: Upload Release Asset (jar)
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: build/libs/jsch-plugin-${{ steps.get_version.outputs.VERSION }}.jar
asset_name: jsch-plugin-${{ steps.get_version.outputs.VERSION }}.jar
asset_content_type: application/octet-stream
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.gradle
.idea
build
out
51 changes: 51 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# jsch-plugin Rundeck Plugin

This is a node executor / File Copier plugin based on [JSCH](http://www.jcraft.com/jsch/) library

This code was extracted from the Rundeck core, and is the standalone version of the same plugin
that is built-in and shipped with Rundeck.

## Build and Install

```
./gradlew clean && ./gradlew build
cp build/libs/jsch-plugin-x.x.x.jar $RDECK_BASE/libext
```

## How to use

This plugin is a standalone version of the JSCH plugin that comes built into Rundeck.
The JSCH [documentation](https://docs.rundeck.com/docs/administration/projects/node-execution/ssh.html) applies to this plugin.

The names of the plugins have been changed to avoid clashing with the built-in version.

Node Executor: jsch-sa-ssh
File Copier: jsch-sa-scp

### Set it at project level

Go to `Project Settings > Edit Configuration` to set the JSCH plugin at project level

### Set at node level

Use `node-executor` and `file-copier` node attributes to use SSHJ plugin at node level.

```
Demo-Ubuntu:
nodename: Demo-Ubuntu
hostname: 192.168.100.18
description: Ubuntu 20
username: samuel
osFamily: unix
node-executor: jsch-sa-ssh
file-copier: jsch-sa-scp
tags: ubuntu
ssh-authentication: password
ssh-password-storage-path: keys/node/samuel.password
sudo-password-storage-path: keys/node/sudo.password
ssh-password-option: option.password
sudo-command-enabled: 'true'
```

85 changes: 85 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
plugins {
id 'pl.allegro.tech.build.axion-release' version '1.11.0'
id 'java'
}

defaultTasks 'clean','build'
apply plugin: 'java'
apply plugin: 'groovy'
apply plugin: 'idea'
sourceCompatibility = 1.8
ext.rundeckPluginVersion= '1.2'
ext.rundeckVersion= '3.3.x'
ext.pluginClassNames='com.plugin.jschplugin.JschNodeExecutor,com.plugin.jschplugin.JschScpFileCopier'
ext.pluginName = 'JSCH Plugin'
ext.pluginDescription ='SSH Node Executor and File Copier plugin based on JSCH library.'


scmVersion {
ignoreUncommittedChanges = true
tag {
prefix = 'v'
versionSeparator = ''
}
}

project.version = scmVersion.version

repositories {
mavenLocal()
mavenCentral()
}

configurations{
//declare custom pluginLibs configuration to include only libs for this plugin
pluginLibs

//declare compile to extend from pluginLibs so it inherits the dependencies
compile{
extendsFrom pluginLibs
}
}

dependencies {

compile 'org.rundeck:rundeck-core:3.3+'
compile group: 'org.slf4j', name: 'slf4j-api', version: '1.7.26'

testCompile 'junit:junit:4.12'
testCompile "org.codehaus.groovy:groovy-all:2.4.15"
testCompile "org.spockframework:spock-core:1.0-groovy-2.4"
testCompile "cglib:cglib-nodep:2.2.2"
testCompile group: 'org.objenesis', name: 'objenesis', version: '1.2'
}


// task to copy plugin libs to output/lib dir
task copyToLib(type: Copy) {
into "$buildDir/output/lib"
from configurations.pluginLibs
}


jar {
from sourceSets.main.allSource
from "$buildDir/output"
manifest {
def libList = configurations.pluginLibs.collect{'lib/'+it.name}.join(' ')
attributes 'Rundeck-Plugin-Name' : pluginName
attributes 'Rundeck-Plugin-Description' : pluginDescription
attributes 'Rundeck-Plugin-Rundeck-Compatibility-Version': '2.x+'
attributes 'Rundeck-Plugin-Tags': 'java,executor'
attributes 'Rundeck-Plugin-License': 'MIT'
attributes 'Rundeck-Plugin-Source-Link': 'https://github.com/rundeck-plugins'
attributes 'Rundeck-Plugin-Target-Host-Compatibility': 'all'
attributes 'Rundeck-Plugin-Author': 'Rundeck, Inc.'
attributes 'Rundeck-Plugin-Classnames': pluginClassNames
attributes 'Rundeck-Plugin-File-Version': version
attributes 'Rundeck-Plugin-Version': rundeckPluginVersion, 'Rundeck-Plugin-Archive': 'true'
attributes 'Rundeck-Plugin-Libs': "${libList}"
attributes 'Class-Path': "${libList} lib/rundeck-core-${rundeckVersion}.jar"
}
}
//set jar task to depend on copyToLib
jar.dependsOn(copyToLib)

Binary file added gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
5 changes: 5 additions & 0 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit e388c4a

Please sign in to comment.