-
-
Notifications
You must be signed in to change notification settings - Fork 7
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
Feature: Job post-run hook #61
Comments
Makes sense. The input seems to be blocked by the XSS filter.. will fix that 👍 BYW: Interesting to hear about debops |
Regarding the post-run hook - in my opinion it would only make sense to configure it on a job-basis. Additionally I could add a repository-based post-run hook. But I think this might not have many practical use-cases. Or what do you think? |
The XSS-filter for these command-fields should now allow for such commands:
If you are interested in testing the latest version - you can do so like this:
|
I tried (by applying both commits) and I can now save the repo config, and the commit && push is well done at each start of the job. (Well, if you fix the command, because I left a defunct if ! git diff-index --quiet HEAD --; then git add . && git commit -m "Modification from $USER on $HOSTNAME" && git push; else git pull; fi Now, it would be perfect if this command could be run after job execution, not before ;-) I'm in favor of a repository-based post-run hook, because you don't want to forget to add the post-hook on each and every job you may create based on the same repo. |
Alright. Hope I find time to implement it tomorrow evening |
Just thinking loud: I wonder how will be handled several job executions in parallel? Due to scheduling, I guess two different jobs from the same repo could run at the same time:
Job2 would commit files created by Job1 before Job1 could. So I guess it's confirming the hook should be at repo level (not job). But it's also showing that we should not have job's info (name, etc.) available in the hook, as it may actually be from another job. |
I guess those race-conditions could be tackled by using the git-repo-isolation (separated repo-clone per run) |
The cleanup-hook seems to work:
|
Feel free to test it. |
For my use case, it's just perfect! Thank you very much!! 🙇 Are you going to publish it to PyPI? |
Sure. Just wanted to wait for your response before releasing it (: |
Scope
Service (Job Scheduling, Job Preparation)
Description
We use (and love) Debops Ansible collection, which use git repo to store data, like TLS certificates (see secret for details).
I would like to use AW to yearly schedule the regeneration of private TLS certificates. But I need a way to
git commit && git push
the AW repo after the job completion. Otherwise, modification of the PKI database would be lost.As a proof of concept (though unsatisfactory, as I need to commit just after the run has succeed, not before the next run, which would be one year later!), I tried to set the Git Override Update-Command to
if ! git diff-index --quiet HEAD --; then git add . && git commit -m "Modification from $USER on $HOSTNAME" && git push; else; git pull; fi
, but I could not save:Anyway: we would love an hook-script, defined in the repository configuration, after job executions.
The text was updated successfully, but these errors were encountered: