Added isGlobal property in Image
testing/ogcore-api/pipeline/head This commit looks good
Details
testing/ogcore-api/pipeline/head This commit looks good
Details
parent
6d3604565b
commit
e3c543c6c1
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace App\Controller\OgRepository\Webhook;
|
||||
|
||||
use App\Controller\OgRepository\AbstractOgRepositoryController;
|
||||
use App\Entity\Image;
|
||||
use App\Entity\ImageRepository;
|
||||
use App\Entity\Trace;
|
||||
|
@ -15,17 +16,20 @@ use Symfony\Component\HttpFoundation\Request;
|
|||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Attribute\AsController;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Contracts\HttpClient\Exception\ClientExceptionInterface;
|
||||
use Symfony\Contracts\HttpClient\Exception\RedirectionExceptionInterface;
|
||||
use Symfony\Contracts\HttpClient\Exception\ServerExceptionInterface;
|
||||
use Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface;
|
||||
|
||||
#[AsController]
|
||||
class ResponseController extends AbstractController
|
||||
class ResponseController extends AbstractOgRepositoryController
|
||||
{
|
||||
public function __construct(
|
||||
protected readonly EntityManagerInterface $entityManager,
|
||||
protected readonly LoggerInterface $logger,
|
||||
)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws RedirectionExceptionInterface
|
||||
* @throws ClientExceptionInterface
|
||||
* @throws TransportExceptionInterface
|
||||
* @throws ServerExceptionInterface
|
||||
*/
|
||||
#[Route('/og-repository/webhook', name: 'og_repository_webhook', methods: ['POST'])]
|
||||
public function repositoryWebhook(Request $request): JsonResponse
|
||||
{
|
||||
|
@ -79,6 +83,12 @@ class ResponseController extends AbstractController
|
|||
$this->entityManager->flush();
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws TransportExceptionInterface
|
||||
* @throws ServerExceptionInterface
|
||||
* @throws RedirectionExceptionInterface
|
||||
* @throws ClientExceptionInterface
|
||||
*/
|
||||
private function handleExportImage(string $action, array $data): void
|
||||
{
|
||||
$trace = $this->entityManager->getRepository(Trace::class)->findOneBy(['jobId' => $data['job_id']]);
|
||||
|
@ -106,6 +116,7 @@ class ResponseController extends AbstractController
|
|||
$image->setStatus(ImageStatus::SUCCESS);
|
||||
$this->entityManager->persist($image);
|
||||
|
||||
$content = $this->createRequest('PUT', 'http://'.$image->getRepository()->getIp().':8006/ogrepository/v1/images');
|
||||
|
||||
$trace->setStatus(TraceStatus::SUCCESS);
|
||||
$trace->setFinishedAt(new \DateTime());
|
||||
|
@ -114,6 +125,12 @@ class ResponseController extends AbstractController
|
|||
$this->entityManager->flush();
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws TransportExceptionInterface
|
||||
* @throws ServerExceptionInterface
|
||||
* @throws RedirectionExceptionInterface
|
||||
* @throws ClientExceptionInterface
|
||||
*/
|
||||
private function handleImportImage(string $action, array $data): void
|
||||
{
|
||||
$trace = $this->entityManager->getRepository(Trace::class)->findOneBy(['jobId' => $data['job_id']]);
|
||||
|
@ -141,6 +158,8 @@ class ResponseController extends AbstractController
|
|||
$image->setStatus(ImageStatus::SUCCESS);
|
||||
$this->entityManager->persist($image);
|
||||
|
||||
$content = $this->createRequest('PUT', 'http://'.$image->getRepository()->getIp().':8006/ogrepository/v1/images');
|
||||
|
||||
$trace->setStatus(TraceStatus::SUCCESS);
|
||||
$trace->setFinishedAt(new \DateTime());
|
||||
|
||||
|
|
Loading…
Reference in New Issue