Skip to content

BFCIComponents

GitLab CI/CD components for Bluefly projects.

Overview

BFCIComponents provides standardized CI/CD components for use across Bluefly projects. These components support:

  • Node.js application builds and tests
  • Documentation generation and publishing
  • ML model registry integration
  • Custom Docker image usage

Components

  • nodejs-base.yml: Base configuration for Node.js projects
  • nodejs-build.yml: Build configuration for Node.js projects
  • nodejs-test.yml: Test configuration for Node.js projects
  • documentation.yml: Documentation generation and publishing component
  • model-registry.yml: ML model registry integration component

Usage

To use these components in your GitLab CI/CD pipeline, include them in your .gitlab-ci.yml file:

include:
  - component: 'gitlab://blueflyio/BFCIComponents/components/nodejs-base.yml'
    inputs:
      node_version: "20"
      project_type: "app"
      use_custom_image: true
      custom_image_path: "registry.gitlab.bluefly.io/blueflyio/internal-projects/core-assets/bluefly-docker-image:latest"

Migration from BFCommon

The easiest way to migrate a project from BFCommon CI components to BFCIComponents is to use the BFCLI:

# Migrate CI configuration for all projects
bfcli dev migrate-ci

# Migrate CI configuration for specific projects
bfcli dev migrate-ci --projects BFAPI,BFUI

# Verify Docker image usage for all projects
bfcli dev verify-ci

# Verify Docker image usage for specific projects
bfcli dev verify-ci --projects BFAPI,BFUI

Manual Migration

You can also use the scripts directly:

# Migrate a project from BFCommon to BFCIComponents
./scripts/migrate-from-bfcommon.sh /path/to/project/.gitlab-ci.yml

# Verify the Docker image usage
./scripts/verify-custom-image.sh /path/to/project/.gitlab-ci.yml

Component Documentation

Configuration

Each component accepts various input parameters to customize its behavior:

  • node_version: Node.js version to use (e.g., "16", "18", "20")
  • project_type: Type of Node.js project (e.g., "app", "library")
  • use_custom_image: Whether to use the custom Docker image
  • custom_image_path: Path to the custom Docker image
  • cache_strategy: Strategy for caching dependencies

See the individual component documentation for detailed information on available parameters.

Custom Docker Image

All components are configured to use the Bluefly custom Docker image by default:

registry.gitlab.bluefly.io/blueflyio/internal-projects/core-assets/bluefly-docker-image:latest

This image contains pre-installed tools and dependencies required for building and testing Bluefly projects.

Local Dependency Handling

For repositories that use local dependencies (e.g., dependencies referencing file:../BFCommon), the components automatically execute a prepare-ci.sh script if it exists in the repository root. This script should modify the package.json file to replace local dependencies with appropriate alternatives for CI environments.

GitLab Component Format

The components follow the GitLab CI/CD Component format, with proper input specifications:

```yaml spec: inputs: node_version: description: "Node.js version to use for the jobs" default: "20" options: ["16", "18", "20", "21"]

# More inputs...

component_metadata: name: "nodejs-base" description: "Base configuration for Node.js projects with custom Docker image support" version: "1.0.0" maintainer: "Bluefly DevOps Team devops@bluefly.io" ```## Code Style Guidelines

This section outlines code style guidelines for CI/CD components.

  • Use consistent indentation (2 spaces)
  • Follow YAML best practices
  • Document all CI/CD components
  • Use meaningful variable names