gitlab-ci.yml保存自定义的数据,并保存log CICD

复制代码
stages:
  - build
  - test
  - deploy

build:
  stage: build
  only:
    - android_task
    - ios_task
  tags:
    - tcoe_test
  script:
    - echo $USER
    - echo "build"

test:
  stage: test
  only:
    - android_task
    - ios_task
    - McvAccount
    - HkAccount
  tags:
    - tcoe_test
#  before_script:
#    - export MAVEN_HOME=/Users/user/mydata/apache-maven-3.8.6/bin
  script:
    - echo $USER
    - echo "test"
    - pwd
    - mvn clean
   - mvn clean \>\> maven.log 2\>\&1
#    - mvn test -Dplatform=api -Denv=stage -DtestngXmlFile="src/main/resources/suite/all/api_cicd.xml"
#    - mvn test -Denv=stage -Dplatform=mobile -Dmobile=ios -DtestngXmlFile="src/main/resources/suite/channel/mobile_cicd.xml"
#    - mvn test -Denv=stage -Dplatform=mobile -Dmobile=android -DtestngXmlFile="src/main/resources/suite/channel/mobile_android_cicd.xml"
#    - mvn clean test -Denv=stage -Dplatform=api -DtestngXmlFile="src/main/resources/suite/all/create_hk_account.xml"
    - mvn test -Denv=stage -Dplatform=api -DtestngXmlFile="src/main/resources/suite/all/sta_api.xml" \>\> maven.log 2\>\&1
  artifacts:
    when: always
    paths:
      - target/
      - TestReport/
- maven.log
    expire_in: 1 week
    reports:
      junit:
        - target/surefire-reports/TEST-TestSuite.xml
        - target/surefire-reports/testng-failed.xml
        - target/surefire-reports/testng-results.xml
#  allow_failure: true

deploy:
  stage: deploy
  only:
    - McvAccount
    - HkAccount
  tags:
    - tcoe_test
  script:
    - sh readAccount.sh

保存log

上面脚本红色部分,用于保存log

打开对应的Job,点击Browser

可以看到保存的自定义文件,点击进去,可以下载该文件

保存自定义的数据

复制代码
deploy:
  stage: deploy
  only:
    - McvAccount
    - HkAccount
  tags:
    - tcoe_test
  script:
    - sh readAccount.sh

另外新建一个job,去读取保存的文件,然后逐行读取

复制代码
#!/bin/bash

# 指定文件路径
file_path="./TestReport/zephyrscale/createAccountData.txt"

# 逐行读取文件
while IFS= read -r line
do
  # 在这里处理每一行的内容,例如打印或者进行其他操作
  echo "$line"
done < "$file_path"
相关推荐
郝亚军3 小时前
gitlab常用命令
gitlab
heimeiyingwang1 天前
【CI/CD·Actions篇】进阶实战:复合 Action 开发与 Marketplace 利用
ci/cd
智脑API2 天前
Claude Code sandbox.failIfUnavailable 怎么用?沙箱启动失败、拒绝降级和 CI 安全
安全·ci/cd
小小测试开发2 天前
Trace 驱动回归:把线上 Agent 故障变成 CI 门禁的四步管道
人工智能·ci/cd·数据挖掘·回归
汪海游龙3 天前
告别 Play Console 手动上传:从模拟器截图到自动发版的完整流水线
android·ci/cd·github
minhuan3 天前
大模型应用CI/CD全流程解析:打通模型训练、评估、部署自动化,应用持续迭代实践23.7
ci/cd·自动化·大模型应用·大模型应用ci/cd全流程解析·大模型应用工程体系
xixingzhe23 天前
Java 使用 GitLab4J 实现 WebHook
gitlab
凌云拓界4 天前
NodeVerdict | 性能门禁:把追踪数据变成 CI 规则
ci/cd·信息可视化·开源·node.js·bug·数据可视化·安全架构
童槿顏丶5 天前
GitLab部署到Linux
linux·运维·gitlab
空谷有来人5 天前
springcloud中配置ci/cd集成docker的配置文件
spring cloud·ci/cd·docker