Serenity CI/CD Azure Pipeline: Error: ENOENT: no such file or directory, stat 'E:\V\01-Au04\_work\36\s\target\site\serenity'

111 Views Asked by At

Team: When I run a manual execution on Azure DevOps I'm getting the next errors:

Error: ENOENT: no such file or directory, stat 'E:\V\01-Au04\_work\36\s\target\site\serenity'
    Archive files

ENOENT: no such file or directory, stat 'E:\V\01-Au04\_work\36\s\target\site\serenity'
Archive files

Publishing build artifacts failed with an error: Not found PathtoPublish: E:\V\01-Au04\_work\36\s\target\site\serenity\serenity-summary.html
Publish Single page report

Unable to process command '##vso[task.addattachment type=replacedhtml;name=content;]E:\V\01-Au04\_work\36/s/target/site/serenity/serenity-summary.html' successfully. Please reference documentation (http://go.microsoft.com/fwlink/?LinkId=817296)
Publish HTML report

Value cannot be null. (Parameter 'Cannot upload task attachment file, attachment file location is not specified or attachment file not exist on disk')
Publish HTML report

and I'm also getting this warning:

Warning

Directory 'E:\V\01-Au04\_work\36\a' is empty. Nothing will be added to build artifact 'Full report'.
Publish Full report

I have here my YML file:

parameters:
  - name: tag
    displayName: Tag
    type: string
    default: '@UI'

  - name: environment
    displayName: Environment
    values:
      - stage
    default: stage

  - name: browser
    displayName: Browser
    values:
      - chrome
    default: chrome

  - name: headless
    displayName: Headless
    values:
      - true
      - false
    default: true

trigger: none
pr: none

stages:
  - stage: run_maven
    pool: Dev-AutomatedTests
    displayName: Run Production UI regression test
    jobs:
      - job: Build_and_execute
        timeoutInMinutes: 270
        steps:

          - task: Maven@4
            displayName: Execute tests
            inputs:
              mavenPomFile: 'pom.xml'
              goals: 'test'
              options: 'clean verify -Denvironment="${{ parameters.environment }}" -D"cucumber.filter.tags"="${{ parameters.tag }}" -D"headless.mode"="${{ parameters.headless }} -Daccess=$(DOOR_ACCESS)'
              publishJUnitResults: true
              testResultsFiles: '**/SERENITY-JUNIT-*.xml'
              testRunTitle: 'Prod UI Tests'
              ${{ if and(eq(variables['Agent.OS'], 'Linux'), not(contains(parameters.pool, 'vmss'))) }}:
                javaHomeOption: 'Path'
                jdkVersionOption: 1.11
                jdkDirectory: '/usr/lib/jvm/java-11-openjdk-11.0.16.1.1-1.el8_6.x86_64'
                mavenVersionOption: 'Path'
                mavenDirectory: '/opt/maven'
              ${{ if and(eq(variables['Agent.OS'], 'Linux'), contains(parameters.pool, 'vmss')) }}:
                javaHomeOption: 'Path'
                jdkVersionOption: 1.11
                jdkDirectory: '/usr/lib/jvm/java-11-openjdk-amd64'
                mavenVersionOption: 'Path'
                mavenDirectory: '/usr/share/maven'
              ${{ if eq(variables['Agent.OS'], 'Windows_NT') }}:
                javaHomeOption: 'Path'
                jdkDirectory: $(java_home)
                mavenVersionOption: 'Default'

          - task: ArchiveFiles@2
            displayName: Archive files
            condition: succeededOrFailed()
            inputs:
              rootFolderOrFile: '$(agent.builddirectory)/s/target/site/serenity'
              includeRootFolder: false
              archiveType: 'zip'
              archiveFile: '$(Build.ArtifactStagingDirectory)/Test_Results_$(Build.BuildId).zip'
              replaceExistingArchive: true

          - task: PublishBuildArtifacts@1
            displayName: Publish Full report
            condition: succeededOrFailed()
            inputs:
              PathtoPublish: '$(build.artifactstagingdirectory)'
              ArtifactName: 'Full report'
              publishLocation: 'Container'

          - task: PublishBuildArtifacts@1
            displayName: Publish Single page report
            condition: succeededOrFailed()
            inputs:
              PathtoPublish: '$(agent.builddirectory)/s/target/site/serenity/serenity-summary.html'
              ArtifactName: 'Single page report'
              publishLocation: 'Container'

          - task: publishhtmlreport@1
            displayName: Publish HTML report
            condition: succeededOrFailed()
            inputs:
              htmlType: 'genericHTML'
              htmlPath: '$(agent.builddirectory)/s/target/site/serenity/serenity-summary.html'

          - task: CopyFiles@2
            inputs:
              SourceFolder: '$(Build.SourcesDirectory)'
              targetFolder: '$(Build.ArtifactStagingDirectory)'    

          - task: PublishPipelineArtifact@0
            displayName: 'Publish pipeline artifact'
            inputs:
              artifactName: 'drop'
              targetPath: '$(Build.ArtifactStagingDirectory)'

At the moment of running an Azure manual job I'm getting the same issues after the 40 seconds. I have done many changes, but always get the same errors. Does anybody can help me with this?

2

There are 2 best solutions below

2
Miao Tian-MSFT On

You can add the following CmdLine@2 task after your Maven@4 task. It will print out the file structure of the $(Agent.BuildDirectory) folder. Then you can check and find the right file path.

  - task: CmdLine@2
    condition: succeededOrFailed()
    inputs:
      script: |
        cd $(Agent.BuildDirectory)
        tree
0
yoav lax On

The error message is mentioning the exact problem, the path provided is invalid. I suggest one of the following:

  1. If the build machine isn't MS hosted, connect to the server during the build run and see the exact path you should send
  2. Add a CMD / PowerShell step to show the tree of where your code is running to get full context of what needs to be sent.