restore-virtualenv icon indicating copy to clipboard operation
restore-virtualenv copied to clipboard

[Question] restore env when job fail

Open codebydant opened this issue 2 years ago • 3 comments

Hi @syphar,

I have a question regarding cache configuration. I have noticed that when the job running the action does not end successfully, the cache component is not stored. My suspect is because these jobs are skipped when the job fails

Screenshot from 2023-03-22 16-09-34

Do you think there is a way to tell the action to cache even if the job fails?

This is because I would like to cache dependencies always when I run my CI. Not just for success jobs

codebydant avatar Mar 22 '23 21:03 codebydant

Hi @dtcMLOps ,

this is defined in the action here: https://github.com/syphar/restore-virtualenv/blob/bb833b42c7eba4a9b92e1109bd9fe17500f8f894/action.yml#L9

the main reason back then was simplicity.

To keep in mind: you probably don't want to save the virtualenv when restoring the virtualenv failed.

I'm happy to review a PR, if you find a way to optimise this.

syphar avatar Mar 23 '23 07:03 syphar

Hi @syphar,

I would suggest having that as an input parameter to the action, something like:

with:
 save-on-fail: true

Regarding this

To keep in mind: you probably don't want to save the virtualenv when restoring the virtualenv failed.

When I am referring to a failed job, it means because it fails for something after the virtualenv, and installation dependencies, e.g.

My CI is as follows

Screenshot from 2023-03-23 06-04-15

In this case, the project dependencies and the dev dependencies are fine. The job is failing because of flake8. And every time I am running this job to validate flake8, the workflow is installing the dependencies.

codebydant avatar Mar 23 '23 11:03 codebydant

Hi @syphar,

I would suggest having that as an input parameter to the action, something like:

with:
 save-on-fail: true

That's a good idea, I'm happy to review a PR implementing this.

Regarding this

To keep in mind: you probably don't want to save the virtualenv when restoring the virtualenv failed.

When I am referring to a failed job, it means because it fails for something after the virtualenv, and installation dependencies, e.g.

My CI is as follows [...]

In this case, the project dependencies and the dev dependencies are fine. The job is failing because of flake8. And every time I am running this job to validate flake8, the workflow is installing the dependencies.

From what I know the problem is that the action wouldn't be able to differentiate between a failure after restoring from a failure while restoring.

syphar avatar Mar 27 '23 06:03 syphar