Skip to content

Commit

Permalink
Moving the role content into the update playbook itself, and adding a…
Browse files Browse the repository at this point in the history
… conditional
  • Loading branch information
Odilhao committed Oct 14, 2022
1 parent 07e515e commit 464515b
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 26 deletions.
2 changes: 1 addition & 1 deletion obal/data/playbooks/update/metadata.obal.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@ variables:
changelog:
help: Optionally set the changelog. When unspecified, an entry will be generated
commit:
help: When true, commits the update changes to it into the current branch.
help: When true, commits the update changes to it into the current branch
action: store_true
21 changes: 15 additions & 6 deletions obal/data/playbooks/update/update.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,18 @@
when:
- "'://' not in item"

- hosts:
- packages
gather_facts: false
roles:
- when: commit is defined and commit
role: git_branch_and_commit
- name: 'Get updated version from spec'
command: "rpmspec --query --queryformat=%{version} --srpm {{ spec_file_path }}"
args:
chdir: "{{ inventory_dir }}"
changed_when: false
register: updated_version
when: commit is defined and commit

- name: 'Create git commit'
command: "git commit -a -m 'Update {{ inventory_hostname }} to {{ updated_version.stdout }}'"
args:
chdir: "{{ inventory_dir }}"
run_once: true
changed_when: true
when: commit is defined and commit
3 changes: 0 additions & 3 deletions obal/data/roles/git_branch_and_commit/meta/main.yml

This file was deleted.

14 changes: 0 additions & 14 deletions obal/data/roles/git_branch_and_commit/tasks/main.yml

This file was deleted.

4 changes: 2 additions & 2 deletions tests/fixtures/help/update.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ optional arguments:
--changelog CHANGELOG
Optionally set the changelog. When unspecified, an
entry will be generated
--commit When true, creates a commits that adds the update
changes to it.
--commit When true, commits the update changes to it into the
current branch
--prerelease PRERELEASE
Optionally set the prerelease macro. When unspecified,
the prerelease macro will be removed
Expand Down

0 comments on commit 464515b

Please sign in to comment.