如何使用Jenkins P4插件发布声明性管道

时间:2017-06-22 17:16:43

标签: jenkins jenkins-plugins jenkins-pipeline

<form id="myform" asp-controller="CustOrders" asp-action="ProductPrices" method="post">
....
<tr>
 <td>Item1:</td>
 <td><input asp-for="item1_price" asp-format="{0:C}" class="inputclass" /></td>
</tr>
<tr>
     <td>Item2:</td>
     <td><input asp-for="item2_price" asp-format="{0:C}" class="inputclass" /></td>
</tr>
...
<tr>
     <td>Item9:</td>
     <td><input asp-for="item9_price" />></td>
</tr><tr>
     <td>Item1:</td>
     <td><input asp-for="item1_price" asp-format="{0:C}" class="inputclass" /></td>

</table>
<button type="submit" name="submit" value="Add">Update Report</button>
</form>

@section scripts
{
    <script>
        $(document).ready(function () {
            $("#myform").submit(function () {
                $('.inputclass').each($(this).val($(this).val().replace(/[$,]/g, '')));
            });
        });
    </script>
}

我尝试了几件事并把它放在脚本块下但没有运气。是不是假设使用声明性管道或我错过了什么?如果我能在这个

上得到一些帮助,那就太好了

1 个答案:

答案 0 :(得分:0)

在P4插件仓库中找到可能有用的指南。他们似乎建议使用代码段生成器来帮助获得正确的语法。他们展示的例子都是用命令式语法编写的,但我不明白为什么它不适用于声明性的。

node {
  stage('Sync') {
    // sync files from //streams/st1-main/...
    p4sync(charset: 'none',
      credential: 'phooey1666', 
      populate: [$class: 'AutoCleanImpl', 
        delete: true, 
        modtime: false, 
        pin: '',
        quiet: true,
        replace: true],
      stream: '//streams/st1-main')
  }
}

p4发布https://github.com/jenkinsci/p4-plugin/blob/master/WORKFLOW.md#using-standard-freestyle-jobs-steps

p4publish(credential: 'phooey1666', 
  publish: [$class: 'SubmitImpl', 
    delete: false, 
    description: 'Submitted by Jenkins. Build: ${BUILD_TAG}', 
    onlyOnSuccess: false, 
    purge: '', 
    reopen: false], 
  workspace: [$class: 'StreamWorkspaceImpl', 
    charset: 'none', 
    format: 'jenkins-${NODE_NAME}-${JOB_NAME}-publish', 
    pinHost: false, 
    streamName: '//streams/st2-rel1'])

https://github.com/jenkinsci/p4-plugin/blob/master/WORKFLOW.md