GuideJuly 28, 20267 min read

ConfigSync in CI/CD: Consistent Environments from Local to Pipeline

The 'works on my machine' problem does not stop at your colleagues' laptops. CI runners are yet another environment that drifts from your local setup. Here is how to fix that.

CI Is Just Another Machine

When a build fails in CI but passes locally, the investigation usually reveals a configuration difference. A different Node version. A missing Git config that changes line endings. An npm registry token that is configured locally but absent in CI. These are all environment consistency problems.

ConfigSync treats your CI runner as just another machine. The same configs you push from your laptop can be pulled into a GitHub Actions workflow, a GitLab CI job, or any other pipeline runner. Same tool, same encrypted configs, same result.

GitHub Actions Example

Here is a complete GitHub Actions workflow that pulls shared configurations before running your build:

.github/workflows/build.yml
name: Build on: [push, pull_request] jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Setup Node uses: actions/setup-node@v4 with: node-version: 20 - name: Install ConfigSync run: npm install -g @inventivehq/configsync - name: Pull CI configurations env: CS_TOKEN: ${{ secrets.CONFIGSYNC_TOKEN }} run: | configsync setup --token $CS_TOKEN configsync pull --filter modules:git,modules:npm - name: Install dependencies run: npm ci - name: Build run: npm run build

The key is the --filter flag. Your CI runner does not need your shell aliases or VS Code settings. It needs Git configuration (for consistent behavior during checkout and tagging) and npm authentication (for accessing private registries).

What to Sync in CI

Not every module belongs in a CI environment. Here is a practical breakdown:

ModuleUseful in CI?Why
gitYesConsistent line endings, commit identity for tags
npmYesPrivate registry authentication
sshSometimesAccessing private repos or deploy targets
awsSometimesDeploying to AWS from CI
zshNoCI does not need shell customization
vscodeNoNo editor in CI
Security: Create a dedicated ConfigSync API token for CI with minimal scope. Store it as a repository secret in GitHub, a CI variable in GitLab, or the equivalent in your CI platform.

Selective Pull for Speed

CI pipelines are sensitive to startup time. Pulling your entire environment adds unnecessary seconds. The --filter flag ensures you only pull what the pipeline actually needs:

Filter examples for different pipeline stages
# Build stage: just Git and npm config configsync pull --filter modules:git,modules:npm # Deploy stage: add AWS credentials configsync pull --filter modules:git,modules:aws # Integration tests: add SSH for accessing test servers configsync pull --filter modules:git,modules:ssh # Everything (avoid this in CI) configsync pull

Each filter combination takes only what is needed, keeping your pipeline fast and your attack surface small.

GitLab CI and Other Platforms

The same pattern works across CI platforms. The only thing that changes is how you store and access the token:

.gitlab-ci.yml
build: image: node:20 before_script: - npm install -g @inventivehq/configsync - configsync setup --token $CS_TOKEN - configsync pull --filter modules:git,modules:npm script: - npm ci - npm run build

In GitLab, store CS_TOKEN as a CI/CD variable with the "masked" option enabled. In CircleCI, use a context or project environment variable. The ConfigSync commands are identical regardless of platform.

Team Benefits

When the whole team pushes configurations through ConfigSync, CI automatically gets the same settings everyone uses locally. If someone updates the shared Git config or npm registry settings, CI picks up the change on the next run. No more updating CI configs separately from local configs.

This closes the loop on environment consistency: your laptop, your colleagues' laptops, and your CI runners all pull from the same encrypted source of truth.

Ready to try ConfigSync?

Sync your entire dev environment across machines in minutes. Free forever for up to 3 devices.