logo
2
1
WeChat Login

Project Configuration Guide

This project demonstrates how to use the include configuration in .cnb.yml to manage environment variables during build and deployment processes.

Configuration File Structure

The project contains two main configuration files:

.cnb.yml

Main configuration file that includes:

  • References to other configuration files
  • Deployment environment variable definitions
  • Build process environment variable configurations

t.yml

Secondary configuration file that defines:

  • Environment variables for the build phase
  • Environment variables for the deployment phase (referenced from main config)
  • Related execution stages

Environment Variables

The project uses the following environment variables:

Build Phase

  • KEY_A: A
  • KEY_B: B
  • KEY_C: C

Deployment Phase

  • KEY_X: X
  • KEY_Y: Y

Usage Instructions

  1. The build process performs the following operations:

    • Sets environment variables KEY_A, KEY_B, and KEY_C
    • Executes env | grep KEY_ command to display all environment variables starting with KEY_
  2. The deployment process performs the following operations:

    • References environment variables (KEY_X and KEY_Y) from .deploy-env configuration
    • Executes env | grep KEY_ command to display all environment variables starting with KEY_

Configuration Examples

# .cnb.yml include: - ./t.yml .deploy-env: KEY_X: X KEY_Y: Y main: push: build: env: KEY_C: C
# t.yml main: push: build: env: KEY_A: A KEY_B: B stages: - env |grep KEY_ deploy: env: !reference [.deploy-env] stages: - env |grep KEY_

Important Notes

  1. Ensure to update related configuration files when modifying environment variables
  2. Deployment environment variables are referenced from .deploy-env using the !reference directive
  3. All environment variables are prefixed with KEY_ for easy filtering and management