stages:- build- test- deploybuild:stage: buildonly:- android_task- ios_tasktags:- tcoe_testscript:- echo $USER- echo "build"test:stage: testonly:- android_task- ios_task- McvAccount- HkAccounttags:- tcoe_test # before_script: # - export MAVEN_HOME=/Users/user/mydata/apache-maven-3.8.6/binscript:- 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>&1artifacts:when: alwayspaths:- target/- TestReport/ - maven.logexpire_in: 1 weekreports:junit:- target/surefire-reports/TEST-TestSuite.xml- target/surefire-reports/testng-failed.xml- target/surefire-reports/testng-results.xml # allow_failure: truedeploy:stage: deployonly:- McvAccount- HkAccounttags:- tcoe_testscript:- sh readAccount.sh
保存log
上面脚本红色部分,用于保存log
打开对应的Job,点击Browser
可以看到保存的自定义文件,点击进去,可以下载该文件
保存自定义的数据
deploy:stage: deployonly:- McvAccount- HkAccounttags:- tcoe_testscript:- sh readAccount.sh
另外新建一个job,去读取保存的文件,然后逐行读取
#!/bin/bash# 指定文件路径 file_path="./TestReport/zephyrscale/createAccountData.txt"# 逐行读取文件 while IFS= read -r line do# 在这里处理每一行的内容,例如打印或者进行其他操作echo "$line" done < "$file_path"