|
45 | 45 | - install |
46 | 46 | - install:base |
47 | 47 |
|
48 | | -# Do A Checkout |
49 | | -# Ensure correct ownership of edx-platform directory before git operations |
50 | | -# to avoid Git's "dubious ownership" protection (introduced in Git 2.35.2+) |
51 | | -- name: ensure edx-platform directory is owned by {{ edxapp_user }} |
| 48 | +# Ensure all files in code dir are owned by the edxapp user. For unknown |
| 49 | +# reasons, we sometimes get stale files here that are owned by root or some |
| 50 | +# other user. (From successive builds of the same edx-platform commit sharing a |
| 51 | +# builder instance, perhaps?) This then causes `git clean` to fail with |
| 52 | +# "Permission denied" on various static-asset paths. |
| 53 | +- name: ensure edx-platform repo files are owned by {{ edxapp_user }} |
52 | 54 | file: |
53 | 55 | path: "{{ edxapp_code_dir }}" |
54 | 56 | state: directory |
55 | 57 | owner: "{{ edxapp_user }}" |
56 | 58 | group: "{{ edxapp_user }}" |
57 | | - # Do not recurse - git module will handle file ownership within the repo |
58 | | - recurse: no |
59 | | - tags: |
60 | | - - install |
61 | | - - install:code |
62 | | - |
63 | | -# Configure Git safe.directory for edxapp user to prevent "dubious ownership" errors |
64 | | -# when running git commands on the edx-platform repository. Uses --global scope |
65 | | -# (not --local) because the configuration is needed before the repository is cloned. |
66 | | -- name: check if edx-platform is already in git safe.directory |
67 | | - command: git config --global --get-all safe.directory |
68 | | - become_user: "{{ edxapp_user }}" |
69 | | - register: safe_directory_check |
70 | | - changed_when: false |
71 | | - # Git config returns exit code 1 when no entries exist, which is expected |
72 | | - failed_when: false |
73 | | - tags: |
74 | | - - install |
75 | | - - install:code |
76 | | - |
77 | | -- name: add edx-platform to git safe.directory |
78 | | - command: git config --global --add safe.directory '{{ edxapp_code_dir }}' |
79 | | - become_user: "{{ edxapp_user }}" |
80 | | - when: edxapp_code_dir not in (safe_directory_check.stdout_lines | default([])) |
| 59 | + recurse: yes |
81 | 60 | tags: |
82 | 61 | - install |
83 | 62 | - install:code |
|
0 commit comments