Przeglądaj źródła

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>
create-pull-request/i18n
Slavi Pantaleev 15 godzin temu
rodzic
commit
6b4b7647e4
1 zmienionych plików z 17 dodań i 0 usunięć
  1. +17
    -0
      roles/custom/matrix-synapse-usage-exporter/tasks/setup_install.yml

+ 17
- 0
roles/custom/matrix-synapse-usage-exporter/tasks/setup_install.yml Wyświetl plik

@@ -43,6 +43,19 @@

- when: "matrix_synapse_usage_exporter_container_image_self_build | bool"
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
ansible.builtin.git:
repo: "{{ matrix_synapse_usage_exporter_container_image_self_build_repo }}"
@@ -51,6 +64,10 @@
force: "yes"
become: true
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

- name: Check if synapse-usage-exporter Docker image exists


Ładowanie…
Anuluj
Zapisz