简体   繁体   中英

AWS Code build don't fail if no test files found

My code build build spec yml (version 2.0) report section looks like below

reports:
  surefire-reports:
    files:
      - '**/target/surefire-reports/*.xml'
    discard-paths: false

If there are no report files then code build job fails with the below error

2022-11-11T13:19:32.9976751Z Error in UPLOAD_ARTIFACTS phase: [surefire-reports: [report files not found in build]]
2022-11-11T13:20:03.7200288Z ##[warning]The `set-output` command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
2022-11-11T13:20:03.7249054Z ##[error]Build status: FAILED

Can someone let me know how can I not fail the job if no report files are found?

I created an empty surefire report xml, dummy.xml under <java_src_root>/target/surefire-reports

<?xml version="1.0" encoding="UTF-8"?>
<testsuite xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://maven.apache.org/surefire/maven-surefire-plugin/xsd/surefire-test-report-3.0.xsd" name="" time="" tests="0" errors="0" skipped="0" failures="0"/>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM