Commit ae9e7380 by Ned Batchelder

Fix a bug in the git module: branches might not check out properly

If a git version is specified as a branch, and the commit referred to is
already on the local working tree, but the branch is not, then the
checkout will fail.

This is because the Ansible 1.9.3 module would check to see if the
commit was already present, and if so, did not fetch. This meant the
branch wasn't defined in the local working tree.

This can happen if you make a branch but there aren't any changes on the
branch.
parent 5ef742db
......@@ -14,7 +14,7 @@
- name: stop certs service
service: name="certificates" state="stopped"
- name: checkout code
git: >
git_2_0_1: >
repo="{{ repo_url }}"
dest="{{ repo_path }}"
version="{{ certificates_version }}"
......
......@@ -15,7 +15,7 @@
notify: restart alton
- name: checkout the code
git: >
git_2_0_1: >
dest="{{ alton_code_dir }}" repo="{{ alton_source_repo }}"
version="{{ alton_version }}" accept_hostkey=yes
sudo_user: "{{ alton_user }}"
......
......@@ -83,7 +83,7 @@
- install:configuration
- name: util library source checked out
git: >
git_2_0_1: >
dest={{ analytics_pipeline_util_library.path }} repo={{ analytics_pipeline_util_library.repo }}
version={{ analytics_pipeline_util_library.version }}
tags:
......
......@@ -41,7 +41,7 @@
when: CERTS_GIT_IDENTITY != "none"
- name: checkout certificates repo into {{ certs_code_dir }}
git: >
git_2_0_1: >
dest={{ certs_code_dir }} repo={{ CERTS_REPO }} version={{ certs_version }}
accept_hostkey=yes
sudo_user: "{{ certs_user }}"
......@@ -51,7 +51,7 @@
when: CERTS_GIT_IDENTITY != "none"
- name: checkout certificates repo into {{ certs_code_dir }}
git: >
git_2_0_1: >
dest={{ certs_code_dir }} repo={{ CERTS_REPO }} version={{ certs_version }}
accept_hostkey=yes
sudo_user: "{{ certs_user }}"
......
---
- name: check out the demo course
git: >
git_2_0_1: >
dest={{ demo_code_dir }} repo={{ demo_repo }} version={{ demo_version }}
accept_hostkey=yes
sudo_user: "{{ demo_edxapp_user }}"
......
---
- name: git checkout edx_ansible repo into edx_ansible_code_dir
git: >
git_2_0_1: >
dest={{ edx_ansible_code_dir }} repo={{ edx_ansible_source_repo }} version={{ configuration_version }}
accept_hostkey=yes
sudo_user: "{{ edx_ansible_user }}"
......
......@@ -163,7 +163,7 @@
- install:code
- name: checkout code over ssh
git: >
git_2_0_1: >
repo=git@{{ item.DOMAIN }}:{{ item.PATH }}/{{ item.REPO }}
dest={{ item.DESTINATION }} version={{ item.VERSION }}
accept_hostkey=yes key_file={{ edx_service_home }}/.ssh/{{ item.REPO }}
......@@ -176,7 +176,7 @@
- install:code
- name: checkout code over https
git: >
git_2_0_1: >
repo=https://{{ item.DOMAIN }}/{{ item.PATH }}/{{ item.REPO }}
dest={{ item.DESTINATION }} version={{ item.VERSION }}
sudo_user: "{{ edx_service_user }}"
......
......@@ -63,7 +63,7 @@
# Do A Checkout
- name: checkout edx-platform repo into {{ edxapp_code_dir }}
git: >
git_2_0_1: >
dest={{ edxapp_code_dir }}
repo={{ edx_platform_repo }}
version={{ edx_platform_version }}
......@@ -90,7 +90,7 @@
# (yes, lowercase) to a Stanford-style theme and set
# edxapp_theme_name (again, lowercase) to its name.
- name: checkout Stanford-style theme
git: >
git_2_0_1: >
dest={{ edxapp_app_dir }}/themes/{{ edxapp_theme_name }}
repo={{ edxapp_theme_source_repo }}
version={{ edxapp_theme_version }}
......@@ -109,7 +109,7 @@
# EDXAPP_COMPREHENSIVE_THEME_DIR to the directory you want to check
# out to.
- name: checkout comprehensive theme
git: >
git_2_0_1: >
dest={{ EDXAPP_COMPREHENSIVE_THEME_DIR }}
repo={{ EDXAPP_COMPREHENSIVE_THEME_SOURCE_REPO }}
version={{ EDXAPP_COMPREHENSIVE_THEME_VERSION }}
......
......@@ -39,7 +39,7 @@
- install:configuration
- name: git checkout forum repo into {{ forum_code_dir }}
git: >
git_2_0_1: >
dest={{ forum_code_dir }} repo={{ forum_source_repo }} version={{ forum_version }}
accept_hostkey=yes
sudo_user: "{{ forum_user }}"
......
# Tasks to run if cloning repos to edx-platform.
- name: clone all course repos
git: dest={{ GITRELOAD_REPODIR }}/{{ item.name }} repo={{ item.url }} version={{ item.commit }}
git_2_0_1: dest={{ GITRELOAD_REPODIR }}/{{ item.name }} repo={{ item.url }} version={{ item.commit }}
sudo_user: "{{ common_web_user }}"
with_items: GITRELOAD_REPOS
......
......@@ -14,7 +14,7 @@
mode=0755
- name: check out the harprofiler
git: >
git_2_0_1: >
dest={{ harprofiler_dir }}
repo={{ harprofiler_github_url }} version={{ harprofiler_version }}
accept_hostkey=yes
......
......@@ -110,7 +110,7 @@
# upstream, we may be able to use the regular plugin install process.
# Until then, we compile and install the forks ourselves.
- name: checkout custom plugin repo
git: >
git_2_0_1: >
repo={{ item.repo_url }} dest=/tmp/{{ item.repo_name }} version={{ item.version }}
accept_hostkey=yes
with_items: jenkins_custom_plugins
......
......@@ -6,7 +6,7 @@
# refers to the --depth-setting of git clone. A value of 1
# will truncate all history prior to the last revision.
- name: Create shallow clone of edx-platform
git: >
git_2_0_1: >
repo=https://github.com/edx/edx-platform.git
dest={{ jenkins_home }}/shallow-clone
version={{ jenkins_edx_platform_version }}
......
---
- name: checkout code
git:
git_2_0_1:
dest={{ NOTIFIER_CODE_DIR }} repo={{ NOTIFIER_SOURCE_REPO }}
version={{ NOTIFIER_VERSION }}
accept_hostkey=yes
......@@ -31,7 +31,7 @@
when: NOTIFIER_GIT_IDENTITY != ""
- name: checkout theme
git: >
git_2_0_1: >
dest={{ NOTIFIER_CODE_DIR }}/{{ NOTIFIER_THEME_NAME }}
repo={{ NOTIFIER_THEME_REPO }}
version={{ NOTIFIER_THEME_VERSION }}
......
......@@ -59,7 +59,7 @@
- install:base
- name: update rbenv repo
git: >
git_2_0_1: >
repo=https://github.com/sstephenson/rbenv.git
dest={{ rbenv_dir }}/.rbenv version={{ rbenv_version }}
accept_hostkey=yes
......
......@@ -21,7 +21,7 @@
#
- name: Create clone of edx-platform
git: >
git_2_0_1: >
repo=https://github.com/edx/edx-platform.git
dest={{ test_build_server_repo_path }}/edx-platform-clone
version={{ test_edx_platform_version }}
......
......@@ -43,7 +43,7 @@
# Do A Checkout
- name: git checkout xqueue repo into xqueue_code_dir
git: >
git_2_0_1: >
dest={{ xqueue_code_dir }} repo={{ xqueue_source_repo }} version={{ xqueue_version }}
accept_hostkey=yes
sudo_user: "{{ xqueue_user }}"
......
......@@ -3,7 +3,7 @@
# a per queue basis.
- name: checkout grader code
git: >
git_2_0_1: >
dest={{ xqwatcher_app_dir }}/data/{{ item.COURSE }} repo={{ item.GIT_REPO }}
version={{ item.GIT_REF }}
ssh_opts="{{ xqwatcher_course_git_ssh_opts }}"
......
......@@ -19,7 +19,7 @@
- restart xserver
- name: checkout code
git: >
git_2_0_1: >
dest={{ xserver_code_dir }} repo={{ xserver_source_repo }} version={{xserver_version}}
accept_hostkey=yes
sudo_user: "{{ xserver_user }}"
......@@ -58,7 +58,7 @@
notify: restart xserver
- name: checkout grader code
git: >
git_2_0_1: >
dest={{ XSERVER_GRADER_DIR }} repo={{ XSERVER_GRADER_SOURCE }} version={{ xserver_grader_version }}
accept_hostkey=yes
environment:
......
......@@ -42,7 +42,7 @@
notify: restart xsy
- name: checkout the code
git: >
git_2_0_1: >
dest="{{ xsy_code_dir }}" repo="{{ xsy_source_repo }}"
version="{{ xsy_version }}" accept_hostkey=yes
sudo_user: "{{ xsy_user }}"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment