用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/GoogleCloudPlatform/composer-utilities --skill local-airflow-unit-tests命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
正在显示 SKILL.md
基于 SOC 职业分类
| name | local-airflow-unit-tests |
| description | Summarizes how to use docker to run a tagged Composer image for local testing. |
This skill describes how to run Cloud Composer images locally using docker to execute unit tests in an environment that matches the production Composer environment.
docker installed and running.Use the provided script to get the fully qualified Docker image tag for the desired Composer version. This script reads from cicd/composer_version.txt.
# From the repository root
IMAGE_TAG=$(python3 cicd/get_composer_tagged_image.py)
echo $IMAGE_TAG
This will output something like:
us-docker.pkg.dev/cloud-airflow-releaser/airflow-worker-scheduler-2-10-5/airflow-worker-scheduler-2-10-5:composer-2-airflow-2.10.5
To run tests locally, you need to mount your workspace into the container so that it has access to your DAGs, requirements, and test files.
You can run the container interactively:
# Get the image tag
IMAGE_TAG=$(python3 cicd/get_composer_tagged_image.py)
# Run the container
docker run -it \
-v $(pwd):/workspace \
-w /workspace \
--entrypoint /bin/bash \
$IMAGE_TAG
Once inside the container, you can run the test script directly:
/workspace/cicd/run_tests.sh
Alternatively, you can manually execute the steps below. Make sure that all test results are printed out via standard output:
#!/usr/bin/env bash
# Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Enable exit-on-error mode
set -eo pipefail
# Determine base directory whether mounted at repo root or inside cicd directory
if [ -d "/workspace/cicd" ]; then
BASE_DIR="/workspace/cicd"
elif [ -d "/workspace/dags" ]; then
BASE_DIR="/workspace"
else
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
BASE_DIR="$SCRIPT_DIR"
fi
DAGS_DIR="$BASE_DIR/dags"
TESTS_DIR="$BASE_DIR/tests"
REQUIREMENTS_FILE="$DAGS_DIR/requirements.txt"
# Set up the Python user base directory where local packages will be installed
export PYTHONUSERBASE=/home/airflow/.local
PATH=/bin:
AIRFLOW_HOME=/home/airflow/airflow
AIRFLOW__CORE__LOAD_EXAMPLES=False
PYTHONDONTWRITEBYTECODE=1
pip list --format=freeze > /tmp/constraints.txt
sed -i /tmp/constraints.txt
[ -f ];
pip install --no-cache-dir --user pytest \
--requirement \
--constraint /tmp/constraints.txt
pip install --no-cache-dir --user pytest \
--constraint /tmp/constraints.txt
SITE_PACKAGES=$(python3 -c 2>/dev/null || )
[ -d ];
-p ||
-R airflow: ||
AIRFLOW__API__AUTH_BACKENDS=airflow.api.auth.backend.basic_auth
AIRFLOW__CORE__DAGS_FOLDER=
airflow standalone > /dev/null &
airflow db check
RETRIES=60
curl -sf http://localhost:8080 > /dev/null || [ -eq 0 ];
2
RETRIES=$((RETRIES - ))
[ -eq 0 ];
1
airflow dags list
python3 -m pytest -o cache_dir=/tmp/.pytest_cache -vv -s
Make any necessary Airflow DAG code corrections or refactors to get the tests passing. Do not modify the semantic logic of any DAGs or tests. Do not modify any thresholds or constants being checked in the tests.