Files
zuul-jobs/roles/upload-logs-s3/tasks/main.yaml
James E. Blair 15828c7a85 Simplify testing of some upload roles
These two roles no longer need the delegation variable used in
testing, so it is removed.  Role execution now happens on the
executor.

Since the remote servers are still on the worker node, we open
the firewall on the remote node in both cases.

In the artifactory role, the ensure-docker role is moved to a
"roles" section for simplicity.  Additionally, one of the
artifactory API calls is wrapped in retries as a precaution
since I saw that fail in local testing.

Change-Id: Ia4409edc217e1935775a5aece2e7d9bcfd935762
2025-09-03 17:11:15 -07:00

51 lines
1.9 KiB
YAML

- name: Set zuul-log-path fact
include_role:
name: set-zuul-log-path-fact
when: zuul_log_path is not defined
# Always upload (true), never upload (false) or only on failure ('failure')
- name: Upload logs
when: zuul_site_upload_logs | default(true) | bool or
(zuul_site_upload_logs == 'failure' and not zuul_success | bool)
block:
# Use chmod instead of file because ansible 2.5 file with recurse and
# follow can't really handle symlinks to .
- name: Debug log_root
debug:
msg: "log_root {{ zuul.executor.log_root }}"
- name: Ensure logs are readable before uploading
delegate_to: "localhost"
command: "chmod -R u=rwX,g=rX,o=rX {{ zuul.executor.log_root }}/"
# ANSIBLE0007 chmod used in place of argument mode to file
tags:
- skip_ansible_lint
- name: Upload logs to S3
delegate_to: "localhost"
no_log: true
zuul_s3_upload:
endpoint: "{{ upload_logs_s3_endpoint | default(omit) }}"
partition: "{{ zuul_log_partition }}"
bucket: "{{ zuul_log_bucket }}"
public: "{{ zuul_log_bucket_public }}"
prefix: "{{ zuul_log_path }}"
indexes: "{{ zuul_log_create_indexes }}"
aws_access_key: "{{ zuul_log_aws_access_key | default(omit) }}"
aws_secret_key: "{{ zuul_log_aws_secret_key | default(omit) }}"
aws_oidc_role_arn: "{{ zuul_log_aws_oidc_role_arn | default(omit) }}"
aws_oidc_session_name: "{{ zuul_log_aws_oidc_session_name | default(omit) }}"
aws_oidc_token: "{{ zuul_log_aws_oidc_token | default(omit) }}"
aws_oidc_token_duration: "{{ zuul_log_aws_oidc_token_duration | default(omit) }}"
files:
- "{{ zuul.executor.log_root }}/"
register: upload_results
- name: Return log URL to Zuul
delegate_to: localhost
zuul_return:
data:
zuul:
log_url: "{{ upload_results.url }}/"
when: upload_results is defined