@spmeesseman/jenkins-utility-server

1.0.1 • Public • Published

Jenkins Utility Server

app-type app-lang app-publisher

authors MantisBT issues open MantisBT issues closed MantisBT version current MantisBT version next

Introduction

Jenkins Utility Server is a HTTP server that runs on a Jenkins node, that can serve user interface tasks via a pipeline script using a simple HTTP request.

At the time of this writing and for the initial release, only one task is supported - "open file in notepad".

Requirements

Jenkins HTTP Request Plugin

Installation

To install Jenkins Utility Server from a command line, run the following command:

npm install -g @perryjohnson/jenkins-utility-server

Run the Server

Run the Jenkins Utility Server from a command line using the following command:

jenkins-utility-server

By default, the bound port number is 4322. To change the bound port number, use the following command:

jenkins-utility-server --port 6000

Usage

Simply add a request to a pipeline script invoking httpRequest on the appropriate endpoint, for example:

steps {
  echo "Jenkins-utility-server: Send request to open changelog in Notepad"
  def jsonEncWs = WORKSPACE.replace("\\", "\\\\")
  def bodyJson = "{\"path\": \"${jsonEncWs}\\\\CHANGELOG.md\", \"token\": \"${env.JENKINS_UTILITY_SERVER_TOKEN}\"}"
  httpRequest acceptType: 'APPLICATION_JSON', contentType: 'APPLICATION_JSON', httpMode: 'POST', requestBody: bodyJson, url: "http://localhost:4322/openfile"
}

Endpoints

Endpoints are called by sending a request to the server with the following address format:

http://localhost:portnumber/endpointname

At the time of this writing and for the initial release, only one task is supported - "open file in notepad".

Endpoints - /openfile

Usage:

steps {
  echo "Jenkins-utility-server: Send request to open history file in Notepad"
  def jsonEncWs = WORKSPACE.replace("\\", "\\\\")
  def bodyJson = "{\"path\": \"${jsonEncWs}\\\\doc\\\\history.txt\", \"token\": \"${env.JENKINS_UTILITY_SERVER_TOKEN}\"}"
  httpRequest acceptType: 'APPLICATION_JSON', contentType: 'APPLICATION_JSON', httpMode: 'POST', requestBody: bodyJson, url: "http://localhost:4322/openfile"
}

License Information

Licensed under MIT, see the LICENSE

Readme

Keywords

none

Package Sidebar

Install

npm i @spmeesseman/jenkins-utility-server

Weekly Downloads

0

Version

1.0.1

License

MIT

Unpacked Size

13.7 kB

Total Files

7

Last publish

Collaborators

  • spmeesseman