Add NodeJS executor build step
Currently there is no possibility to setup options for 'NodeJS Plugin' https://wiki.jenkins.io/display/JENKINS/NodeJS+Plugin But 'NodeJS Plugin' is widely used to get ability of executing JS in build step So this patch introduces configuration options for 'Execute NodeJS script' build step. Change-Id: Ie0a9863f235d4199a6de350036394b8d054eb1e9
This commit is contained in:
parent
a23f8bf8db
commit
5c05925d00
|
@ -4090,3 +4090,31 @@ def ansible_playbook(parser, xml_parent, data):
|
||||||
XML.SubElement(value_elm, 'value').text = values.get('value', '')
|
XML.SubElement(value_elm, 'value').text = values.get('value', '')
|
||||||
XML.SubElement(value_elm, 'hidden').text = str(
|
XML.SubElement(value_elm, 'hidden').text = str(
|
||||||
values.get('hidden', False)).lower()
|
values.get('hidden', False)).lower()
|
||||||
|
|
||||||
|
|
||||||
|
def nodejs(parser, xml_parent, data):
|
||||||
|
"""yaml: nodejs
|
||||||
|
This plugin allows to execute NodeJS scripts as a job build step.
|
||||||
|
Requires the Jenkins :jenkins-wiki:`NodeJS Plugin <NodeJS+Plugin>`.
|
||||||
|
|
||||||
|
:arg str name: NodeJS installation name
|
||||||
|
:arg str script: NodeJS script (required)
|
||||||
|
:arg str config-id: ID of npmrc config file, which is the
|
||||||
|
last field (a 32-digit hexadecimal code) of the path of URL visible
|
||||||
|
after you clicked the file under Jenkins Managed Files.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
.. literalinclude::
|
||||||
|
/../../tests/builders/fixtures/nodejs-executor001.yaml
|
||||||
|
|
||||||
|
"""
|
||||||
|
nodejs = XML.SubElement(xml_parent,
|
||||||
|
'jenkins.plugins.nodejs.NodeJSCommandInterpreter')
|
||||||
|
mapping = [('script', 'command', None)]
|
||||||
|
|
||||||
|
mapping_opt = [('name', 'nodeJSInstallationName', None),
|
||||||
|
('config-id', 'configId', None)]
|
||||||
|
|
||||||
|
convert_mapping_to_xml(nodejs, data, mapping, fail_required=True)
|
||||||
|
convert_mapping_to_xml(nodejs, data, mapping_opt, fail_required=False)
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<project>
|
||||||
|
<builders>
|
||||||
|
<jenkins.plugins.nodejs.NodeJSCommandInterpreter>
|
||||||
|
<command>console.log('Some output');</command>
|
||||||
|
<nodeJSInstallationName>NodeJS_8.1</nodeJSInstallationName>
|
||||||
|
<configId>e3757442-7c21-4a65-a1ff-6c70f5c6df34</configId>
|
||||||
|
</jenkins.plugins.nodejs.NodeJSCommandInterpreter>
|
||||||
|
</builders>
|
||||||
|
</project>
|
|
@ -0,0 +1,5 @@
|
||||||
|
builders:
|
||||||
|
- nodejs:
|
||||||
|
name: "NodeJS_8.1"
|
||||||
|
script: "console.log('Some output');"
|
||||||
|
config-id: "e3757442-7c21-4a65-a1ff-6c70f5c6df34"
|
|
@ -0,0 +1,8 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<project>
|
||||||
|
<builders>
|
||||||
|
<jenkins.plugins.nodejs.NodeJSCommandInterpreter>
|
||||||
|
<command>console.log('Some output');</command>
|
||||||
|
</jenkins.plugins.nodejs.NodeJSCommandInterpreter>
|
||||||
|
</builders>
|
||||||
|
</project>
|
|
@ -0,0 +1,3 @@
|
||||||
|
builders:
|
||||||
|
- nodejs:
|
||||||
|
script: "console.log('Some output');"
|
Loading…
Reference in New Issue