From e7d7575eaf5da61f9d331aaf982b4285064d5807 Mon Sep 17 00:00:00 2001 From: Artem Goncharov Date: Thu, 2 Sep 2021 14:46:28 +0200 Subject: [PATCH] Fix zuul-jobs-test-upload-logs-s3 job Since the security update we are not able to modify zuul.executor.log_root variable in the role testing. Replace this with explicit log folder creation on the test node. Change-Id: Ie6cff6f9e9c5594167ddda6cd345f9c3d9f2f470 --- roles/upload-logs-s3/tasks/main.yaml | 4 ++++ test-playbooks/upload-logs-s3.yaml | 17 +++++++---------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/roles/upload-logs-s3/tasks/main.yaml b/roles/upload-logs-s3/tasks/main.yaml index 385b9e2e2..61c255c7c 100644 --- a/roles/upload-logs-s3/tasks/main.yaml +++ b/roles/upload-logs-s3/tasks/main.yaml @@ -9,6 +9,10 @@ block: # Use chmod instead of file because ansible 2.5 file with recurse and # follow can't really handle symlinks to . + - name: debug var + debug: + msg: "log_root {{ zuul.executor.log_root }}" + - name: Ensure logs are readable before uploading delegate_to: "{{ _undocumented_test_worker_node_ | default('localhost') }}" command: "chmod -R u=rwX,g=rX,o=rX {{ zuul.executor.log_root }}/" diff --git a/test-playbooks/upload-logs-s3.yaml b/test-playbooks/upload-logs-s3.yaml index c99859e71..8fd70adbd 100644 --- a/test-playbooks/upload-logs-s3.yaml +++ b/test-playbooks/upload-logs-s3.yaml @@ -30,9 +30,14 @@ aws_access_key: "{{ zuul_log_aws_access_key }}" aws_secret_key: "{{ zuul_log_aws_secret_key }}" - - name: Create tempdir to upload to s3 - tempfile: + - name: Create Logdir + become: true + file: state: directory + path: "{{ zuul.executor.log_root }}" + mode: "0755" + group: "zuul" + owner: "zuul" register: fake_zuul_logdir - name: Add content to tempfile @@ -40,19 +45,11 @@ content: "{{ test_content }}" dest: "{{ fake_zuul_logdir.path }}/testfile" - - name: Save zuul variables - set_fact: - old_zuul: "{{ zuul }}" - - name: Set simulated zuul variables - set_fact: - new_zuul: "{{ old_zuul | combine({'executor': {'log_root': fake_zuul_logdir.path}}, recursive=True) }}" - - name: Upload file to s3 include_role: name: upload-logs-s3 vars: upload_logs_s3_endpoint: 'http://localhost:9000' - zuul: "{{ new_zuul }}" - name: Download mc get_url: