/** * @Route("/{reference}", methods={"PUT"}, name="manifest_put") * * @ParamConverter("manifest", options={"repository_method": "findOneByReferenceOrCreate", "map_method_signature": true}) * * @Security("is_granted('REPO_WRITE', repository)") * * @link http://docs.docker.com/registry/spec/api/#put-manifest */ public function uploadAction(Request $request, Repository $repository, Manifest $manifest, $reference) { $manifest->setContent($request->getContent()); if ($reference !== $manifest->getTag() && $reference !== $manifest->getDigest()) { throw new BadRequestHttpException('Provided reference does not match with tag or digest.'); } // TODO: validate layers & signatures $this->get('doctrine')->getRepository('AppBundle:Manifest')->save($manifest); // Dispatch event $event = new ManifestEvent($manifest); $this->get('event_dispatcher')->dispatch('delayed', new DelayedEvent('kernel.terminate', 'manifest.push', $event)); return new Response('', Response::HTTP_CREATED, ['Location' => $this->generateUrl('manifest_get', ['name' => $manifest->getRepository()->getName(), 'reference' => $manifest->getDigest()], UrlGeneratorInterface::ABSOLUTE_URL), 'Docker-Content-Digest' => $manifest->getDigest()]); }