feat(ansible): add branch reference as variable in gitrepository (#919)

* feat: add branch reference as variable in gitrepository

* Update bootstrap/vars/config.sample.yaml

---------

Co-authored-by: Devin Buhl <onedr0p@users.noreply.github.com>
This commit is contained in:
Oscar RomeuandDevin Buhl authored and GitHub committed 2023-08-27 12:10:02 -04:00
1 parent 0db68d20b6
commit 78746180bc
4 files changed
+18 -1

No files matched your search

+14
View File
@@ -26,3 +26,17 @@
that: result.json.full_name == bootstrap_github_username + '/' + bootstrap_github_repository_name that: result.json.full_name == bootstrap_github_username + '/' + bootstrap_github_repository_name
success_msg: Github repo {{ bootstrap_github_username }}/{{ bootstrap_github_repository_name }} exists 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 fail_msg: Github repo {{ bootstrap_github_username }}/{{ bootstrap_github_repository_name }} does not exist
- name: Query Github repo branch
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
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
+1
View File
@@ -16,6 +16,7 @@
- bootstrap_cluster_cidr - bootstrap_cluster_cidr
- bootstrap_flux_github_webhook_token - bootstrap_flux_github_webhook_token
- bootstrap_github_repository_name - bootstrap_github_repository_name
- bootstrap_github_repository_branch
- bootstrap_github_username - bootstrap_github_username
- bootstrap_external_ingress_addr - bootstrap_external_ingress_addr
- bootstrap_internal_ingress_addr - bootstrap_internal_ingress_addr
@@ -7,7 +7,7 @@ metadata:
spec: spec:
interval: 30m interval: 30m
ref: ref:
branch: main branch: {{ bootstrap_github_repository_branch | default('main', true) }}
url: "https://github.com/{{ bootstrap_github_username }}/{{ bootstrap_github_repository_name }}.git" url: "https://github.com/{{ bootstrap_github_username }}/{{ bootstrap_github_repository_name }}.git"
ignore: | ignore: |
# exclude all # exclude all
+2
View File
@@ -7,6 +7,8 @@
bootstrap_github_username: bootstrap_github_username:
# Github repository (e.g. flux-cluster-template) # Github repository (e.g. flux-cluster-template)
bootstrap_github_repository_name: bootstrap_github_repository_name:
# Github repository branch (e.g. main)
bootstrap_github_repository_branch: main
# Age Public Key (e.g. age15uzrw396e67z9wdzsxzdk7ka0g2gr3l460e0slaea563zll3hdfqwqxdta) # Age Public Key (e.g. age15uzrw396e67z9wdzsxzdk7ka0g2gr3l460e0slaea563zll3hdfqwqxdta)
bootstrap_age_public_key: bootstrap_age_public_key:
# Choose your timezone (e.g. America/New_York) # Choose your timezone (e.g. America/New_York)