fix
This commit is contained in:
@@ -34,3 +34,23 @@ fn post_template() {
|
|||||||
repos: gitea_repos()
|
repos: gitea_repos()
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
fn post_install() {
|
||||||
|
let org = global::NAME;
|
||||||
|
org.replace("org-","");
|
||||||
|
if (have_gitea() && have_sonar()) {
|
||||||
|
let sonar = get_secret(`${global::DOMAIN}-ci`, "sonar-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 headerGit = http_header_basic(username,password);
|
||||||
|
let headerSonar = http_header_basic("admin",base64_decode(sonar.data.ADMIN_PASSWORD));
|
||||||
|
let response = http_get_json(`http://gitea-http.${global::DOMAIN}-ci.svc:3000/api/v1/orgs/${org}/repos`, headerGit);
|
||||||
|
for p in response.json {
|
||||||
|
let exist = http_get_json(`http://sonar-sonar.${global::DOMAIN}-ci.svc:3000/api/projects/search?projects=${org}__${p.name}`, headerSonar).json.components.len;
|
||||||
|
if (exist < 1) {
|
||||||
|
log_info(`Creating [${org}] ${p.name}`);
|
||||||
|
http_post_json(`http://sonar-sonar.${global::DOMAIN}-ci.svc:3000/api/projects/create?name=%5B${org}%5D%20${p.name}&project=${org}__${p.name}&visibility=private&mainBranch=${p.default_branch}`, headerSonar, #{});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -30,7 +30,7 @@ resource "kubectl_manifest" "post_install_job_taiga" {
|
|||||||
- name: post-config
|
- name: post-config
|
||||||
image: "${var.images.kubectl.registry}/${var.images.kubectl.repository}:${var.images.kubectl.tag}"
|
image: "${var.images.kubectl.registry}/${var.images.kubectl.repository}:${var.images.kubectl.tag}"
|
||||||
imagePullPolicy: ${var.images.kubectl.pull_policy}
|
imagePullPolicy: ${var.images.kubectl.pull_policy}
|
||||||
command: ["/bin/bash", "-xc"]
|
command: ["/bin/bash", "-c"]
|
||||||
args:
|
args:
|
||||||
- >-
|
- >-
|
||||||
API='http://taiga-taiga.${var.domain}-ci.svc/api/v1';
|
API='http://taiga-taiga.${var.domain}-ci.svc/api/v1';
|
||||||
|
|||||||
Reference in New Issue
Block a user