Files
home-cluster/bootstrap/tasks/validation/github.yaml
T
Devin Buhl 1ec59d1559 feat: add advanced features to config (#1208)
* feat: add advanced features to config

Signed-off-by: Devin Buhl <devin@buhl.casa>

* fix: only enable longhorn if distro is k3s or k0s

Signed-off-by: Devin Buhl <devin@buhl.casa>

* fix: update ansible lint

Signed-off-by: Devin Buhl <devin@buhl.casa>

---------

Signed-off-by: Devin Buhl <devin@buhl.casa>
2024-01-20 12:27:20 -05:00

49 lines
2.2 KiB
YAML

---
- name: Query Github username
when: not ci_test|default(false)
ansible.builtin.uri:
url: https://api.github.com/users/{{ bootstrap_github_username }}
timeout: 5
return_content: true
body_format: json
register: result
- name: Check if username exists
when: not ci_test|default(false)
ansible.builtin.assert:
that: result.json.login == bootstrap_github_username
success_msg: Github user {{ bootstrap_github_username }} exists
fail_msg: Github user {{ bootstrap_github_username }} does not exist
- name: Query Github repo
when: (not ci_test|default(false)) and (not bootstrap_private_github_repo|default(false))
ansible.builtin.uri:
url: https://api.github.com/repos/{{ bootstrap_github_username }}/{{ bootstrap_github_repository_name }}
timeout: 5
return_content: true
body_format: json
register: result
- name: Check if repo exists
when: (not ci_test|default(false)) and (not bootstrap_private_github_repo|default(false))
ansible.builtin.assert:
that: result.json.full_name == bootstrap_github_username + '/' + bootstrap_github_repository_name
success_msg: Github repo {{ bootstrap_github_username }}/{{ bootstrap_github_repository_name }} exists
fail_msg: Github repo {{ bootstrap_github_username }}/{{ bootstrap_github_repository_name }} does not exist
- name: Query Github repo branch
when: (not ci_test|default(false)) and (not bootstrap_private_github_repo|default(false))
ansible.builtin.uri:
url: https://api.github.com/repos/{{ bootstrap_github_username }}/{{ bootstrap_github_repository_name }}/branches/{{ bootstrap_github_repository_branch|default('main', true) }}
timeout: 5
return_content: true
body_format: json
register: result
- name: Check if repo branch exists
when: (not ci_test|default(false)) and (not bootstrap_private_github_repo|default(false))
ansible.builtin.assert:
that: result.json.name == bootstrap_github_repository_branch|default('main', true)
success_msg: Github repo branch {{ bootstrap_github_repository_branch|default('main', true) }} exists
fail_msg: Github repo branch {{ bootstrap_github_repository_branch|default('main', true) }} does not exist