DockerActionManager: fix getting the tag from the image

Signed-off-by: Simon L. <szaimen@e.mail.de>
This commit is contained in:
Simon L. 2024-10-31 13:14:12 +01:00
parent 476d80ca54
commit 3ede76af8f

View file

@ -736,16 +736,13 @@ readonly class DockerActionManager {
$output = json_decode($this->guzzleClient->get($url)->getBody()->getContents(), true); $output = json_decode($this->guzzleClient->get($url)->getBody()->getContents(), true);
$containerChecksum = $output['Image']; $containerChecksum = $output['Image'];
$tagArray = explode(':', $output['Config']['Image']); $tagArray = explode(':', $output['Config']['Image']);
if (isset($tagArray[1])) {
$tag = $tagArray[1]; $tag = $tagArray[1];
apcu_add($cacheKey, $tag); } else {
/**
* @psalm-suppress TypeDoesNotContainNull
* @psalm-suppress DocblockTypeContradiction
*/
if ($tag === null) {
error_log("No tag was found when getting the current channel. You probably did not follow the documentation correctly. Changing the channel to the default 'latest'."); error_log("No tag was found when getting the current channel. You probably did not follow the documentation correctly. Changing the channel to the default 'latest'.");
$tag = 'latest'; $tag = 'latest';
} }
apcu_add($cacheKey, $tag);
return $tag; return $tag;
} catch (\Exception $e) { } catch (\Exception $e) {
error_log('Could not get current channel ' . $e->getMessage()); error_log('Could not get current channel ' . $e->getMessage());