au
au copied to clipboard
plugin: git (toggle skip ci)
need a flag to toggle [skip ci]
Use case:
If CI (example Jenkins) is completely skipped with this flag, and a gitrepo is updated in a way unbeknownst to the CI server, then the CI server's concept of PREVIOUS_COMMIT will be the last commit it
knows about.
In the case where [skip ci] is used, it would be the commits before AU ran, instead of the actual last commit.
So in this case the workaround is to allow AU to run thru CI/CD tools, and have a conditional that checks to see if this is an AU commit and noop it, providing a functionally equivlant outcome.
Well, sounds like a funky case, and I am sure it doesn't deserve implementation, because even if there is git plugin option to not use [skip ci]
during commit you still have to change build runner to provide equivalent. But you can also change it to update $Env:PREVIOUS_COMMIT
yourself, by using something like:
$env:PREVIOUS_COMMIT=(git log -n 2 --pretty=oneline | select -skip 1) -split ' ' | select -first 1
Furthermore, I am not sure that other build servers do this the same way, for example Gitlabs CI_COMMIT_BEFORE
probably targets prior-to-last central commit, not last local commit...
Your type of solution would work should you know how many commits were merged to master. If there were a bunch, then -n is an undiscoverable available on a post-merge choco builder.
It is a funky case, but as I have been thinking about it more, I think implementation might be warranted if someone wants to have additional CI/CD functionality beyond AU.
Example: I do a lot of static analysis and linting on choco packages before a human commits. I suppose I can rerun these tests after AU processes updates.
Things I do in choco pipelines : guarantee ps1 are valid, validate all urls, ensure nuspec compliance, etc.
So I think turning this into a flag that defaults to [skip ci] in the commit msg, would present no behavioral changes, and still allow users to use CI/CD in conjunction with existing git pipelines.
Well OK, its not big deal, feel free to PR what works for you. Add another param to git plugin (and gitlab) such as [switch]$NoSkip
that you can set in your update_all
params to $true.