This commit is contained in:
2024-05-31 14:00:58 +02:00
parent dc68bd8d10
commit 2a021609b7
4 changed files with 114 additions and 17 deletions

View File

@@ -1,6 +1,6 @@
const DEST=dest;
const DOMAIN = config.domain;
const NAME = instance;
const DEST = dest;
fn have_gitea() {
have_namespace(`${global::DOMAIN}-ci`) && have_install(`${global::DOMAIN}-ci`, "gitea") && have_service(`${global::DOMAIN}-ci`, "gitea-http") && have_secret(`${global::DOMAIN}-ci`, "gitea-admin-user")
}
@@ -8,20 +8,19 @@ fn have_sonar() {
have_namespace(`${global::DOMAIN}-ci`) && have_install(`${global::DOMAIN}-ci`, "sonar") && have_service(`${global::DOMAIN}-ci`, "sonar-sonar") && have_secret(`${global::DOMAIN}-ci`, "sonar-sonar")
}
fn have_taiga() {
have_namespace(`${global::DOMAIN}-ci`) && have_install(`${global::DOMAIN}-ci`, "taiga") && have_service(`${global::DOMAIN}-ci`, "taiga-taiga") && have_secret(`${global::DOMAIN}-ci`, "sonar-sonar")
have_namespace(`${global::DOMAIN}-ci`) && have_install(`${global::DOMAIN}-ci`, "taiga") && have_service(`${global::DOMAIN}-ci`, "taiga-taiga") && have_secret(`${global::DOMAIN}-ci`, "taiga-taiga")
}
fn gitea_repos() {
let repos = [];
let org = "org-solidite";
let org = global::NAME;
org.replace("org-","");
if (have_gitea() && have_sonar()) {
let gitea = get_secret(`${global::DOMAIN}-ci`, "gitea-admin-user");
let username = base64_decode(gitea.data.username);
let password = base64_decode(gitea.data.password);
let headers = http_header_basic(username,password);
let got = http_get_json(`http://gitea-http.${global::DOMAIN}-ci.svc:3000/api/v1/orgs/${org}/repos`, headers);
log_warn(got.body);
repos += got.json.map(|p| p.name);
let response = http_get_json(`http://gitea-http.${global::DOMAIN}-ci.svc:3000/api/v1/orgs/${org}/repos`, headers);
repos += response.json.map(|p| p.name);
repos.sort();
log_info(`Found ${repos.len} repos`);
}