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
This commit is contained in:
Artem Goncharov
2021-09-02 14:46:28 +02:00
committed by Artem Goncharov
parent 2cedd93c02
commit e7d7575eaf
2 changed files with 11 additions and 10 deletions

View File

@@ -9,6 +9,10 @@
block: block:
# Use chmod instead of file because ansible 2.5 file with recurse and # Use chmod instead of file because ansible 2.5 file with recurse and
# follow can't really handle symlinks to . # 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 - name: Ensure logs are readable before uploading
delegate_to: "{{ _undocumented_test_worker_node_ | default('localhost') }}" delegate_to: "{{ _undocumented_test_worker_node_ | default('localhost') }}"
command: "chmod -R u=rwX,g=rX,o=rX {{ zuul.executor.log_root }}/" command: "chmod -R u=rwX,g=rX,o=rX {{ zuul.executor.log_root }}/"

View File

@@ -30,9 +30,14 @@
aws_access_key: "{{ zuul_log_aws_access_key }}" aws_access_key: "{{ zuul_log_aws_access_key }}"
aws_secret_key: "{{ zuul_log_aws_secret_key }}" aws_secret_key: "{{ zuul_log_aws_secret_key }}"
- name: Create tempdir to upload to s3 - name: Create Logdir
tempfile: become: true
file:
state: directory state: directory
path: "{{ zuul.executor.log_root }}"
mode: "0755"
group: "zuul"
owner: "zuul"
register: fake_zuul_logdir register: fake_zuul_logdir
- name: Add content to tempfile - name: Add content to tempfile
@@ -40,19 +45,11 @@
content: "{{ test_content }}" content: "{{ test_content }}"
dest: "{{ fake_zuul_logdir.path }}/testfile" 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 - name: Upload file to s3
include_role: include_role:
name: upload-logs-s3 name: upload-logs-s3
vars: vars:
upload_logs_s3_endpoint: 'http://localhost:9000' upload_logs_s3_endpoint: 'http://localhost:9000'
zuul: "{{ new_zuul }}"
- name: Download mc - name: Download mc
get_url: get_url: