当前位置: 首页 > news >正文

咸阳市网站建设公司东莞市赢网网络科技有限公司

咸阳市网站建设公司,东莞市赢网网络科技有限公司,西湖南昌网站建设公司,做效果图展板网站在 Jenkins 上使用 Pipline 进行集成#xff0c;利用 SonarScanner 做静态代码扫描的过程中#xff0c;遇到了几个问题#xff0c;这里记录了一点解决办法。 在Jenkins上使用Pipline进行集成#xff0c;利用SonarScanner做静态代码扫描的过程中#xff0c;遇到了几个问题利用 SonarScanner 做静态代码扫描的过程中遇到了几个问题这里记录了一点解决办法。 在Jenkins上使用Pipline进行集成利用SonarScanner做静态代码扫描的过程中遇到了几个问题这里记录了一点解决办法。1. 脚本变量定义错误 自动安装 SonarScanner 插件在 Pipline 脚本中使用官方 wiki 中说明的脚本 stage(SonarQube analysis) {// requires SonarQube Scanner 2.8def scannerHome tool SonarQube Scanner 2.8;withSonarQubeEnv(My SonarQube Server) {sh ${scannerHome}/bin/sonar-scanner}}但是在扫描的时候总是报错可以看出是语法错误 WorkflowScript: 33: Not a valid stage section definition: def sonarqubeScannerHome SonarQubeScanner2.8. Some extra configuration is required. line 33, column 9.stage(SonarQubeanalysis) {^ WorkflowScript: 33: Unknown stage section withSonarQubeEnv. Starting with version 0.5, steps in a stage must be in a steps block. line 33, column 9.stage(SonarQubeanalysis) {^ WorkflowScript: 33: No steps or parallel to execute within stage SonarQubeanalysis line 33, column 9.stage(SonarQubeanalysis) {^因为在 stage 里面不是用 def 来定义变量的于是尝试将变量定义放在脚本里问题得到了解决 stage(SonarQubeanalysis) {steps{script {scannerHome tool SonarQubeScanner2.8//这里这个tool是直接根据名称获取自动安装的插件的路径}withSonarQubeEnv(SonarQube) {sh ${scannerHome}/bin/sonar-scanner sonar.projectKeyYourProjectKey sonar.sources.}}}2. 变量引用错误 在修改成上面的脚本后运行再次报错找不到 sonar.sources 这个选项 /yourpath/tools/hudson.plugins.sonar.SonarRunnerInstallation/SonarQubeScanner2.8/bin/sonar-scanner sonar.projectKeyYourProjectKey sonar.source. ERROR: Unrecognized option: sonar.source. INFO: INFO: usage: sonar-scanner [options] INFO: INFO: Options: INFO: -D,--define arg Define property INFO: -h,--help Display help information INFO: -v,--version Display version information INFO: -X,--debug Produce execution debug output INFO: -i,--interactive Run interactively经过大神指导发现在运行 SonarScanner 的时候需要用‘-D’来标记如果这两个参数是写在 sonar-scanner.properties 里就不需要了 stage(SonarQubeanalysis) {steps{script {scannerHome tool SonarQubeScanner2.8}withSonarQubeEnv(SonarQube) {sh ${scannerHome}/bin/sonar-scanner -Dsonar.projectKeyYourProjectKey -Dsonar.sources.}}}3. 登录受限 在上面的问题都解决了之后发现登录所需要属性错误 ERROR: Error during SonarQube Scanner execution ERROR: Not authorized. Please check the properties sonar.login and sonar.password. ERROR: ERROR: Re-run SonarQube Scanner using the -X switch to enable full debug logging.出现这个 bug 的时候用的是 SonarQube5.2 版本所以需要 Jenkins 通过账户密码登录但是因为账号权限受限所以无法连接到 Sonar 的服务器所以后来更新账号密码就好了。 或者使用 stage(SonarQube Analysis) {steps {script {scannerHome tool SonarScanner}withSonarQubeEnv(sonarqube) {sh ${scannerHome}/bin/sonar-scanner -Dsonar.projectKeyxrm_xrm_xxxx -Dsonar.sourcessrc -Dsonar.host.urlhttp://192.168.1.x:9000 \-Dsonar.loginsqp_xxxxe}}}也可以在项目下创建一个sonar-project.properties文件在里面配置好参数 (推荐) #项目的唯一标识必填 sonar.psonar.projectKeysonar-test-prj 项目名称 sonar.projectNamesonar-test-prj 项目版本 sonar.projectVersion1.0 #扫描目录 sonar.sourcessrc #检测语言 sonar.languagejs #扫描结果上报地址 sonar.host.urlhttp://127.0.0.1:9000 #登录账号 sonar.loginadmin sonar.passwordxxx #文件编码 sonar.sourceEncodingUTF-8参考 https://blog.csdn.net/weixin_44802620/article/details/125133724 https://blog.csdn.net/qq_44930876/article/details/128147777
http://www.yutouwan.com/news/104818/

相关文章:

  • 云南省建设监理协会网站汕头行业网站
  • 陕西网站建设通报免费微信小程序模板
  • 互联网保险的发展现状宁波seo怎么做推广渠道
  • 门户网站建设自查整改运营是做什么的
  • 网站开发公司前置审批免费注册网站空间
  • 微商网站开发班服定制的网站
  • 网站建立失败的原因是海关申报网站怎么做
  • 大庆医院网站建设方案四川旅游
  • 科技公司手机网站ui设计师资格证
  • 山西焦煤集团公司网站 wap网站开发
  • 做质量计量的网站有哪些浙江建设网证书查询
  • 深圳网站建设公司联系方式上海橙网站设计公司
  • 网站被别的域名绑定深圳做营销网站公司
  • 网站关键词分隔符广州网站建设小程序开发
  • 用手机怎么做免费网站海口网页设计
  • 企业网站建站的专业性原则是指wordpress 文章的php
  • 场口一站式建站哪家公司好Wordpress搜索html页面
  • 做海外视频的网站有哪些品牌营销策划推广
  • 聊城专业建wap网站重庆高端seo
  • 国内简洁大气网站推荐小程序模板图
  • 深圳宝安大型网站建设ps做网站字体用多大的
  • 龙岩网站推广营销wordpress保存帖子数据库
  • 外贸网站怎么做才好动画设计说明
  • 做网站找毛叶子歌做网站中app客户端
  • 做视频素材哪个网站好wordpress快站怎么样
  • 长春一般建一个网站需要多少钱乌兰察布盟建设银行网站
  • 网站软件开发手机免费注册
  • 网站做a视频在线观看网站网站建设标志图
  • 天津市做公司网站的公司饮料代理招商网
  • 专业餐饮网站建设云南大永高速公路建设指挥部网站