CI/CD Integration

Automate Your Pipeline with CodeSync

Schnelle, DSGVO-konforme Paket-Infrastruktur für Deutschland

Connect CodeSync to Jenkins, GitLab CI, or GitHub Actions in under five minutes. Pre-built configurations, authenticated registry access, and artifact publishing — all without routing traffic through third-party infrastructure.

Get Started View Jenkins Guide

Overview

CodeSync integrates directly into your existing CI/CD toolchain. Whether you manage Maven artifacts, npm packages, or Python wheels, CodeSync acts as your on-premise or region-local package mirror and publisher — reducing latency, eliminating external dependencies, and keeping your supply chain within EU borders.

Jenkins

Native support via the CodeSync Plugin (v2.4.1+) and credential-bound registry configurations. Works with Pipeline-as-Code (Jenkinsfile) and freestyle jobs alike.

GitLab CI

Drop-in `.gitlab-ci.yml` stages for dependency resolution and artifact publishing. Supports GitLab's built-in credential variables and deploy tokens.

GitHub Actions

Pre-built actions published to the GitHub Marketplace. Configure once in your workflow YAML and let CodeSync handle caching, mirroring, and publishing.

CodeSync CI/CD pipeline integration showing Jenkins, GitLab CI, and GitHub Actions connecting to the CodeSync package registry

Jenkins Guide

The CodeSync Plugin is available from the Jenkins Update Center. Install it alongside the Credentials Binding Plugin to manage registry tokens securely.

Prerequisites

Jenkins 2.387 or later, CodeSync Plugin v2.4.1+, and a valid CodeSync team token (generated under Settings → API Tokens in your CodeSync dashboard).

Pipeline Configuration

Add the following stage to your Jenkinsfile to resolve dependencies through CodeSync and publish build artifacts:

pipeline {
  agent any

  environment {
    CODESYNC_TOKEN = credentials('codesync-team-token')
    CODESYNC_URL   = 'https://de1.codesync.io/mirror'
  }

  stages {
    stage('Resolve Dependencies') {
      steps {
        codesyncMirror(
          registry: 'maven',
          url:      CODESYNC_URL,
          token:    CODESYNC_TOKEN,
          packages: ['org.springframework:spring-core',
                     'com.google.guava:guava']
        )
      }
    }

    stage('Build') {
      steps {
        sh 'mvn clean package -DskipTests'
      }
    }

    stage('Publish Artifact') {
      steps {
        codesyncPublish(
          registry: 'maven',
          url:      CODESYNC_URL + '/publish',
          token:    CODESYNC_TOKEN,
          file:     'target/my-app-1.4.2.jar'
        )
      }
    }
  }
}

Freestyle Job Setup

If you are not using Pipeline-as-Code, configure the CodeSync build step manually:

Tip: Enable the Cache Dependencies option to avoid re-downloading unchanged transitive dependencies across builds. Teams at MerkurIT reported a 38 % reduction in Maven resolution time after enabling this feature.

GitLab CI Guide

GitLab CI users can mirror and publish packages by adding two lightweight stages to their .gitlab-ci.yml. CodeSync supports GitLab's native CI/CD variables, so token management stays centralized.

Prerequisites

GitLab 15.0+, a CodeSync team or project token, and the codesync-cli tool (available at https://de1.codesync.io/cli/latest).

CI/CD Variables

Store the following in Settings → CI/CD → Variables (masked and protected):

Example .gitlab-ci.yml

stages:
  - mirror
  - build
  - publish

variables:
  MAVEN_OPTS: "-Dmaven.repo.local=$CI_PROJECT_DIR/.m2/repository"

install-cli:
  stage: mirror
  image: alpine:3.19
  script:
    - apk add --no-cache curl tar
    - curl -fSL https://de1.codesync.io/cli/latest/linux-amd64.tar.gz | tar xz
    - ./codesync-cli configure --endpoint $CODESYNC_ENDPOINT --token $CODESYNC_TOKEN

resolve-deps:
  stage: mirror
  image: maven:3.9.6-eclipse-temurin-17
  script:
    - codesync-cli mirror maven --packages org.springframework:spring-core:6.1.2
    - mvn dependency:resolve

build:
  stage: build
  image: maven:3.9.6-eclipse-temurin-17
  script:
    - mvn clean package -DskipTests
  artifacts:
    paths:
      - target/*.jar

publish:
  stage: publish
  image: alpine:3.19
  script:
    - curl -fSL https://de1.codesync.io/cli/latest/linux-amd64.tar.gz | tar xz
    - ./codesync-cli configure --endpoint $CODESYNC_ENDPOINT --token $CODESYNC_TOKEN
    - ./codesync-cli publish maven --file target/my-app-1.4.2.jar
  rules:
    - if: $CI_COMMIT_BRANCH == "main"

Deploy Token Alternative: If your GitLab instance uses deploy tokens for package registries, you can forward the token to CodeSync via codesync-cli configure --token $DEPLOY_TOKEN. This approach is used by the open-source project Flusswerk (Kiel) for their multi-module Maven builds.

GitHub Actions Guide

The codesync/setup-mirror and codesync/publish actions are published on the GitHub Marketplace. They handle authentication, cache warm-up, and artifact upload in a single step each.

Prerequisites

A GitHub repository with Actions enabled and a CodeSync token stored as a repository secret (Settings → Secrets and variables → Actions). Secret name: CODESYNC_TOKEN.

Example Workflow

Create .github/workflows/release.yml with the following content:

name: Build & Publish to CodeSync

on:
  push:
    branches: [ main ]
  release:
    types: [ published ]

jobs:
  build:
    runs-on: ubuntu-22.04
    permissions:
      contents: read
      packages: write

    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Set up Java
        uses: actions/setup-java@v4
        with:
          distribution: temurin
          java-version: '17'

      - name: Configure CodeSync Mirror
        uses: codesync/setup-mirror@v3
        with:
          registry: maven
          endpoint: https://de1.codesync.io/mirror
          token:    ${{ secrets.CODESYNC_TOKEN }}
          packages: |
            org.springframework:spring-core:6.1.2
            com.google.guava:guava:33.0.0-jre

      - name: Build
        run: mvn clean package -DskipTests

      - name: Publish to CodeSync
        if: github.event_name == 'release'
        uses: codesync/publish@v3
        with:
          registry: maven
          endpoint: https://de1.codesync.io/mirror
          token:    ${{ secrets.CODESYNC_TOKEN }}
          file:     target/my-app-${{ github.ref_name }}.jar

npm and pip Support

The same actions support npm and PyPI registries. Change the registry parameter to npm or pypi and adjust the build step accordingly. The codesync/setup-mirror action automatically generates the correct .npmrc or pip.conf for authenticated downloads.

Real-world usage: The startup Vectura Health (Hamburg) migrated their entire npm monorepo (42 packages, ~1,200 transitive dependencies) to CodeSync via GitHub Actions. Average cold-start resolution time dropped from 14 s to 2.3 s, with 99.8 % cache-hit rates after the first week.

Back to Overview Download CodeSync CLI