Skip to content

Build logs are no longer gathered and published on error #14787

Closed
@elinor-fung

Description

@elinor-fung

When a build that is set to publish logs (for example, via setting artifacts.publish.logs) errors out, no logs are published. Successful builds do publish their logs.

@chcosta I think this is from #14736

Example build failure without logs published: https://dev.azure.com/dnceng-public/public/_build/results?buildId=685790&view=logs&s=6884a131-87da-5381-61f3-d7acc3b91d76&j=d2b92d58-337d-5541-2ecb-d35f35f29352
'Gather logs for publish to artifacts' is skipped and then `Publish logs' can't actually publish anything, since logs weren't copied to the expected location..

The task for gathering logs to publish that isn't run:

- ${{ if and(ne(parameters.artifacts.publish.logs, 'false'), ne(parameters.artifacts.publish.logs, '')) }}:
- task: CopyFiles@2
displayName: Gather logs for publish to artifacts
inputs:
SourceFolder: 'artifacts/log'
Contents: '**'
TargetFolder: '$(Build.ArtifactStagingDirectory)/artifacts/log'
- ${{ if eq(parameters.enablePublishBuildArtifacts, 'true') }}:
- task: CopyFiles@2
displayName: Gather logs for publish to artifacts
inputs:
SourceFolder: 'artifacts/log/$(_BuildConfig)'
Contents: '**'
TargetFolder: '$(Build.ArtifactStagingDirectory)/artifacts/log/$(_BuildConfig)'

I think they just need continueOnError: true. But perhaps other places should also have that (maybe gathering binaries/packages?).

Before the template refactor:

- ${{ if and(ne(parameters.artifacts.publish.logs, 'false'), ne(parameters.artifacts.publish.logs, '')) }}:
- publish: artifacts/log
artifact: ${{ coalesce(parameters.artifacts.publish.logs.name, 'Logs_Build_$(Agent.Os)_$(_BuildConfig)') }}
displayName: Publish logs
continueOnError: true
condition: always()

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions