dependency-check / dependency-check/azuredevops

Add retry handling for `rmRF` invocation in `dependency-check-build-task.ts`

Open
#138 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
53
Forks
35
PR merge metrics
No merged PRs in 30d

Description

[`azuredevops/src/Tasks/dependency-check-build-task/dependency-check-build-task.ts`](https://github.com/dependency-check/azuredevops/blob/main/src/Tasks/dependency-check-build-task/dependency-check-build-task.ts) contains

```typescript
await console.log('Downloading ZIP from "' + zipUrl + '"...');
...
tl.rmRF(zipLocation);
```

however this file removal is not unlikely to fail if an anti-virus program is currently scanning the file or some other file monitoring program holds the file open. Such failures breaks the build:

```text
Downloading ZIP from "https://github.com/jeremylong/DependencyCheck/releases/download/v8.4.3/dependency-check-8.4.3-release.zip"...
Failed rmRF: EPERM: operation not permitted, unlink 'C:\Agent\_work\_tasks\dependency-check-build-task_47ea1f4a-57ba-414a-b12e-c44f42765e72\6.1.1\dependency-check-8.4.3-release.zip'
##[error]Failed rmRF: EPERM: operation not permitted, unlink 'C:\Agent\_work\_tasks\dependency-check-build-task_47ea1f4a-57ba-414a-b12e-c44f42765e72\6.1.1\dependency-check-8.4.3-release.zip'
##[error]Unhandled error condition detected.
Ending Dependency Check...
```

It would be nice if the file remove operation was wrapped with retry policy handling similar to the what [is used for downloading](https://github.com/dependency-check/azuredevops/blob/e843db120096a094394a7bffd0e98e9bd0445308/src/Tasks/dependency-check-build-task/dependency-check-build-task.ts#L320), with an additional time delay between attempts (say exponential back-off up till 2-5 minutes), so that there is a chance of recovery from such removal failures.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.