• 质量平台-sonarlint-接入项目gitlab配置


    一、git相关配置

    1、项目增加sonar账号,角色developer。用于拉取代码和执行sonarqube检查

    2、merge requests配置,pipelines must succeed  (阻断merge)

    auto-orient&e=1661852549&token=VXu2kld82Q4CEhnpUzweXRgby4RUyIfxr11qICVo:8vWs9WdV82ZMxJlCZf4qlRDBm0g

    3、webhook配置

    URL:http://qa.rd.com/sonar/gitCallBack

    如果是java项目mvn项目,则配置:Secret token:java

    如果是前端项目react项目,则配置:Secret token:react

    事件勾选,push eventsmerge request events

    auto-orient&e=1661852549&token=VXu2kld82Q4CEhnpUzweXRgby4RUyIfxr11qICVo:WmtQr62Avtp7G5OBpPHX7o6kyuU

    4、CICD,gitlab runner配置

    允许使用共享runner

    auto-orient&e=1661852549&token=VXu2kld82Q4CEhnpUzweXRgby4RUyIfxr11qICVo:y55t3Moxt3gV8CEDV5NADtaZnwI

    5、pipeline顺序运行

    auto-orient&e=1661852549&token=VXu2kld82Q4CEhnpUzweXRgby4RUyIfxr11qICVo:foeND0lHueH_IzHhx-MINQWaqOo

    6、保护分支设定

    master需要做强制保护,不允许直接push进入,其他分支可以视项目而定,严格程度来讲,只能通过merge进入,防止人为提交代码进入

    auto-orient&e=1661852549&token=VXu2kld82Q4CEhnpUzweXRgby4RUyIfxr11qICVo:TjIJaMAoFO-bIV8ef7gGrE7LBgw

    二、历史版本生成

    前提条件:

    当前接入项目不存在进行中的merge request,检查方式,比如http://gitlab.rd.com/qike_back_end/scrm-websocket-parent/-/merge_requests

    auto-orient&e=1661852549&token=VXu2kld82Q4CEhnpUzweXRgby4RUyIfxr11qICVo:rPYP9R2mCL6vRAqeNg7GEhLY8IA

    1、在接入工程的dev分支新增gitlab-ci.yml文件

    创建.gitlab-ci.yml,内容如下

    1. # This file is a template, and might need editing before it works on your project.
    2. # This is a sample GitLab CI/CD configuration file that should run without any modifications.
    3. # It demonstrates a basic 3 stage CI/CD pipeline. Instead of real tests or scripts,
    4. # it uses echo commands to simulate the pipeline execution.
    5. #
    6. # A pipeline is composed of independent jobs that run scripts, grouped into stages.
    7. # Stages run in sequential order, but jobs within stages run in parallel.
    8. #
    9. # For more information, see: https://docs.gitlab.com/ee/ci/yaml/README.html#stages
    10. stages: # List of stages for jobs, and their order of execution
    11. - scan
    12. sonar-merge:
    13. stage: scan
    14. script:
    15. - echo "merge"
    16. - /var/opt/sonar-merge-check.sh
    17. - echo "merge over"
    18. only:
    19. - merge_requests
    20. tags:
    21. - share-runner-1

    2、发起一次dev到master的merge,并merge完成。此步骤为了生成历史版本的merge request版本

    三、质量平台使用

    地址:http://qa.rd.com/#/sonar

    登录LDAP账号: chentaolian(无须邮箱)

    auto-orient&e=1661852549&token=VXu2kld82Q4CEhnpUzweXRgby4RUyIfxr11qICVo:Hk85ZKn9AbLrnq5oaGlzhAvhSeY

    四、sonar平台

    地址:http://172.30.100.251:9000/projects

    账号:dev

    密码:123456

  • 相关阅读:
    [车联网安全自学篇] 五十六. Android安全之APK应用程序是否签名异常的检测方法
    Vue3学习
    数据结构线性表的基本概念
    leetcode热题100——第二天:5、6、10、11
    1.3 Apache Hadoop的重要组成-hadoop-最全最完整的保姆级的java大数据学习资料
    python笔记之面向对象
    MYSQL:B树和B+树存储索引比较
    吴恩达老师机器学习课程笔记 07 正则化
    【C/C++】函数作为参数
    单片机中在制定通讯协议时候,一定加入容错和重发机制
  • 原文地址:https://blog.csdn.net/wokoone/article/details/126607494