Changeset View
Changeset View
Standalone View
Standalone View
app/Listeners/DockerHubListener.php
Show All 9 Lines | |||||
use DockerHub; | use DockerHub; | ||||
/** | /** | ||||
* Listens to events Docker Hub is interested by. | * Listens to events Docker Hub is interested by. | ||||
*/ | */ | ||||
class DockerHubListener { | class DockerHubListener { | ||||
/// | /// | ||||
/// GitHub → Phabricator | /// GitHub → Docker Hub | ||||
/// | /// | ||||
/** | /** | ||||
* Handles payload events. | * Handles payload events. | ||||
* | * | ||||
* @param GitHubPayloadEvent $event The GitHub payload event | * @param GitHubPayloadEvent $event The GitHub payload event | ||||
*/ | */ | ||||
public function onGitHubPayload (GitHubPayloadEvent $event) : void { | public function onGitHubPayload (GitHubPayloadEvent $event) : void { | ||||
Show All 11 Lines | class DockerHubListener { | ||||
* @return bool | * @return bool | ||||
*/ | */ | ||||
public function shouldNotify (GitHubPayloadEvent $event) : bool { | public function shouldNotify (GitHubPayloadEvent $event) : bool { | ||||
return $event->event === 'push' | return $event->event === 'push' | ||||
&& DockerHub::hasToken($this->getRepository($event)); | && DockerHub::hasToken($this->getRepository($event)); | ||||
} | } | ||||
/** | /** | ||||
* Notifies Phabricator there are new commits to pull. | * Notifies Docker Hub to rebuild image. | ||||
* | * | ||||
* @param GitHubPayloadEvent $event The GitHub payload event | * @param GitHubPayloadEvent $event The GitHub payload event | ||||
*/ | */ | ||||
public function notifyNewCommits (GitHubPayloadEvent $event) : void { | public function notifyNewCommits (GitHubPayloadEvent $event) : void { | ||||
$job = new TriggerDockerHubBuild($this->getRepository($event)); | $job = new TriggerDockerHubBuild($this->getRepository($event)); | ||||
$job->handle(); | $job->handle(); | ||||
} | } | ||||
Show All 27 Lines |
Nasqueron DevCentral · If it had been much bigger the moon would have had a core of ice. · Powered by Phabricator