From e2f609a82511a8138209d6daf93010f99511c042 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bob=20Dr=C3=B6ge?= Date: Tue, 18 Apr 2023 10:52:50 +0200 Subject: [PATCH 1/5] add variables for reproducibility task --- .../playbooks/roles/compatibility_layer/defaults/main.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ansible/playbooks/roles/compatibility_layer/defaults/main.yml b/ansible/playbooks/roles/compatibility_layer/defaults/main.yml index d464ac8f..4b5ea30d 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" From dec2216463f298e360fd43ef43b4d6a2c563fbbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bob=20Dr=C3=B6ge?= Date: Tue, 18 Apr 2023 10:54:45 +0200 Subject: [PATCH 2/5] add reprod vars to README --- ansible/playbooks/README.md | 8 ++++++++ 1 file changed, 8 insertions(+) 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 | | --- | --- | From 437675e7f1e91a18ac10776892a1443a545bb3f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bob=20Dr=C3=B6ge?= Date: Tue, 18 Apr 2023 10:55:50 +0200 Subject: [PATCH 3/5] include new reprod task --- ansible/playbooks/roles/compatibility_layer/tasks/main.yml | 5 +++++ 1 file changed, 5 insertions(+) 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 From b61ecd7b267c4263fc5259c937158ecd1f88135a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bob=20Dr=C3=B6ge?= Date: Tue, 18 Apr 2023 10:56:00 +0200 Subject: [PATCH 4/5] add reprod task --- .../compatibility_layer/tasks/reprod.yml | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 ansible/playbooks/roles/compatibility_layer/tasks/reprod.yml 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..562506b9 --- /dev/null +++ b/ansible/playbooks/roles/compatibility_layer/tasks/reprod.yml @@ -0,0 +1,49 @@ +# 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" + 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 }}" + 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 }}" + 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 From 75b1475e75dc1a8966e06db3074eab1146969eb8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bob=20Dr=C3=B6ge?= Date: Wed, 19 Apr 2023 09:08:28 +0200 Subject: [PATCH 5/5] set file modes, fix spacing issue --- ansible/playbooks/roles/compatibility_layer/tasks/reprod.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ansible/playbooks/roles/compatibility_layer/tasks/reprod.yml b/ansible/playbooks/roles/compatibility_layer/tasks/reprod.yml index 562506b9..36931898 100644 --- a/ansible/playbooks/roles/compatibility_layer/tasks/reprod.yml +++ b/ansible/playbooks/roles/compatibility_layer/tasks/reprod.yml @@ -13,6 +13,7 @@ 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 @@ -27,13 +28,15 @@ 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 }}" + content: "{{ metadata | to_nice_json }}" dest: "{{ gentoo_prefix_path }}/{{ prefix_reprod_dir }}/{{ prefix_metadata_json }}" + mode: '0644' vars: metadata: username: "{{ ansible_user_id }}"