Wandalen / wretry.action

Retry action for Github CI
MIT License
99 stars 22 forks source link

Post-running, regardless of condition #150

Closed alonm-upstream closed 6 months ago

alonm-upstream commented 7 months ago

Hey, i am using the Wandalen/wretry.action@v3.1.0 action and i have an issue where we push docker images to 2 different repositories, and we have an issue with just one repository and we want to implement the retry only for this one. We push to 2 repositories using this configuration:

  build_and_upload_image:
    name: build_and_upload_image
    timeout-minutes: 60
    needs: release_drafter_publish
    if: always()
    runs-on: ubuntu-latest
    env:
      IMAGE_VERSION: ${{ needs.release_drafter_publish.outputs.version }}
    strategy:
      matrix:
        mode: [repository_A, repository_B]
    steps: ...

And we have an issue that when the matrix mode is repository_A and the retry get canceled (as the condition is ${{ failure() && (matrix.mode == 'repository_B') }}), the post retry action tries to run either way and failes. Can you add a fix that the condition for the main action will apply to the post action? so when the main will not run the post will not run as well.

(For some reason the post tries to push the image and acts the same as the main action) Thank you!

Screenshot 2024-04-04 at 11 26 47

dmvict commented 7 months ago

Hello @alonm-upstream

The action description has line

Executes only the main script of Docker actions, excluding pre-entrypoint and post-entrypoint scripts.

It throws error when Docker actions has pre or post entrypoint. While it is relatively simple to bypass the pre or post stages, implementing a proper handling of these stages will require more time. I will work on implementing this feature. However, I cannot provide a definite timeline for its completion, as I have another work and the solution may take some time to ensure that it is properly executed.

dmvict commented 7 months ago

Hello @alonm-upstream

I've released new version of action. It supports pre and post stages of docker actions and handles conditions in pre-if and post-if fields. Please, try v3.2.0.