elastic-package-cli

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

elastic-package CLI

elastic-package CLI

When to use

适用场景

Use this skill when tasks include:
  • validating package structure and formatting
  • building a package artifact
  • running pipeline or system tests
  • managing local Elastic test stack lifecycle
  • installing or checking package status in Kibana
当你需要完成以下任务时使用本技能:
  • 验证包结构与格式
  • 构建包制品
  • 运行流水线或系统测试
  • 管理本地Elastic测试栈生命周期
  • 在Kibana中安装或检查包状态

When not to use

不适用场景

Do not use this skill as the primary guide for:
  • ECS field design decisions (use an ECS-focused skill)
  • ingest processor design and parsing strategy (use an ingest-pipeline-focused skill)
  • package layout architecture (use a package-structure-focused skill)
请勿将本技能作为以下内容的主要指南:
  • ECS字段设计决策(请使用ECS相关技能)
  • 摄入处理器设计与解析策略(请使用摄入流水线相关技能)
  • 包布局架构(请使用包结构相关技能)

Prerequisites

前置条件

  • elastic-package
    is installed and available in
    PATH
  • container runtime is available (Docker or Podman)
  • you run commands from a package directory (or pass
    -C <package-dir>
    )
  • elastic-package
    已安装并可在
    PATH
    中访问
  • 容器运行时可用(Docker或Podman)
  • 从包目录中运行命令(或通过
    -C <package-dir>
    指定目录)

Core workflows

核心工作流

1) Validate and build loop

1) 验证与构建循环

Run this sequence for routine local verification:
bash
elastic-package format
elastic-package lint
elastic-package check
elastic-package build
Notes:
  • check
    runs lint and build together and fails fast by default.
  • use
    format --fail-fast
    when you want read-only verification without rewriting files.
执行以下序列进行常规本地验证:
bash
elastic-package format
elastic-package lint
elastic-package check
elastic-package build
注意:
  • check
    会同时运行lint和build,默认快速失败。
  • 当你需要只读验证而不修改文件时,使用
    format --fail-fast

2) Pipeline test loop (fast iteration)

2) 流水线测试循环(快速迭代)

Use Elasticsearch-only stack for quicker feedback:
bash
elastic-package stack up -d --services=elasticsearch
elastic-package test pipeline
elastic-package test pipeline --generate
Then review generated expected files before keeping changes.
仅使用Elasticsearch栈以获得更快的反馈:
bash
elastic-package stack up -d --services=elasticsearch
elastic-package test pipeline
elastic-package test pipeline --generate
然后在保留更改前查看生成的预期文件。

3) System test loop (end-to-end)

3) 系统测试循环(端到端)

Use this when you need full ingest behavior with service provisioning:
bash
elastic-package stack up -d
elastic-package service up
elastic-package test system
Use
--data-streams <name>
to scope tests and reduce run time.
当你需要完整的摄入行为及服务配置时使用:
bash
elastic-package stack up -d
elastic-package service up
elastic-package test system
使用
--data-streams <name>
来限定测试范围并缩短运行时间。

Practical command examples

实用命令示例

bash
undefined
bash
undefined

format package files

格式化包文件

elastic-package format
elastic-package format

lint against package spec and templates

针对包规范和模板进行检查

elastic-package lint
elastic-package lint

combined validation workflow

组合验证工作流

elastic-package check
elastic-package check

build package artifact

构建包制品

elastic-package build
elastic-package build

start only Elasticsearch for pipeline tests

仅启动Elasticsearch用于流水线测试

elastic-package stack up -d --services=elasticsearch
elastic-package stack up -d --services=elasticsearch

run pipeline tests

运行流水线测试

elastic-package test pipeline
elastic-package test pipeline

regenerate expected pipeline outputs

重新生成预期的流水线输出

elastic-package test pipeline --generate
elastic-package test pipeline --generate

run end-to-end system tests

运行端到端系统测试

elastic-package test system
undefined
elastic-package test system
undefined

Key flags cheat sheet

关键标志速查表

  • global:
    -C, --change-directory
    ,
    -v, --verbose
  • stack:
    -d, --daemon
    ,
    -s, --services
    ,
    --version
    ,
    -p, --profile
  • pipeline tests:
    -d, --data-streams
    ,
    -g, --generate
    ,
    -m, --fail-on-missing
  • system tests:
    --setup
    ,
    --tear-down
    ,
    --no-provision
    ,
    --variant
  • 全局:
    -C, --change-directory
    ,
    -v, --verbose
  • 栈:
    -d, --daemon
    ,
    -s, --services
    ,
    --version
    ,
    -p, --profile
  • 流水线测试:
    -d, --data-streams
    ,
    -g, --generate
    ,
    -m, --fail-on-missing
  • 系统测试:
    --setup
    ,
    --tear-down
    ,
    --no-provision
    ,
    --variant

Quick command map

快速命令映射

  • validate/build:
    format
    ,
    lint
    ,
    check
    ,
    build
  • stack lifecycle:
    stack up
    ,
    stack status
    ,
    stack down
  • testing:
    test pipeline
    ,
    test system
    ,
    test static
    ,
    test asset
    ,
    test policy
    ,
    test script
  • package lifecycle:
    create
    ,
    install
    ,
    status
    ,
    uninstall
  • support:
    service up
    ,
    profiles
    ,
    benchmark
  • 验证/构建:
    format
    ,
    lint
    ,
    check
    ,
    build
  • 栈生命周期:
    stack up
    ,
    stack status
    ,
    stack down
  • 测试:
    test pipeline
    ,
    test system
    ,
    test static
    ,
    test asset
    ,
    test policy
    ,
    test script
  • 包生命周期:
    create
    ,
    install
    ,
    status
    ,
    uninstall
  • 支持:
    service up
    ,
    profiles
    ,
    benchmark

References

参考资料

  • Failure diagnosis and fixes:
    references/troubleshooting.md
  • 故障诊断与修复:
    references/troubleshooting.md