Receive ACU-* tags
This commit is contained in:
parent
d1b027a3ff
commit
4af0617cae
@ -30,54 +30,59 @@ exit(0) if (!$promo || !$id_project || !$repo_login);
|
|||||||
|
|
||||||
for my $ref (@ARGV)
|
for my $ref (@ARGV)
|
||||||
{
|
{
|
||||||
if ($ref =~ m<^refs/tags/ACU-(.+)$> || $ref =~ m<^refs/tags/(.+)$>)
|
my $tag;
|
||||||
|
if ($ref =~ m<^refs/tags/ACU-(.+)$>) {
|
||||||
|
$tag = $1;
|
||||||
|
} elsif ($ref =~ m<^refs/tags/(.+)$>) {
|
||||||
|
$tag = $1;
|
||||||
|
} else {
|
||||||
|
next;
|
||||||
|
}
|
||||||
|
|
||||||
|
log DEBUG, "Tag $tag on repository $ENV{GL_REPO} from IP $ENV{'SSH_CLIENT'} updated.";
|
||||||
|
|
||||||
|
my $project = get_project_info($tag);
|
||||||
|
|
||||||
|
# Extract matching tag
|
||||||
|
my @rendus = grep {
|
||||||
|
exists $_->{vcs} and $_->{vcs}{tag} eq $tag;
|
||||||
|
} @{ $project->{submissions} };
|
||||||
|
|
||||||
|
if (@rendus)
|
||||||
{
|
{
|
||||||
my $tag = $1;
|
eval
|
||||||
log DEBUG, "Tag $tag on repository $ENV{GL_REPO} from IP $ENV{'SSH_CLIENT'} updated.";
|
|
||||||
|
|
||||||
my $project = get_project_info($tag);
|
|
||||||
|
|
||||||
# Extract matching tag
|
|
||||||
my @rendus = grep {
|
|
||||||
exists $_->{vcs} and $_->{vcs}{tag} eq $tag;
|
|
||||||
} @{ $project->{submissions} };
|
|
||||||
|
|
||||||
if (@rendus)
|
|
||||||
{
|
{
|
||||||
eval
|
Process::Client::launch("send_git",
|
||||||
{
|
{
|
||||||
Process::Client::launch("send_git",
|
"year" => $promo,
|
||||||
{
|
"id" => $id_project,
|
||||||
"year" => $promo,
|
"rendu" => $tag,
|
||||||
"id" => $id_project,
|
"login" => $repo_login,
|
||||||
"rendu" => $tag,
|
# "path" => "ssh://git\@localhost/".$ENV{GL_REPO}, # Optional
|
||||||
"login" => $repo_login,
|
},
|
||||||
# "path" => "ssh://git\@localhost/".$ENV{GL_REPO}, # Optional
|
undef, # Don't give any file
|
||||||
},
|
1 # Launch in background
|
||||||
undef, # Don't give any file
|
);
|
||||||
1 # Launch in background
|
};
|
||||||
);
|
if ($@)
|
||||||
};
|
{
|
||||||
if ($@)
|
my $err = $@;
|
||||||
{
|
|
||||||
my $err = $@;
|
|
||||||
log DEBUG, "ERROR: ".$err;
|
log DEBUG, "ERROR: ".$err;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Send data to API
|
# Send data to API
|
||||||
my $last_commit = `git log "refs/tags/$tag" -1 --decorate --tags`;
|
my $last_commit = `git log "refs/tags/$tag" -1 --decorate --tags`;
|
||||||
eval {
|
eval {
|
||||||
API::Submission::add($promo, $id_project, $tag, $repo_login, $last_commit);
|
API::Submission::add($promo, $id_project, $tag, $repo_login, $last_commit);
|
||||||
};
|
};
|
||||||
if ($@)
|
if ($@)
|
||||||
{
|
{
|
||||||
my $err = $@;
|
my $err = $@;
|
||||||
log DEBUG, "ERROR: ".$err;
|
log DEBUG, "ERROR: ".$err;
|
||||||
log DONE, "Tag '$tag' effectué avec succès !";
|
log DONE, "Tag '$tag' effectué avec succès !";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
log DONE, "Tag '$tag' effectué avec succès ! Vérifiez-le sur l'intranet.";
|
log DONE, "Tag '$tag' effectué avec succès ! Vérifiez-le sur l'intranet.";
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user