The Simplest Way to Make GitLab CI and Ubuntu Work Like They Should
Teams use gitlab ci and ubuntu to build, test, and ship code in production. The pipeline sends job steps to Linux hosts that run the work and return logs. This pair gives developers a fast and familiar way to automate software delivery. Most cloud tools and package managers work well on this operating system right away. Still, linking your build server to Linux machines creates real security and maintenance work. You need clear rules for how jobs log in and what files they touch. How gitlab c
Your coding agents run with your access.
Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.
Teams use gitlab ci and ubuntu to build, test, and ship code in production. The pipeline sends job steps to Linux hosts that run the work and return logs.
This pair gives developers a fast and familiar way to automate software delivery. Most cloud tools and package managers work well on this operating system right away. Still, linking your build server to Linux machines creates real security and maintenance work. You need clear rules for how jobs log in and what files they touch.
How gitlab ci and ubuntu share work and permissions
A runner agent lives on the Linux host and polls the server for jobs. When a developer pushes code, the server places a new job in the queue. The agent pulls the job details over an encrypted web link and starts work. It checks out the code and runs the script steps on the host machine.
You can run these jobs directly on the host shell or inside containers. Shell jobs run as a local system user on the Linux machine itself. Container jobs start a fresh image for each step and throw it away after. Both ways need careful login rules so jobs only touch what they need.
Data flows back to the server as text logs and saved build files. During the run, the job may also reach out to databases or cloud storage. If the job prints sensitive data, that text can end up in build logs. Masking rewrites matched fields like emails, phone numbers, card numbers, or national IDs.
Common failure modes and how to scope host roles
The biggest mistake is giving the runner user full root power on the host. When a job has full system rights, any script can change core host files. A bad script can read secrets from other jobs on the same machine. It can also install background programs that stay active after the job ends.
Shared service accounts cause big problems for engineering teams too. Many teams put one long-lived SSH key or database password in group variables. Every pipeline in that group can then use that same broad key. When something breaks, the system logs only show the shared account name. You cannot tell which pipeline or developer ran the bad command.
GitLab CI Security + End-to-End Encryption: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Unlogged database queries and shell commands create blind spots during security reviews. A build job might open a remote shell or run a data script. Standard build logs only show that the script started and finished. They do not record the exact queries sent to the target system.
To fix this, give the runner a restricted Linux user with narrow folder rights. Run each job in an isolated container that wipes all local state after completion. Scope network paths with host firewall rules so runners only reach required ports. Replace static shared keys with job tokens that expire as soon as builds finish.
Keeping build hosts clean and fast over time
Linux build hosts often fail when old files fill up the main disk. Container images, package caches, and leftover build folders grow fast on busy servers. When the disk fills up, new jobs fail with strange write errors.
Set up a daily timer on the host to delete unused images and caches. Keep your base system packages updated so security fixes apply on schedule. Treat your build hosts like cattle that you can rebuild from scratch anytime. When a host acts strange, delete it and start a fresh machine image.
Govern statements and responses across databases and APIs
Good config and scoped roles are needed setup. They do not check single queries in flight or mask sensitive fields in returned rows. Across Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, and internal HTTP endpoints, hoop.dev runs beside each supported service as an open-source proxy, a sidecar for your database or API.
First, hoop.dev guardrails block banned queries before they run. Then hoop.dev data masking rewrites matched sensitive values in responses in memory. The audit trail records every statement and verdict per resource. Furthermore, hoop.dev holds SOC 2 Type II and is open source on GitHub.
Frequently asked questions
Should I use the shell executor or containers on my Linux host?
Use containers for most build and test jobs to keep runs clean and isolated. Only use the local shell when a job must talk directly to host hardware.
How do I stop build jobs from reading secrets from other projects?
Run each project on its own dedicated runner group and use fresh containers. Never store plain secret files on the shared host disk between pipeline runs.
Why do my pipelines slow down after a few weeks of heavy use?
Old build caches and dead container layers take up disk space and slow reads. Run an automated cleanup script on the host every night to clear old data.
Related guides
In this post