mirror of
https://github.com/spantaleev/matrix-docker-ansible-deploy.git
synced 2026-07-14 02:41:14 +03:00
Fix synapse-usage-exporter self-build failing on git ownership checks
synapse-usage-exporter is self-built by default (no upstream image is published), so every user enabling it runs the git clone/update task. A docker-src checkout whose files are owned by a different user (e.g. left behind by an earlier clone) made that task fail: either with a permission error, or with git's dubious-ownership protection, which ignores the repository's own configuration and surfaces as a confusing "'origin' does not appear to be a git repository" error. Ensure the checkout's ownership recursively before updating it, and mark the path as a safe.directory for the git invocation itself (via GIT_CONFIG_* environment variables), so the ownership check cannot misfire regardless of which user git effectively runs as. Fixes #5065 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -43,6 +43,19 @@
|
|||||||
|
|
||||||
- when: "matrix_synapse_usage_exporter_container_image_self_build | bool"
|
- when: "matrix_synapse_usage_exporter_container_image_self_build | bool"
|
||||||
block:
|
block:
|
||||||
|
# A repository left behind with different file ownership (e.g. cloned by another user in the past)
|
||||||
|
# would make the git update below fail, either with a permission error or with git's
|
||||||
|
# dubious-ownership protection kicking in (which manifests as a confusing
|
||||||
|
# "'origin' does not appear to be a git repository" error, because git ignores
|
||||||
|
# the repository's own configuration in that case).
|
||||||
|
- name: Ensure synapse-usage-exporter repository ownership is correct on self-build
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: "{{ matrix_synapse_usage_exporter_docker_src_files_path }}"
|
||||||
|
state: directory
|
||||||
|
owner: "{{ matrix_user_name }}"
|
||||||
|
group: "{{ matrix_group_name }}"
|
||||||
|
recurse: true
|
||||||
|
|
||||||
- name: Ensure synapse-usage-exporter repository is present on self-build
|
- name: Ensure synapse-usage-exporter repository is present on self-build
|
||||||
ansible.builtin.git:
|
ansible.builtin.git:
|
||||||
repo: "{{ matrix_synapse_usage_exporter_container_image_self_build_repo }}"
|
repo: "{{ matrix_synapse_usage_exporter_container_image_self_build_repo }}"
|
||||||
@@ -51,6 +64,10 @@
|
|||||||
force: "yes"
|
force: "yes"
|
||||||
become: true
|
become: true
|
||||||
become_user: "{{ matrix_user_name }}"
|
become_user: "{{ matrix_user_name }}"
|
||||||
|
environment:
|
||||||
|
GIT_CONFIG_COUNT: "1"
|
||||||
|
GIT_CONFIG_KEY_0: safe.directory
|
||||||
|
GIT_CONFIG_VALUE_0: "{{ matrix_synapse_usage_exporter_docker_src_files_path }}"
|
||||||
register: matrix_synapse_usage_exporter_git_pull_results
|
register: matrix_synapse_usage_exporter_git_pull_results
|
||||||
|
|
||||||
- name: Check if synapse-usage-exporter Docker image exists
|
- name: Check if synapse-usage-exporter Docker image exists
|
||||||
|
|||||||
Reference in New Issue
Block a user