Skip to content

Commit 08eb577

Browse files
authored
Merge pull request #3881 from tpurschke/feat/add-commit-id-to-etc
adding commit id to etc dir during each upgrade/install
2 parents 965a7c2 + 98bf170 commit 08eb577

File tree

3 files changed

+27
-0
lines changed

3 files changed

+27
-0
lines changed

inventory/group_vars/all.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ fworch_parent_dir: "/usr/local"
3636
fworch_home: "{{ fworch_parent_dir }}/{{ product_name }}"
3737
fworch_conf_dir: "{{ fworch_home }}/etc"
3838
fworch_conf_file: "{{ fworch_conf_dir }}/fworch.json"
39+
last_commit_id_file_path: "{{ fworch_conf_dir }}/last_commit_id.txt"
3940
fworch_secrets_dir: "{{ fworch_conf_dir }}/secrets"
4041
importer_venv_dir: "{{ fworch_home }}/importer/importer-venv"
4142

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
- block:
2+
- name: remove local copy of remote config file
3+
file:
4+
state: absent
5+
name: "temp_remote_config_file.json"
6+
7+
- name: get last commit id
8+
command: git rev-parse HEAD
9+
register: final_commit_id
10+
failed_when: false
11+
changed_when: false
12+
13+
# also handle case where we are not inside a git repo
14+
- name: determine commit id content
15+
set_fact:
16+
final_commit_id_value: "{{ final_commit_id.stdout if final_commit_id.rc == 0 else 'unknown' }}"
17+
18+
- name: write commit id to last_commit_id.txt file
19+
copy:
20+
content: "{{ final_commit_id_value }}"
21+
dest: "{{ last_commit_id_file_path }}"
22+
23+
become: true

roles/common/tasks/main.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,9 @@
279279
- name: include fworch.yaml config file creator
280280
import_tasks: conf_file_creator.yml
281281

282+
- name: include last_commit_id.txt file creator
283+
import_tasks: last_commit_id_file_creator.yml
284+
282285
- name: include upgrade script
283286
import_tasks: run-upgrades.yml
284287
when: "installation_mode == 'upgrade'"

0 commit comments

Comments
 (0)