Skip to content

Commit

Permalink
Merge pull request #110 from roles-ansible/v
Browse files Browse the repository at this point in the history
Create better error message for forgejo releases
  • Loading branch information
DO1JLR authored May 9, 2023
2 parents 643d9c3 + 446d20c commit 2efc177
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
20 changes: 13 additions & 7 deletions tasks/set_forgejo_version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,24 @@
gitea_version_target: "{{ gitea_remote_version }}"
when: not ansible_check_mode

- name: "Set gitea version target {{ gitea_version }}"
- name: "Set forgejo version target {{ gitea_version }}"
ansible.builtin.set_fact:
gitea_version_target: "{{ gitea_version }}"
when: gitea_version != "latest"

- name: "Get specific forgejo release metadata"
ansible.builtin.uri:
url: 'https://codeberg.org/api/v1/repos/forgejo/forgejo/releases/tags/v{{ gitea_version_target }}'
return_content: true
register: gitea_forgejo_remote_tags_metadata
become: false
- name: "Download forgejo version {{ gitea_version_target }}"
when: not ansible_check_mode
block:
- name: "Get specific forgejo release metadata"
ansible.builtin.uri:
url: 'https://codeberg.org/api/v1/repos/forgejo/forgejo/releases/tags/v{{ gitea_version_target }}'
return_content: true
register: gitea_forgejo_remote_tags_metadata
become: false
rescue:
- name: "Error Downloading https://codeberg.org/api/v1/repos/forgejo/forgejo/releases/tags/v{{ gitea_version_target }}"
ansible.builtin.fail:
msg: "We did not find the forgejo version you specified. Are you sure that '{{ gitea_version_target }}' is a valid forgejo version?"

- name: "Generate forgejo download url"
ansible.builtin.set_fact:
Expand Down
2 changes: 1 addition & 1 deletion vars/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,5 +62,5 @@ transfer_custom_footer:
- 'files/gitea_footer/extra_links_footer.tmpl'
- 'files/extra_links_footer.tmpl'

playbook_version_number: 45 # should be int
playbook_version_number: 46 # should be int
playbook_version_path: 'do1jlr.gitea.version'

0 comments on commit 2efc177

Please sign in to comment.