ansible / awx

AWX provides a web-based user interface, REST API, and task engine built on top of Ansible. It is one of the upstream projects for Red Hat Ansible Automation Platform.
Other
14k stars 3.42k forks source link

Unable to run `git describe` on localhost for current running template #6951

Open gforster opened 4 years ago

gforster commented 4 years ago
ISSUE TYPE
SUMMARY

git commands for currently used repo are unavailable. Unable to run git describe on localhost for current running template

ENVIRONMENT
STEPS TO REPRODUCE

Run the following tasks:

EXPECTED RESULTS

v1.3.0-5-5c1f940

ACTUAL RESULTS

TASK get last git tag] *** fatal: [my-test-host -> localhost]: FAILED! => {"changed": true, "cmd": ["git", "describe"], "delta": "0:00:00.010565", "end": "2020-05-06 17:34:22.161630", "msg": "non-zero return code", "rc": 128, "start": "2020-05-06 17:34:22.151065", "stderr": "fatal: No names found, cannot describe anything.", "stderr_lines": ["fatal: No names found, cannot describe anything."], "stdout": "", "stdout_lines": []}

ADDITIONAL INFORMATION
wenottingham commented 4 years ago

We make a copy of the repo for playbook execution; it may not be able to be treated as a live repo.

What automation decisions/tasks are you using this information to inform?

gforster commented 4 years ago

In doing a server build, I need to create a set of local facts, the most important being the version of the build, which is equal to the git tag. This allows me to treat servers appropriately based on the version of the Ansible playbook that provisioned them. This works wonderfully well in Ansible engine.

Sent with GitHawk

ryanpetrello commented 4 years ago

Hey @gforster,

I'm guessing the way that AWX copies the repo for playbook execution probably isn't persisting tags. Would something like git rev-parse --short HEAD meet your needs, or do you actually need the git tag?