cancel
Showing results for 
Search instead for 
Did you mean: 
smi-andrew
Mission Specialist
Mission Specialist
  • 494 Views

AAP 2.5 not using correct git branch

I have a project configured in my AAP setup that has 1-2 branches on it that I maintain.  When I go to create a template and execute it, it runs the main branch EVERY time.  If I specify the branch it still hits the main branch.  I can't figure out why.  I have a ticket opened with support and it we haven't gotten very far.  I have tried to specify it IN the project, still fails.  This fails in the template and workflow template.  I'm running 2.5-12

Labels (3)
5 Replies
smi-andrew
Mission Specialist
Mission Specialist
  • 482 Views

I do have allow branch override checked and track submodules.

TudorRaduta
Community Manager
Community Manager
  • 453 Views

I’m not an Ansible engineer, but with my support background, I took a stab at researching few possible solutions:

  1. Job Template doesn’t enable “Update Revision on Launch”
    Without this setting, AAP uses the cached project revision, which defaults to main.
    Possible fix: In the Job Template, check the “Update Revision on Launch” option to force a fresh pull of the correct branch.
    Reference: https://docs.ansible.com/automation-controller/4.0.1/html/userguide/projects.html#scm-update-options

  2. Branch override is not set directly in the Job Template or Workflow node
    Specifying the branch in the project only sets the default. Each job or workflow node must explicitly override it to use a different one.
    Possible fix: In the Job Template, set the SCM Branch field to the desired branch (e.g., dev), or enable “Prompt on Launch”. In Workflow Templates, set the branch on each node.
    Reference: https://docs.ansible.com/automation-controller/4.1.0/html/userguide/job_templates.html#scm-branch

  3. Workflow node does not inherit SCM override unless Job Template allows prompt
    Workflow templates can pass the branch only if the Job Template allows it via prompt. Otherwise, it defaults to the project’s branch setting.
    Possible fix: Enable “Prompt on Launch” for SCM Branch in the Job Template used in the workflow. Then either pass the branch at launch or set it in each node.
    Reference: https://docs.ansible.com/ansible-tower/latest/html/userguide/workflow_templates.html#scm-branch

  4. Submodule is still pinned to main
    If the project uses submodules, they often point to a fixed commit or the main branch. Even if you switch the top-level branch, the submodule may still be pulling main.
    Possible fix: In your dev branch, update the submodule reference to the correct commit or branch, and commit the change.
    Reference: https://git-scm.com/book/en/v2/Git-Tools-Submodules

 

0 Kudos
smi-andrew
Mission Specialist
Mission Specialist
  • 432 Views

I feel like the number 4 is my issue.  Only because I went through all the others.

smi-andrew
Mission Specialist
Mission Specialist
  • 336 Views

So i'm still working with support on this.  I have tried overriding the branch in the project, the template, AND the workflow template.  It still fails.  I have unchecked Track Submodules since that is apparently for subversion.  But the only way I can get AAP to use my branch is to specify the role in requirements.yml and then add the version (branch) to that statement.  If I remove it or comment it out AAP will NOT recognize my overriding configuration.  This looks like a bug.

smi-andrew
Mission Specialist
Mission Specialist
  • 330 Views

I think I have gone through and cloned my entries and specified the branch in the project, the template, and the workflow template.  It still fails to run my branch.

Join the discussion
You must log in to join this conversation.