Skip to content

Commit

Permalink
Merge pull request EESSI#180 from bedroge/reprod
Browse files Browse the repository at this point in the history
Add reprod task to Ansible role
  • Loading branch information
trz42 authored Apr 19, 2023
2 parents 388fde0 + 75b1475 commit b8cbec3
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 0 deletions.
8 changes: 8 additions & 0 deletions ansible/playbooks/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
| --- | --- |
Expand Down
5 changes: 5 additions & 0 deletions ansible/playbooks/roles/compatibility_layer/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
5 changes: 5 additions & 0 deletions ansible/playbooks/roles/compatibility_layer/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
52 changes: 52 additions & 0 deletions ansible/playbooks/roles/compatibility_layer/tasks/reprod.yml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit b8cbec3

Please sign in to comment.