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)
|
||||
{
|
||||
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;
|
||||
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
|
||||
{
|
||||
eval
|
||||
{
|
||||
Process::Client::launch("send_git",
|
||||
{
|
||||
"year" => $promo,
|
||||
"id" => $id_project,
|
||||
"rendu" => $tag,
|
||||
"login" => $repo_login,
|
||||
# "path" => "ssh://git\@localhost/".$ENV{GL_REPO}, # Optional
|
||||
},
|
||||
undef, # Don't give any file
|
||||
1 # Launch in background
|
||||
);
|
||||
};
|
||||
if ($@)
|
||||
{
|
||||
my $err = $@;
|
||||
Process::Client::launch("send_git",
|
||||
{
|
||||
"year" => $promo,
|
||||
"id" => $id_project,
|
||||
"rendu" => $tag,
|
||||
"login" => $repo_login,
|
||||
# "path" => "ssh://git\@localhost/".$ENV{GL_REPO}, # Optional
|
||||
},
|
||||
undef, # Don't give any file
|
||||
1 # Launch in background
|
||||
);
|
||||
};
|
||||
if ($@)
|
||||
{
|
||||
my $err = $@;
|
||||
log DEBUG, "ERROR: ".$err;
|
||||
}
|
||||
}
|
||||
|
||||
# Send data to API
|
||||
my $last_commit = `git log "refs/tags/$tag" -1 --decorate --tags`;
|
||||
eval {
|
||||
API::Submission::add($promo, $id_project, $tag, $repo_login, $last_commit);
|
||||
};
|
||||
if ($@)
|
||||
{
|
||||
my $err = $@;
|
||||
log DEBUG, "ERROR: ".$err;
|
||||
log DONE, "Tag '$tag' effectué avec succès !";
|
||||
}
|
||||
else {
|
||||
log DONE, "Tag '$tag' effectué avec succès ! Vérifiez-le sur l'intranet.";
|
||||
}
|
||||
# Send data to API
|
||||
my $last_commit = `git log "refs/tags/$tag" -1 --decorate --tags`;
|
||||
eval {
|
||||
API::Submission::add($promo, $id_project, $tag, $repo_login, $last_commit);
|
||||
};
|
||||
if ($@)
|
||||
{
|
||||
my $err = $@;
|
||||
log DEBUG, "ERROR: ".$err;
|
||||
log DONE, "Tag '$tag' effectué avec succès !";
|
||||
}
|
||||
else {
|
||||
log DONE, "Tag '$tag' effectué avec succès ! Vérifiez-le sur l'intranet.";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user