fix
This commit is contained in:
27
share/organisation/check.rhai
Normal file
27
share/organisation/check.rhai
Normal file
@@ -0,0 +1,27 @@
|
||||
const DOMAIN = config.domain;
|
||||
const NAME = instance;
|
||||
fn check_domain() {
|
||||
assert(have_namespace(`${global::DOMAIN}`), `There is no ${global::DOMAIN} namespace`);
|
||||
}
|
||||
fn pre_check() {
|
||||
check_domain();
|
||||
}
|
||||
fn conditions() {
|
||||
let org = global::NAME;
|
||||
org.replace("org-","");
|
||||
let insts = list_install(`${global::DOMAIN}-ci`).items;
|
||||
let repos = [];
|
||||
if (insts.some(|i| i.metadata.name=="gitea") && insts.some(|i| i.metadata.name=="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);
|
||||
repos += git.map(|p| p.name);
|
||||
repos.sort();
|
||||
log_info(`Found ${repo.len} repos`);
|
||||
}
|
||||
json_encode(#{
|
||||
repos: repos
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user