The Simplest Way to Make Dataflow and Gitlab Work Like They Should

Published
Length
3 min read

Luis Felipe Dias

All posts

Teams pair dataflow and gitlab to test and deploy data pipelines from code commits. GitLab runs build jobs that submit Apache Beam code to Google Cloud Dataflow workers. This setup turns manual data scripts into repeatable pipeline runs. Code reviews in GitLab check logic before any job touches production data. When a merge happens, a runner builds the template and starts the job. Good identity rules and tight role boundaries keep this link safe. How dataflow and gitlab share roles and data

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 pair dataflow and gitlab to test and deploy data pipelines from code commits. GitLab runs build jobs that submit Apache Beam code to Google Cloud Dataflow workers.

This setup turns manual data scripts into repeatable pipeline runs. Code reviews in GitLab check logic before any job touches production data. When a merge happens, a runner builds the template and starts the job. Good identity rules and tight role boundaries keep this link safe.

How dataflow and gitlab share roles and data

Two separate accounts run a single pipeline job in this setup. The first account is the runner identity inside GitLab. It needs permission to stage files in cloud storage and submit jobs. The second account is the worker identity that runs the data processing tasks.

Keep these two identities separate in your cloud project. A federated identity link lets GitLab log in without stored static keys. GitLab sends a signed token to Google Cloud during the pipeline run. Google Cloud checks that token and grants a temporary role to the runner.

Once logged in, the runner uploads job templates to a storage bucket. It then tells the Dataflow service to start or update the pipeline. From that point, the worker identity takes over the actual data movement. The worker reads from sources, transforms records, and writes to target tables. GitLab only watches the job status and logs the build output.

Common failure modes and how to scope roles

Many teams fail by using one broad service account for both tools. They export a static JSON key and paste it into GitLab variables. If that key leaks, an attacker gains full control over cloud storage and data. Worse, shared accounts make audit logs hard to read during an incident.

Another common mistake is giving the runner role direct read rights to production tables. The runner only needs to submit the job and pass the worker account name. It does not need to read customer rows or query raw databases. Overbroad network rules also create risk when workers run on public IP addresses.

GitLab CI Security + End-to-End Encryption: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Fix these gaps by scoping each role to its exact task. Remove static keys from GitLab and use federated login tied to specific branches. Restrict the runner role so it can only write to one staging bucket. Set up the worker role with read and write rights only on required datasets.

Put workers on private network paths with no public IP addresses. Turn on cloud audit logs for both job submission and storage bucket reads. If a pipeline handles sensitive fields like emails or phone numbers, apply masking rules. Masking rewrites matched fields such as card numbers or national IDs in results.

Testing and updating live pipelines

Streaming jobs run all the time and need careful update rules in GitLab. A bad code push can break state or drop messages in flight. Set up branch rules so merge requests run small batch tests first. Use separate cloud projects for test runs and production runs.

When you merge to the main branch, trigger an in-place update for streaming jobs. Pass a clear job name so the service matches the running pipeline. Have the runner wait and check that the new workers start clean. If workers fail to start, the job should alert the team right away.

Check database and API queries on the wire

Identity tools, roles, and network rules decide who opens a session. Setup alone cannot check what each query does or mask sensitive values in a response once a session starts. When workflows touch Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, or internal HTTP APIs, hoop.dev runs beside those services as an open-source proxy, a sidecar for your Postgres or API. It inspects requests coming in and results going back on the wire.

Your login details and client tools stay as they are while hoop.dev guardrails refuse bad deletes or drops before they run. On responses, hoop.dev data masking rewrites matched sensitive values in memory. Furthermore, hoop.dev holds SOC 2 Type II, is MIT licensed, and writes every query and decision to an audit trail that generates evidence for HIPAA, GDPR, and PCI DSS. See the source on GitHub.

Frequently asked questions

Should GitLab runners and Dataflow workers use the same service account?

No, they should always use two separate service accounts. The runner account only stages code and submits the job. The worker account processes the data and reads from your sources.

How do we avoid storing Google Cloud JSON keys in GitLab?

Use workload identity federation between GitLab and Google Cloud. GitLab issues a job token that Google Cloud checks and trades for temporary credentials. You can lock this trust rule to a single repo and branch.

How should we handle database credentials needed by pipeline workers?

Do not pass raw database passwords through GitLab pipeline variables. Store secrets in a secret manager and let the worker role read them at runtime. Also limit worker network paths to private subnets.

The query runs. The emails stay hidden.