Add support for bypass_container_update param for easier local build and testing (#6702)

Signed-off-by: Alan Savage <3028205+asavageiv@users.noreply.github.com>
Signed-off-by: Simon L. <szaimen@e.mail.de>
Signed-off-by: Alan Savage <asavageiv@users.noreply.github.com>
Co-authored-by: Alan Savage <asavage@ifrit.internal>
Co-authored-by: Alan Savage <3028205+asavageiv@users.noreply.github.com>
Co-authored-by: Simon L. <szaimen@e.mail.de>
This commit is contained in:
Alan Savage 2025-08-22 04:47:29 -07:00 committed by GitHub
parent 49aa732ec5
commit dd495d76a1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 46 additions and 31 deletions

View file

@ -86,6 +86,7 @@ $app->get('/containers', function (Request $request, Response $response, array $
// Check if bypass_mastercontainer_update is provided on the URL, a special developer mode to bypass a mastercontainer update and use local image.
$params = $request->getQueryParams();
$bypass_mastercontainer_update = isset($params['bypass_mastercontainer_update']);
$bypass_container_update = isset($params['bypass_container_update']);
return $view->render($response, 'containers.twig', [
'domain' => $configurationManager->GetDomain(),
@ -136,6 +137,7 @@ $app->get('/containers', function (Request $request, Response $response, array $
'is_whiteboard_enabled' => $configurationManager->isWhiteboardEnabled(),
'community_containers' => $configurationManager->listAvailableCommunityContainers(),
'community_containers_enabled' => $configurationManager->GetEnabledCommunityContainers(),
'bypass_container_update' => $bypass_container_update,
]);
})->setName('profile');
$app->get('/login', function (Request $request, Response $response, array $args) use ($container) {

View file

@ -191,8 +191,14 @@ readonly class DockerController {
$config['install_latest_major'] = $installLatestMajor;
$this->configurationManager->WriteConfig($config);
// Do not pull container images in case 'bypass_container_update' is set via url params
// Needed for local testing
$pullImage = !isset($request->getParsedBody()['bypass_container_update']);
if ($pullImage === false) {
error_log('WARNING: Not pulling container images. Instead, using local ones.');
}
// Start container
$this->startTopContainer(true);
$this->startTopContainer($pullImage);
// Clear apcu cache in order to check if container updates are available
// Temporarily disabled as it leads much faster to docker rate limits

View file

@ -352,6 +352,7 @@
<form method="POST" action="/api/docker/start" class="xhr">
<input type="hidden" name="{{csrf.keys.name}}" value="{{csrf.name}}">
<input type="hidden" name="{{csrf.keys.value}}" value="{{csrf.value}}">
<input type="hidden" name="bypass_container_update" value="{{bypass_container_update}}">
<input class="button " type="submit" value="Start and update containers" onclick="return confirm('Start and update containers? You should consider creating a backup first.')" />
</form>
{% endif %}