Jenkins错误sh:0:无法打开标签:/ sh:0:无法打开脚本:尝试执行SOAPUI命令行时

时间:2019-12-04 08:01:36

标签: linux shell jenkins soapui ready-api

我正试图通过Jenkins中的命令行运行SoapUI TestRunner。这是SoapUI TestRunner命令行:

void main() {
  SystemChrome.setSystemUIOverlayStyle(
    SystemUiOverlayStyle(
      statusBarColor: Colors.black.withOpacity(0), //top bar color
       // statusBarIconBrightness: Brightness.dark, // don't use this
    ),
  );
  runApp(MyApp2());
}

class MyApp2 extends StatelessWidget {
// This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: Text("AppBar"),
          brightness: Brightness.light, // use this instead
        ),
      ),
    );
  }
}

我在詹金斯的流水线语法中生成了一个导致该shell脚本的shell脚本:

"/home/able/readyapi/installation/bin/testrunner.sh" -spayments-chain -r -a -j -f${WORKSPACE} "-RJUnit-Style HTML Report" -FXML -Enn-0716 "-TTestCase jenkins_test" /home/able/jenkins/workspace/REGRESSION_0716/test_automation

这给我以下错误:

sh script: '"/home/able/readyapi/installation/bin/testrunner.sh" -spayments-chain -r -a -j -f${WORKSPACE} "-RJUnit-Style HTML Report" -FXML -Enn-0716 "-TTestCase jenkins_test" /home/able/jenkins/workspace/REGRESSION_0716/test_automation'

任何人都可以通过此信息告诉我我做错了什么吗?如果您需要更多信息,请告诉我。我对linux和shell不太熟悉。

1 个答案:

答案 0 :(得分:0)

语法应该简单

sh '"/home/able/readyapi/installation/bin/testrunner.sh" -spayments-chain -r -a -j -f${WORKSPACE} "-RJUnit-Style HTML Report" -FXML -Enn-0716 "-TTestCase jenkins_test" /home/able/jenkins/workspace/REGRESSION_0716/test_automation'

因此,它确实是在告诉您script:不应该在那里。

第一个参数周围的引号是疯狂的,但不是不正确的。等同于惯用语

sh '/home/able/readyapi/installation/bin/testrunner.sh -spayments-chain -r -a -j -f"${WORKSPACE}" "-RJUnit-Style HTML Report" -FXML -Enn-0716 "-TTestCase jenkins_test" /home/able/jenkins/workspace/REGRESSION_0716/test_automation'

您会注意到我在-f${WORKSPACE}周围添加了引号,并在脚本名称附近删除了引号。 "-RJUnit-Style HTML Report"周围的引号看起来也很令人困惑,但如果它对您有用,我想它们是正确的。 (也许应该是-RJunit-Style "HTML Report"?还是-R"Junit-Style HTML Report"?并且以后类似的-T选项也是如此。)