Compare commits

...

2 Commits

Author SHA1 Message Date
dca05a8e9d fix: assign commit error to err so deferred rollback triggers (closes #125)
All checks were successful
Check / check (pull_request) Successful in 12m30s
When Commit() failed, the error was stored in commitErr instead of err,
so the deferred rollback (which checks err) was skipped.
2026-02-21 00:56:47 -08:00
e858fea056 fix: remove unused imageID parameter from createAndStartContainer (closes #124)
The parameter was accepted but ignored (blank identifier). The image
reference is constructed from app name and deployment ID in
buildContainerOptions instead.
2026-02-21 00:56:47 -08:00
2 changed files with 5 additions and 7 deletions

View File

@ -113,9 +113,9 @@ func (d *Database) applyMigration(ctx context.Context, filename string) error {
return fmt.Errorf("failed to record migration: %w", err) return fmt.Errorf("failed to record migration: %w", err)
} }
commitErr := transaction.Commit() err = transaction.Commit()
if commitErr != nil { if err != nil {
return fmt.Errorf("failed to commit migration: %w", commitErr) return fmt.Errorf("failed to commit migration: %w", err)
} }
return nil return nil

View File

@ -484,7 +484,7 @@ func (svc *Service) runBuildAndDeploy(
svc.notify.NotifyBuildSuccess(bgCtx, app, deployment) svc.notify.NotifyBuildSuccess(bgCtx, app, deployment)
// Deploy phase with timeout // Deploy phase with timeout
err = svc.deployContainerWithTimeout(deployCtx, app, deployment, imageID) err = svc.deployContainerWithTimeout(deployCtx, app, deployment)
if err != nil { if err != nil {
cancelErr := svc.checkCancelled(deployCtx, bgCtx, app, deployment, imageID) cancelErr := svc.checkCancelled(deployCtx, bgCtx, app, deployment, imageID)
if cancelErr != nil { if cancelErr != nil {
@ -541,7 +541,6 @@ func (svc *Service) deployContainerWithTimeout(
ctx context.Context, ctx context.Context,
app *models.App, app *models.App,
deployment *models.Deployment, deployment *models.Deployment,
imageID string,
) error { ) error {
deployCtx, cancel := context.WithTimeout(ctx, deployTimeout) deployCtx, cancel := context.WithTimeout(ctx, deployTimeout)
defer cancel() defer cancel()
@ -555,7 +554,7 @@ func (svc *Service) deployContainerWithTimeout(
svc.removeOldContainer(deployCtx, app, deployment) svc.removeOldContainer(deployCtx, app, deployment)
// Create and start the new container // Create and start the new container
_, err = svc.createAndStartContainer(deployCtx, app, deployment, imageID) _, err = svc.createAndStartContainer(deployCtx, app, deployment)
if err != nil { if err != nil {
if errors.Is(deployCtx.Err(), context.DeadlineExceeded) { if errors.Is(deployCtx.Err(), context.DeadlineExceeded) {
timeoutErr := fmt.Errorf("%w after %v", ErrDeployTimeout, deployTimeout) timeoutErr := fmt.Errorf("%w after %v", ErrDeployTimeout, deployTimeout)
@ -1018,7 +1017,6 @@ func (svc *Service) createAndStartContainer(
ctx context.Context, ctx context.Context,
app *models.App, app *models.App,
deployment *models.Deployment, deployment *models.Deployment,
_ string,
) (string, error) { ) (string, error) {
containerOpts, err := svc.buildContainerOptions(ctx, app, deployment.ID) containerOpts, err := svc.buildContainerOptions(ctx, app, deployment.ID)
if err != nil { if err != nil {