File browser SVN Gateway yang menampilkan folder art/characters di repository game demoDialog kelola akses yang menampilkan siapa saja yang bisa membuka folder, lengkap dengan level izin dan tombol cabutHalaman Run Shellway yang menampilkan output disk usage dari dua server setelah satu commandMemilih command, SSH user, dan server tujuan sebelum menjalankan run
0%

2026-10-25

Smoke-Testing Docker Images Before They Deploy

A Docker build that finishes without errors tells you the image was assembled. It does not tell you the app inside can start, connect to its database, and answer a request. While working on Agate's shared GitLab CI/CD template, I added a smoke-test stage to close that gap for every service that ships as an image.

A green build is not a running app

Before this change, the pipeline built an image, pushed it to the registry, and deployed it. If the app crashed on start because of a missing environment variable or a database it could not reach, the first place anyone noticed was the server.

A smoke test is the cheapest check that catches this: start the app the way it will run and see if it answers. It does not prove the features work. It proves the build is worth testing further and safe to pass on to the deploy step.

Test the exact image you deploy

The smoke-test job runs the same image tag the build just pushed, not a fresh build. If the test passes, what deploys is exactly what was tested.

Each job creates its own Docker network and starts the dependencies the service needs inside it: MySQL, PostgreSQL, or MongoDB, plus Redis. None of them publish ports to the host. The app's environment variables are filled in automatically from a rules file, default-smoketest-rules.json, so projects do not need to write their own test config. Then the job starts the app and tries a short list of endpoints in order, such as health, scalar, and swagger. The first HTTP 200 passes the stage and lets the deploy run. If none answers, the pipeline stops before deployment.

Keep it safe and leave nothing behind

A shared CI template runs for many projects on the same runner, so the smoke test has to clean up after itself every time. Every container, volume, and network the job created is removed at the end, whether the test passed or failed.

Logs need the same care. Database passwords and other secrets passed into the containers are masked in the job output, so a failed run can be shared and debugged without leaking credentials.

What it does not cover

The stage only applies to Docker images built on the shell runner, and the app has to expose an endpoint that answers HTTP 200 without logging in. Services that do not have one need a small health route first. When I tested the pipeline on a copy of my portfolio site, that meant adding a /health route with checks for MySQL and Redis.

It is also not a replacement for a test suite. A smoke test answers one question, whether the app starts and responds, and it answers it quickly. That narrow scope is the point: it catches the failures that would otherwise reach the server first, and it is cheap enough to run on every build.

LET'S WORK TOGETHER

akmalzaidan960@gmail.com