Does anyone know how AWX determines the scm_revision at the following endpoint? api/v2/inventory_sources/970/inventory_updates/
I have 800+ inventories sourced from SCM Project. I’m working on a role that will only trigger the inventory_source_update as needed, ideally only if the source file was changed. However the git commands I’m using to try and get the individual files revision doesn’t seem to line up with what AWX is getting. I’m been trying to track the code down on where that is determined but haven’t been able to find it.
The more I dig, I think the issue is this. On the inventory_source_update the scm_revision is that of the Project/remote repo. I was expecting and hoping it would be of the actual source file from the remote repo so I can compare the current value to the new value and determine if I needed to trigger an inventory sync. If its the Project scm_revision that doesn’t really help in what I’m trying to do.
The down side is that just because the head changed doesn’t mean inventory source’s changed and with as many as we have, triggering a sync on 800+ drastically slows down the UI. Even if batched the UI isn’t slow but it takes forever for the sync’s to finish. I’m trying to work around it. Since we have the current scm_revision I can do the follow to get a list of inventory files that changed and work from there.
At that point I can find the inventory_source for inventoires/my_inv_file.yml and only sync it.
Isn’t perfect but is better than syncing all of them when not needed. We can also set the Update on Launch but we’re also trying to make the customer happy who wants to be able to view the hosts/groups etc without having to do anything!