The Simplest Way to Make GitLab CI and Jenkins Work Like They Should

Published
Length
3 min read

Luis Felipe Dias

All posts

Teams use gitlab ci and jenkins together to run code tests and deploy apps. GitLab holds the code and fast checks, while Jenkins runs legacy build jobs. Many groups want to move all builds to one place. Yet old scripts and custom plugins keep both systems alive for years. A clean link between them stops build delays and keeps keys safe. How gitlab ci and jenkins share jobs and keys The workflow starts when a developer pushes code to a GitLab branch. GitLab runs quick syntax checks first. The

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 jenkins together to run code tests and deploy apps. GitLab holds the code and fast checks, while Jenkins runs legacy build jobs.

Many groups want to move all builds to one place. Yet old scripts and custom plugins keep both systems alive for years. A clean link between them stops build delays and keeps keys safe.

How gitlab ci and jenkins share jobs and keys

The workflow starts when a developer pushes code to a GitLab branch. GitLab runs quick syntax checks first. Then it sends a web request to trigger a Jenkins job.

Jenkins receives the payload and pulls the exact code commit from the repo. It uses an API token or SSH key to read the source files. When the job ends, Jenkins sends a pass or fail status back.

This two-way link needs two sets of keys. GitLab needs a user token to start builds on the Jenkins server. Jenkins needs a project token to post status updates back to the merge request.

Common failure modes with shared build tokens

The biggest risk in this setup is an over-privileged service account. Teams often create one admin user and share its token across fifty repos. If one build script leaks that key, an attacker can read every project.

Long-lived tokens also break builds when they expire without warning. A person leaves the team, their account gets deleted, and the whole pipeline stops. Finding which job holds the dead key takes hours of manual work.

GitLab CI Security + Jenkins Pipeline Security: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Network paths between the two tools cause trouble too. Many teams open wide firewall rules so cloud runners can reach internal build servers. This exposes the build controller to the public web.

To fix this, scope every token to a single project and role. Give the build user permission to update commit statuses, not full repo write rights. Rotate keys on a set schedule and log every API call.

Scoping network paths and runner roles

Keep your build servers on a private network segment. Place a local runner inside that same network to trigger internal jobs. This keeps your build server off the public internet.

Map each pipeline stage to a distinct role with narrow permissions. A test stage should only read code and write test reports. A deploy stage can touch production targets only after a human approves the merge.

Clear logs across both tools make it easy to trace a failed run. Pass the commit hash and job ID in every webhook call. Your team can then match a slow step in one tool to the exact log in the other.

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 we trigger Jenkins from a webhook or a pipeline step?

Triggering from a pipeline step gives you much better control. You can run fast unit tests first and call the external server only if they pass. Webhooks fire on every push and can flood your build queue.

How do we stop build tokens from leaking in job logs?

Store all tokens in masked secret variables inside your project settings. Never print variables in build scripts or pass them in plain URLs. Check your runner logs often to make sure secrets stay hidden.

Can Jenkins send test reports back to the merge request?

Yes, the build server can post commit status updates through the repo API. You can also upload test files as build artifacts so reviewers see failures right on the merge page.

The query runs. The emails stay hidden.