• R/O
  • HTTP
  • SSH
  • HTTPS

提交

标签
No Tags

Frequently used words (click to add to your profile)

javaandroidc++linuxc#objective-ccocoa誰得qtrubypythongamewindowsbathyscaphephpguic翻訳omegattwitterframeworktestbtronarduinovb.net計画中(planning stage)directxpreviewerゲームエンジンdom

the default GitOps source repository for booting up Jenkins X


Commit MetaInfo

修订版e46f7aff732be2ac55e2f172436e32add6ecdf1b (tree)
时间2019-09-12 21:57:00
作者Cai Cooper <caicooper82@gmai...>
CommiterCai Cooper

Log Message

feat: script which upserts domains for testing

Signed-off-by: Cai Cooper <caicooper82@gmail.com>

更改概述

差异

--- /dev/null
+++ b/bdd/upsert_bdd_domains.sh
@@ -0,0 +1,61 @@
1+#!/usr/bin/env bash
2+
3+BDD_PROJECT="jenkins-x-bdd3"
4+PARENT_PROJECT="jenkins-x-rocks"
5+PREFIXES=("boot" "boot1" "boot2" "boot3" "boot4" "boot5" "boot6" "boot7" "boot8" "boot9" "boot10" "boot11" "boot12")
6+SUBDOMAIN="bdd.jenkins-x.rocks"
7+
8+function does_subdomain_exist()
9+{
10+ local domain=$1
11+ gcloud dns managed-zones --project=$BDD_PROJECT list --filter=$domain --format=json | jq length
12+}
13+
14+function get_domain_nameservers()
15+{
16+ local domain=$1
17+ local project=$2
18+ gcloud dns managed-zones --project=$project list --filter=$domain --format=json | jq .[].nameServers
19+}
20+
21+function get_recordset_nameservers()
22+{
23+ #TODO
24+ echo "TODO"
25+}
26+
27+function create_subdomain()
28+{
29+ local domain=$1
30+ gcloud dns managed-zones --project=$BDD_PROJECT create "${domain//\./-}" --dns-name "${domain}." --description="managed-zone for bdd tests"
31+}
32+
33+function create_recordset_ns_entry()
34+{
35+ #TODO
36+ echo "TODO"
37+}
38+
39+function create_managed_zone()
40+{
41+ #TODO
42+ echo "TODO"
43+}
44+
45+for prefix in "${PREFIXES[@]}"
46+do
47+ domain="${prefix}.${SUBDOMAIN}"
48+ exists=$(does_subdomain_exist "${domain}")
49+
50+ if [[ $exists -eq 0 ]]
51+ then
52+ echo "$domain doesn't exist"
53+ #create_subdomain "${domain}"
54+ else
55+ echo "$domain exists"
56+ child_nameservers="$(get_domain_nameservers "${domain}" "${BDD_PROJECT}")"
57+ parent_nameservers="$(get_recordset_nameservers "${domain}" "${PARENT_PROJECT}")"
58+ echo "${child_nameservers}"
59+ fi
60+done
61+