Merge "Add NodeJS executor build step"

This commit is contained in:
Zuul 2017-11-07 06:06:08 +00:00 committed by Gerrit Code Review
commit 0b51780d2c
5 changed files with 54 additions and 0 deletions

View File

@ -4090,3 +4090,31 @@ def ansible_playbook(parser, xml_parent, data):
XML.SubElement(value_elm, 'value').text = values.get('value', '')
XML.SubElement(value_elm, 'hidden').text = str(
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)

View File

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

View File

@ -0,0 +1,5 @@
builders:
- nodejs:
name: "NodeJS_8.1"
script: "console.log('Some output');"
config-id: "e3757442-7c21-4a65-a1ff-6c70f5c6df34"

View File

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

View File

@ -0,0 +1,3 @@
builders:
- nodejs:
script: "console.log('Some output');"