Windmill as API endpoint for active git commit

Hi Windmill Team and Users, I would like to use Windmill as an external API endpoint that will return the active git commit hash of another application. Here's what I'm currently thinking could be used to accomplish this: 1. mount the application's git directory to my windmill-work(er) container. 2. write a script to return the results of "git rev-parse HEAD" executed on the command line. Would this be my best approach?
7 Replies
rubenf
rubenf17mo ago
That works but you can you do a git fetch instead of mounting the folder
Tiago Serafim
Tiago Serafim17mo ago
Can't you do something like git ls-remote git@github.com:windmill-labs/windmill.git HEAD?
JRKLabs-Jeff Knorr-USA
That git repository isn't hosted on github/gitlab but I can see if something like that would work. It's also not guaranteed that the latest commit on the repo will be what's deployed at the application. It would be best if we're checking exactly what's deployed on the app server.
Tiago Serafim
Tiago Serafim17mo ago
Is it a web app? On a monorepo that I maintain, I use a /statusz/ endpoint that is used by K8S to signal that the pod is active and it also returns the commit hash of the deployed version, which was added to the docker image in the build process.
JRKLabs-Jeff Knorr-USA
Are you storing the commit hash as an ENV or actively looking it up? We don't currently bake our code into the container image.
Tiago Serafim
Tiago Serafim17mo ago
I build using --build-arg COMMIT_SHORT_SHA=$COMMIT_SHORT_SHA and then set it up as a ENV var inside the Dockerfile with ARG COMMIT_SHORT_SHA ENV COMMIT_SHORT_SHA="$COMMIT_SHORT_SHA".
JRKLabs-Jeff Knorr-USA
Makes sense--thank you for sharing. I have this working now with the approach that I originally described. It's very fast written as a bash script. Is there an openapi generated for our custom scripts? If so, what's the url to access it?

Did you find this page helpful?