forked from lix-project/hydra
Make gitea public URL configurable
Otherwise, it will be obtained from the jobset input that contains the URL to the git repo to build.
This commit is contained in:
parent
eecea56131
commit
f9f5ab2fb1
|
@ -486,9 +486,10 @@ analogous:
|
||||||
* For a jobset with a `Git`-input which points to a `gitea`-instance, add the following
|
* For a jobset with a `Git`-input which points to a `gitea`-instance, add the following
|
||||||
additional inputs:
|
additional inputs:
|
||||||
|
|
||||||
| Type | Name | Value |
|
| Type | Name | Value |
|
||||||
| -------------- | ------------------- | ----------------------------------- |
|
| -------------- | ------------------- | ---------------------------------- |
|
||||||
| `String value` | `gitea_repo_name` | *Name of the repository to build* |
|
| `String value` | `gitea_repo_name` | *Name of the repository to build* |
|
||||||
| `String value` | `gitea_repo_owner` | *Owner of the repository* |
|
| `String value` | `gitea_repo_owner` | *Owner of the repository* |
|
||||||
| `String value` | `gitea_status_repo` | *Name of the `Git checkout` input* |
|
| `String value` | `gitea_status_repo` | *Name of the `Git checkout` input* |
|
||||||
|
| `String value` | `gitea_http_url` | *Public URL of `gitea`*, optional |
|
||||||
|
|
||||||
|
|
|
@ -591,7 +591,8 @@
|
||||||
"git": {"value": "http://localhost:3001/root/repo.git", "type": "git"},
|
"git": {"value": "http://localhost:3001/root/repo.git", "type": "git"},
|
||||||
"gitea_repo_name": {"value": "repo", "type": "string"},
|
"gitea_repo_name": {"value": "repo", "type": "string"},
|
||||||
"gitea_repo_owner": {"value": "root", "type": "string"},
|
"gitea_repo_owner": {"value": "root", "type": "string"},
|
||||||
"gitea_status_repo": {"value": "git", "type": "string"}
|
"gitea_status_repo": {"value": "git", "type": "string"},
|
||||||
|
"gitea_http_url": {"value": "http://localhost:3001", "type": "string"}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
|
|
|
@ -55,6 +55,7 @@ sub common {
|
||||||
next unless defined $giteastatusInput && defined $giteastatusInput->value;
|
next unless defined $giteastatusInput && defined $giteastatusInput->value;
|
||||||
my $i = $eval->jobsetevalinputs->find({ name => $giteastatusInput->value, altnr => 0 });
|
my $i = $eval->jobsetevalinputs->find({ name => $giteastatusInput->value, altnr => 0 });
|
||||||
next unless defined $i;
|
next unless defined $i;
|
||||||
|
my $gitea_url = $eval->jobsetevalinputs->find({ name => "gitea_http_url" });
|
||||||
|
|
||||||
my $repoOwner = $eval->jobsetevalinputs->find({ name => "gitea_repo_owner" })->value;
|
my $repoOwner = $eval->jobsetevalinputs->find({ name => "gitea_repo_owner" })->value;
|
||||||
my $repoName = $eval->jobsetevalinputs->find({ name => "gitea_repo_name" })->value;
|
my $repoName = $eval->jobsetevalinputs->find({ name => "gitea_repo_name" })->value;
|
||||||
|
@ -62,7 +63,14 @@ sub common {
|
||||||
|
|
||||||
my $rev = $i->revision;
|
my $rev = $i->revision;
|
||||||
my $domain = URI->new($i->uri)->host;
|
my $domain = URI->new($i->uri)->host;
|
||||||
my $url = "http://$domain:3001/api/v1/repos/$repoOwner/$repoName/statuses/$rev";
|
my $host;
|
||||||
|
unless (defined $gitea_url) {
|
||||||
|
$host = "https://$domain";
|
||||||
|
} else {
|
||||||
|
$host = $gitea_url->value;
|
||||||
|
}
|
||||||
|
|
||||||
|
my $url = "$host/api/v1/repos/$repoOwner/$repoName/statuses/$rev";
|
||||||
|
|
||||||
print STDERR "GiteaStatus POSTing $state to $url\n";
|
print STDERR "GiteaStatus POSTing $state to $url\n";
|
||||||
my $req = HTTP::Request->new('POST', $url);
|
my $req = HTTP::Request->new('POST', $url);
|
||||||
|
|
Loading…
Reference in a new issue