#486  Cache is not saved (even partially) when a build times out
Closed
Stephen S opened 2 years ago

One of my builds takes a long time and timed out. Of course, I am aware that I may increase the time out period, but nevertheless the build failed. I noticed the cache was not updated at each step of the build: it had to be completely rebuilt by the nex build.

I think you should save the cache even when a build fails on time-out, so that it may be used by the next one.

Robin Shen commented 2 years ago

OneDev mounts a directory to be used as cache (or create symbol link when shell executor is used instead of docker executor), and does not have any special "save cache" or "upload cache" action. Even if build is timed out or failed, the file written to cache will still be available for subsequent builds.

I tested with below build spec:

version: 13
jobs:
- name: CI
  steps:
  - !CommandStep
    name: build
    image: alpine
    commands:
    - cd npm
    - touch somefile
    - sleep 60
    useTTY: false
    condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
  retryCondition: never
  maxRetries: 3
  retryDelay: 30
  cpuRequirement: 500
  memoryRequirement: 256
  caches:
  - key: npm
    path: npm
  timeout: 10

After build finishes, check directory <OneDev install dir>/cache/npm/<some uuid> and you will find touched file somefile there.

Robin Shen changed state to 'Closed' 2 years ago
Previous Value Current Value
Open
Closed
issue 1 of 1
Type
Improvement
Priority
Minor
Assignee
Issue Votes (0)
Watchers (3)
Reference
onedev/server#486
Please wait...
Page is in error, reload to recover