创建Gitlab流水线测试任务
创建任务
- 创建流水线。进入Gitlab主页,在左上角单击
,选择“新建项目/仓库”。图1 创建Gitlab项目1
- 打开新建项目页面,单击“创建空白项目”,打开创建空白项目页面,填写项目名称,选择root用户,单击“新建项目”。图2 创建Gitlab项目2
图3 创建Gitlab项目3
- 打开已创建的项目,在左侧树单击“流水线编辑器”,将脚本样例复制到流水线编辑框中,最后单击“提交更改”。图4 编辑脚本样例
- 在左侧树单击“构建 > 流水线”,右上角单击“运行流水线”,执行当前项目;选择“构建 > 作业”,查看流水线输出。图5 构建项目
图6 查看流水线输出
- 在右侧单击“下载”,可下载当前项目报告。图7 下载报告
Gitlab流水线测试代码示例
请确保运行的用户拥有root权限。
stages: # List of stages for jobs, and their order of execution
- build
- test
- deploy
build-job: # This job runs in the build stage, which runs first.
stage: test
tags:
- kunpeng_executor # 对应gitlab-runner注册时的标签,可选择多个
script:
- CURDIR=$(pwd)
- echo $CURDIR
- cp -rf /root/.local/compatibility_testing/template.html.bak /root/.local/compatibility_testing/template.html
- sudo /root/.local/lkp-tests/bin/lkp run /root/.local/lkp-tests/programs/compatibility-test/compatibility-test-defaults.yaml
- cp -rf /root/.local/compatibility_testing/compatibility_report.html $CURDIR/compatibility_report.html
- sudo sh /root/.local/compatibility_testing/report_result.sh
- echo "请去 '${CURDIR}'/compatibility_report.html 查看报告 "
artifacts:
paths:
- compatibility_report.html
name: compatibility_report
父主题: 测试
