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"
相关推荐
画船听雨眠aa10 小时前
gitlab云服务器配置
服务器·git·elasticsearch·gitlab
柠檬豆腐脑2 天前
从前端到全栈:Jenkins 自动化部署 Node.js后端+ Vue.js 前端
前端·ci/cd·jenkins
玉米的玉*」*3 天前
新项目上传gitlab
gitlab
鲁子狄3 天前
[笔记] 极狐GitLab实例 : 手动备份步骤总结
linux·运维·笔记·ubuntu·centos·gitlab
小张认为的测试6 天前
Jenkins下载 Maven、Allure 插件并且配置环境
java·软件测试·ci/cd·jenkins·maven
Suwg2097 天前
【由浅入深认识Maven】第4部分 maven在持续集成中的应用
servlet·ci/cd·maven
周杰伦_Jay7 天前
详细介绍:持续集成与持续部署(CI/CD)技术细节(关键实践、CI/CD管道、优势与挑战)
程序人生·ci/cd·docker·微服务·云原生·容器·人机交互
节省钱7 天前
【Git】如何在 Git 提交后补充 Change-Id
服务器·git·gitee·gitlab·github·gitcode
小钟不想敲代码7 天前
自动化部署(二):Jenkins持续集成(CI/CD)
ci/cd·自动化·jenkins
dujunqiu7 天前
gitlab处理空文件夹的提交或空文件夹提交失败
git·gitlab·github