-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Suggestion : Cancel Previous Runs #5
Comments
@julienma I suggest we try to add This would allow users to add the |
@obrassard actually I'm not sure this is a good idea to always unlock deploy when this action runs. There might be genuine reason for the deploy to be locked, e.g. if another deploy has been requested manually, or if there are other things happening on dokku's side (e.g. rebuild, update, etc.). I see 3 options:
I'm not really sure of the implications of canceling the deploy lock in any case... |
Your third option (creating our own cancel action) seems like a good compromise since the force unlock will only be triggered if there is currently a build running. This reduce the chances of errors and I think we can assume that if a build is running it is likely that an update or or other locking process isn't running on Dokku's side. Else maybe we could include those features in this action by adding optional parameters that would let users choose if they want to cancel running builds and then if they want to force unlock their app before deployments in this case. |
I've made a test with one of my dokku apps that uses this action. I created a dummy commit, waited for the action to start, and then committed again and I manually cancelled the last running build. The second build then failed because of a deploy lock. This leads me to believe that we will have no choice but to somehow unlock the app deployment if we want next builds to work. |
I am also wondering if it would be possible to add a "post job cleanup" step to our action that would call This is an example of "post job" in github's Update : it seems to be possible with the |
Oooh this is a great idea! I won't have time to help with this now, but I'll happily comment on your experiments ;) |
FYI @julienma I received a pretty neat answer to my question and I confirm that post-entrypoints will always run even if a build is cancelled! Moreover it is possible to run the post script only on cancellation! Knowing this, we could simply add a post-script to the action so we can unlock the app on cancellation and then add ˋstyfle/cancel-workflow-actionˋ to the suggested workflow (no need to develop a new cancel workflow action in this case) 😀 |
Ha, that’s neat! If I understand correctly, you can embed a |
As you may have seen, I created a PR (#7) with the modifications we discussed and it works quite well! When we manually cancel a build, everything works as expected and the application is indeed unlocked on Dokku. Also, if the build is not cancelled the However, sometimes there is an issue when used alongside with I don't know if there's anything we can do about it. In any case, it is certain that "Rerun all jobs" will work afterwards, since the app will be unlocked in build A. But for sure it is less convenient to manually re-run the build. |
Salut Olivier :) Tu es québecois ? Le français me va très bien, mais ce sera sans doute plus facile pour d'autres de collaborer si on continue en anglais ?
Weird, I'd have thought that canceling the job and unlocking would happen before the push. It could be done either in dokku-unlock.sh or in the workflow file: jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Cancel Previous Runs # Optional step
uses: styfle/cancel-workflow-action@0.4.0
with:
access_token: ${{ github.token }}
- name: Cloning repo # This step is required
uses: actions/checkout@v2
with:
fetch-depth: 0 # This is required or you might get an error from Dokku
+ - run: echo 'Giving some time for apps:unlock to happen...'; sleep 5;
- name: Push to dokku
uses: obrassard/action-dokku-deploy@v1.0.3
with:
dokku_repo: 'ssh://dokku@dokku.myhost.ca:22/appname'
ssh_key: ${{ secrets.SSH_KEY }}
deploy_branch: 'develop' WDYT? |
Yeah the Do you know if we can listen for an action result in order to add a step ? I mean if we could catch the result of |
Else we could fork |
Yeah, bummer.
No idea, but that'd be great. Guess we could ask @styfle?
Agree, if the above doesn't work. |
Maybe you're looking for Advanced Usage? https://github.com/styfle/cancel-workflow-action#advanced Or maybe you need outputs? https://github.com/actions/hello-world-javascript-action/blob/ae53f59fd519c0006ceb494ecbfed5f05d4151cf/action.yml#L8-L10 I'm not sure I understand the problem. |
Hello @styfle, I hope you're doing well ! Indeed, when dokku deployments starts, the remote server add a "deployment lock" on apps to prevent concurrent deployments. To fix that we've implemented a Since we don't want to add a useless delay when there is no cancellation (when no other builds are running), we must find a way to run the "delay step" only if |
What output would you expect? If you submit a PR to |
I really liked the direction you were going! Is adding outputs and capturing that on #7 the remaining piece of the puzzle? This would take this action to a new level. 👏 |
Posting this for reference. |
Hello @miguelcobain I hope you're doing well! Were you asking me this because you would like to work on this feature ? 😄 I kinda ran out of time in the last weeks but indeed, all that is missing is the possibility to perform an action (i.e. wait x seconds) when a previous build is cancelled by In other words, we need to make a PR to |
@obrassard yes, I'll try to work on it. |
@miguelcobain Nice ! I am glad to hear that ! For your information, I just came across this issue : styfle/cancel-workflow-action#26 |
@miguelcobain Someone is working on that actually. |
Well, finally this issue is not resolved! @miguelcobain are you still interested working on that ? |
Resolves #114. However this probably still won't work perfectly, as seems to be no easy way to tell Dokku to cancel an in-progress deploy, but this should at least ensure lots of deploy actions not in progress/failing at once, blocking the latest deploy from happening. Related issue: obrassard/action-dokku-push#5.
We should find a way to cancel a running workflow without locking the dokku app
Suggested solution by @julienma :
The text was updated successfully, but these errors were encountered: