Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
thebushidocollective avatar

Gitlab Ci Artifacts Caching

  • 1 installs
  • 186 repo stars
  • Updated July 19, 2026
  • thebushidocollective/han

Configure GitLab CI artifacts for inter-job data passing and caching strategies for faster builds.

About

Covers configuring GitLab CI artifacts for passing data between jobs and caching for faster builds. A developer uses it when optimizing GitLab pipeline build times and artifact management.

  • Artifacts for inter-job data passing
  • Cache strategies for faster builds

Gitlab Ci Artifacts Caching by the numbers

  • 1 all-time installs (skills.sh)
  • Ranked #1,173 of 1,435 DevOps & CI/CD skills by installs in the Skillselion catalog
  • Data as of Aug 1, 2026 (Skillselion catalog sync)
npx skills add https://github.com/thebushidocollective/han --skill gitlab-ci-artifacts-caching

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs1
repo stars186
Last updatedJuly 19, 2026
Repositorythebushidocollective/han

What it does

Configure GitLab CI artifacts for inter-job data passing and caching strategies for faster builds.

Files

SKILL.mdMarkdownGitHub ↗

GitLab CI - Artifacts & Caching

Configure artifacts and caching for efficient pipeline execution.

Artifacts

Basic Artifact Configuration

build:
  script:
    - npm run build
  artifacts:
    paths:
      - dist/
    expire_in: 1 week

Artifact Reports

test:
  script:
    - npm test -- --coverage
  artifacts:
    reports:
      junit: junit.xml
      coverage_report:
        coverage_format: cobertura
        path: coverage/cobertura-coverage.xml

Conditional Artifacts

build:
  artifacts:
    paths:
      - dist/
    when: on_success  # on_success, on_failure, always
    exclude:
      - dist/**/*.map

Artifact Dependencies

build:
  artifacts:
    paths:
      - dist/

test:
  dependencies:
    - build  # Downloads build artifacts
  script:
    - npm test

deploy:
  dependencies: []  # Skip all artifact downloads
  script:
    - ./deploy.sh

Caching

Basic Cache Configuration

default:
  cache:
    key: ${CI_COMMIT_REF_SLUG}
    paths:
      - node_modules/
      - .npm/

Cache Key Strategies

# Per-branch cache
cache:
  key: ${CI_COMMIT_REF_SLUG}
  paths:
    - node_modules/

# Lock file based cache
cache:
  key:
    files:
      - package-lock.json
  paths:
    - node_modules/

# Combined key
cache:
  key:
    prefix: ${CI_JOB_NAME}
    files:
      - package-lock.json
  paths:
    - node_modules/

Cache Policy

install:
  cache:
    key: ${CI_COMMIT_REF_SLUG}
    paths:
      - node_modules/
    policy: push  # Only upload cache
  script:
    - npm ci

test:
  cache:
    key: ${CI_COMMIT_REF_SLUG}
    paths:
      - node_modules/
    policy: pull  # Only download cache
  script:
    - npm test

Fallback Keys

cache:
  key: ${CI_COMMIT_REF_SLUG}
  fallback_keys:
    - ${CI_DEFAULT_BRANCH}
    - main
  paths:
    - node_modules/

Distributed Cache (S3)

Configure in GitLab Runner:

[runners.cache]
  Type = "s3"
  Shared = true
  [runners.cache.s3]
    ServerAddress = "s3.amazonaws.com"
    BucketName = "gitlab-runner-cache"
    BucketLocation = "us-east-1"

Artifacts vs Cache

FeatureArtifactsCache
PurposePass data between jobsSpeed up job execution
StorageGitLab serverRunner local or S3
ReliabilityGuaranteedBest effort
ExpirationConfigurableConfigurable
Cross-pipelineYes (with dependencies)Yes (with keys)

Best Practices

1. Use cache for dependencies (node_modules, vendor) 2. Use artifacts for build outputs 3. Set appropriate expiration times 4. Use lock file-based cache keys 5. Exclude source maps and unnecessary files 6. Use policy: pull for jobs that only read cache

Related skills

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.