juechafun/20260127-备忘-工具-CNB云构建语法.md

2.1 KiB


#复盘/0 #临时/备忘 #状态/待处理

一句话描述

[cnb云构建__]


示例1

.cnb.yml

.pipeline: &tar-app
  - env:                          
      WORKSPACE_ROOT: "/workspace"
      SSL_PASS: "VkB!Y2@ImXR9k0*p0nvglYJBOQlmgihM"
    stages:
      - name: tar-release
        script:
          - /workspace/tools/scripts/tar-app.sh
          - /workspace/tools/scripts/tar-patch.sh
          - cp /workspace/patch/version.txt /workspace
        artifacts:
          paths:
            - artifacts.tar.gz
            - ./*.bin
            - version.txt
            
      - name: upload-tar
        image: cnbcool/attachments:latest
        settings:
          attachments:
            - artifacts.tar.gz
            - ./*.bin
            - version.txt

main:
  web_trigger_one:
    - <<: *tar-app

release:
  push:
    - <<: *tar-app

  web_trigger_one:
    - <<: *tar-app

$:
  vscode:
    - docker:
        # image: cnbcool/default-dev-env:latest
        build: .ide/Dockerfile
      services:
        - vscode
        - docker

.cnb/web_trigger.yml

branch:
  - reg: ^[main|release]
    buttons:
      - name: Release APP&PATCH
        description: 打包程序和补丁
        event: web_trigger_one

示例2

.cnb.yml

main:
  push:
    - docker:
    

      stages:
        - name: build-bin
          image: espressif/idf:release-v5.0
          script:
            - . $IDF_PATH/export.sh
            - idf.py set-target esp32s3
            - idf.py clean
            - idf.py build
            - esptool.py --chip esp32s3 merge_bin -o merged.bin 0x0 build/bootloader/bootloader.bin 0x8000 build/partition_table/partition-table.bin 0x10000 build/xr-ai-cam.bin
          artifacts:
            paths:
              - merged.bin

        - name: upload-bin
          image: cnbcool/attachments:latest
          settings:
            attachments:
              - merged.bin


$:
  vscode:
    - docker:
        image: espressif/idf:release-v5.0
      services:
        - vscode
        - docker
      stages:
        - name: ls
          script: ls -al