diff --git a/ansible/playbooks/README.md b/ansible/playbooks/README.md index 73ddbb8d..fca3f106 100644 --- a/ansible/playbooks/README.md +++ b/ansible/playbooks/README.md @@ -55,6 +55,14 @@ Before running the playbook, make sure the following settings are correct, and o | reframe_venv | Path where a virtual environment will be created for the ReFrame installation | | symlinks_to_host | List of paths that should get a symlink to the corresponding host path | +### Reproducibility settings +| Variable | Description | +| --- | --- | +| prefix_reprod_dir | Name of subdirectory for storing reproducibility information | +| prefix_packages_file | Filename for storing list of installed packages | +| prefix_metadata_json | Filename for storing metadata of build | + + ### Logging | Variable | Description | | --- | --- | diff --git a/ansible/playbooks/roles/compatibility_layer/defaults/main.yml b/ansible/playbooks/roles/compatibility_layer/defaults/main.yml index 4a0ccaac..7a6ec0ed 100644 --- a/ansible/playbooks/roles/compatibility_layer/defaults/main.yml +++ b/ansible/playbooks/roles/compatibility_layer/defaults/main.yml @@ -41,6 +41,11 @@ prefix_install: >- {{ prefix_use_builtin_bootstrap | ternary('/usr/local/bin/bootstrap-prefix.sh', prefix_custom_bootstrap_script.remote) }} {{ prefix_source_options }} +# Reproducibility settings +prefix_reprod_dir: reprod +prefix_packages_file: packages.txt +prefix_metadata_json: build.json + # Logging eessi_log_dir: "/tmp/eessi-logs" prefix_build_log: "{{ eessi_log_dir }}/prefix-build.log" diff --git a/ansible/playbooks/roles/compatibility_layer/tasks/main.yml b/ansible/playbooks/roles/compatibility_layer/tasks/main.yml index 341cbb57..7a45863a 100644 --- a/ansible/playbooks/roles/compatibility_layer/tasks/main.yml +++ b/ansible/playbooks/roles/compatibility_layer/tasks/main.yml @@ -46,3 +46,8 @@ ansible.builtin.include_tasks: test.yml tags: - test + +- name: Save reproducibility information for this build + ansible.builtin.include_tasks: reprod.yml + tags: + - reprod diff --git a/ansible/playbooks/roles/compatibility_layer/tasks/reprod.yml b/ansible/playbooks/roles/compatibility_layer/tasks/reprod.yml new file mode 100644 index 00000000..36931898 --- /dev/null +++ b/ansible/playbooks/roles/compatibility_layer/tasks/reprod.yml @@ -0,0 +1,52 @@ +# Store some information and scripts that were used for this installation. +--- + +- name: Make a subdirectory for storing build information + ansible.builtin.file: + path: "{{ gentoo_prefix_path }}/{{ prefix_reprod_dir }}" + state: directory + mode: '0755' + tags: + - reprod + +- name: Copy the used bootstrap script + ansible.builtin.copy: + src: "{{ prefix_use_builtin_bootstrap | ternary('/usr/local/bin/bootstrap-prefix.sh', prefix_custom_bootstrap_script.remote) }}" + dest: "{{ gentoo_prefix_path }}/{{ prefix_reprod_dir }}/bootstrap-prefix.sh" + mode: '0644' + tags: + - reprod + +- name: Get list of installed packages + ansible.builtin.command: "qlist -IRv" + changed_when: false + register: qlist + tags: + - reprod + +- name: Dump list of installed packages to a file + ansible.builtin.copy: + content: "{{ qlist.stdout }}" + dest: "{{ gentoo_prefix_path }}/{{ prefix_reprod_dir }}/{{ prefix_packages_file }}" + mode: '0644' + tags: + - reprod + +- name: Store other metadata of build in a json file + ansible.builtin.copy: + content: "{{ metadata | to_nice_json }}" + dest: "{{ gentoo_prefix_path }}/{{ prefix_reprod_dir }}/{{ prefix_metadata_json }}" + mode: '0644' + vars: + metadata: + username: "{{ ansible_user_id }}" + userid: "{{ ansible_user_uid }}" + timestamp: "{{ ansible_date_time.iso8601 }}" + hostname: "{{ ansible_hostname }}" + host_os: "{{ ansible_distribution }} {{ ansible_distribution_version }}" + host_kernel: "{{ ansible_kernel }}" + host_memory: "{{ ansible_memory_mb.real }}" + host_mounts: "{{ ansible_mounts }}" + gentoo_git_commit: "{{ gentoo_git_commit }}" + tags: + - reprod