circleci

Sử dụng khi viết, chỉnh sửa hoặc xem xét cấu hình CircleCI cho kho lưu trữ Astronomer APC. Bao gồm tổ chức script, script nội tuyến so với script bên ngoài, và…

npx skills add https://github.com/astronomer/astronomer --skill circleci

CircleCI Configuration Guide

Critical Rules

  1. No long inline scripts — script logic for any language must not be written inline in .circleci/config.yml if the script has complicated flow control. Complicated scripts belong in bin/.
  2. Scripts live in bin/ — every script called from CircleCI must exist as a file in the bin/ directory with an appropriate extension (e.g. bin/my-script.sh, bin/my-script.py).
  3. Pin all versions — never use latest or unpinned tags for Docker images or installed tools. Always specify an exact version to prevent supply chain vulnerabilities and ensure reproducible builds.

Script Organization

Scripts invoked by CircleCI jobs must be committed to the repository under bin/ so they can be:

  • Linted and reviewed like any other source file
  • Tested and run locally without needing CI
  • Reused across multiple jobs or workflows
# ✅ CORRECT — call a script from bin/
steps:
  - run:
      name: Build Helm chart
      command: bin/build-helm-chart.sh
# ❌ WRONG — inline shell logic in the CircleCI config
steps:
  - run:
      name: Build Helm chart
      command: |
        helm package .
        mv astronomer-*.tgz /tmp/chart/

Config Generation Pipeline

.circleci/config.yml is never edited directly. It is a generated file produced by rendering the Jinja2 template .circleci/config.yml.j2 via bin/generate_circleci_config.py:

# Regenerate config.yml from the template
uv run bin/generate_circleci_config.py

The generator injects a small set of computed variables (e.g. ci_runner_version, kube_versions, machine_image_version, docker_images) into the template at render time. Always edit .circleci/config.yml.j2, then regenerate.


Version Pinning

Always pin exact versions for Docker images and any tools installed during a job. Using latest or loose tags introduces supply chain risk and makes builds non-reproducible.

All pinned versions must be declared as Jinja2 variables at the top of .circleci/config.yml.j2, not scattered inline throughout the file. This makes them easy to audit and update in one place. All version declarations must include a link to where the list of released versions can be found, so that updating them is straightforward and doesn't require searching online to find more recent releases.

{# ✅ CORRECT — versions declared at top of config.yml.j2 #}
{#- https://circleci.com/docs/guides/execution-managed/building-docker-images/#docker-version -#}
{%- set circleci_docker_version = 'docker23' -%}

{#- https://circleci.com/developer/machine/image/ubuntu-2404 -#}
{%- set machine_image_version = 'ubuntu-2404:2025.09.1' -%}
# Then referenced inline:
docker:
  - image: cimg/python:{{ python_image_version }}
# ❌ WRONG — version hardcoded inline, not declared at top
docker:
  - image: cimg/python:3.8.1
# ❌ WRONG — unpinned image
docker:
  - image: cimg/python:latest
# ✅ CORRECT — pinned tool version installed in a step
- run:
    name: Install helm
    command: bin/install-ci-tools.py 3.17.2

# ❌ WRONG — unversioned tool install
- run:
    name: Install helm
    command: curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash

Thêm skills từ astronomer

airflow-state-store
astronomer
Persists task and asset state across retries and DAG runs using Airflow 3.3's AIP-103 key/value stores (`task_state_store`, `asset_state_store`) and the…
creating-openlineage-extractors
astronomer
Các extractor OpenLineage tùy chỉnh cho các toán tử Airflow không được hỗ trợ và các kịch bản lineage phức tạp. Hai cách tiếp cận: thêm các phương thức OpenLineage trực tiếp vào các toán tử bạn sở hữu (khuyến nghị), hoặc tạo các extractor tùy chỉnh cho các toán tử bên thứ ba mà bạn không thể sửa đổi. Extractor can thiệp vào quá trình thực thi toán tử tại ba điểm: trước khi thực thi để lấy lineage tĩnh, sau khi thành công để lấy đầu ra được xác định trong thời gian chạy, và tùy chọn sau khi thất bại để lấy lineage một phần. Đăng ký extractor thông qua airflow.cfg hoặc môi trường...
debugging-dags
astronomer
Phân tích nguyên nhân gốc rễ có hệ thống và khắc phục cho các DAG Airflow bị lỗi với quy trình điều tra có cấu trúc. Hướng dẫn qua quy trình chẩn đoán bốn bước: xác định lỗi, trích xuất chi tiết lỗi, thu thập thông tin ngữ cảnh và đưa ra các bước khắc phục khả thi. Phân loại lỗi thành bốn loại (dữ liệu, mã, cơ sở hạ tầng, phụ thuộc) để tập trung điều tra và đề xuất các bản sửa lỗi phù hợp. Cung cấp các lệnh CLI sẵn sàng sử dụng để truy xuất nhật ký, so sánh lần chạy, xóa tác vụ và DAG...
delegating-to-otto
astronomer
Drives Astronomer's Otto agent (`astro otto`) as a delegated sub-agent for Airflow, dbt, and data-engineering work. Use when the user explicitly asks to "use…
deploying-airflow
astronomer
Triển khai Airflow DAGs và các dự án. Sử dụng khi người dùng muốn triển khai mã, đẩy DAGs, thiết lập CI/CD, triển khai lên môi trường sản xuất hoặc hỏi về các chiến lược triển khai…
deploying-go-sdk-bundles
astronomer
Xây dựng, đóng gói và triển khai các gói Airflow Go SDK đã biên dịch để ExecutableCoordinator có thể chạy chúng. Sử dụng khi người dùng muốn biên dịch một gói tác vụ Go, yêu cầu…
testing-dags
astronomer
Các chu trình kiểm tra-gỡ lỗi-sửa lỗi lặp đi lặp lại cho Airflow DAG với chẩn đoán lỗi toàn diện. Bắt đầu bằng af runs trigger-wait <dag_id> để chạy một DAG và chờ hoàn tất; không cần kiểm tra trước khi chạy. Khi gặp lỗi, sử dụng af runs diagnose để có bản tóm tắt lỗi toàn diện và af tasks logs để kiểm tra chi tiết lỗi từ các tác vụ cụ thể. Hỗ trợ cấu hình tùy chỉnh, thời gian chờ và số lần thử lại; xử lý các tình huống thành công, thất bại và hết thời gian chờ với diễn giải phản hồi rõ ràng. Có sẵn tính năng xác th
tracing-downstream-lineage
astronomer
Truy xuất dòng dữ liệu xuôi dòng để đánh giá tác động của thay đổi trước khi sửa đổi bảng hoặc DAG. Xác định người tiêu dùng trực tiếp của bảng hoặc DAG mục tiêu thông qua tìm kiếm mã nguồn, phụ thuộc view và kết nối công cụ BI. Xây dựng cây phụ thuộc đầy đủ ánh xạ tất cả tác động xuôi dòng, từ bảng đến dashboard đến mô hình ML. Phân loại phụ thuộc theo mức độ quan trọng (quan trọng, cao, trung bình, thấp) để ưu tiên giao tiếp với các bên liên quan và kiểm thử. Tạo báo cáo tác động với đánh giá rủi ro, các thành phần bị