feat(cli): add image management workflow#429
Open
Jinghao-coding wants to merge 1 commit into
Open
Conversation
2c57cc1 to
73e94e4
Compare
Member
Author
|
@AkashiSensei 已按前几个 CLI PR 的 review 约定重做这一版 image workflow(最新提交 主要调整:
本地验证:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary / 摘要
English
This PR adds the Crater CLI image and environment management workflow on top of the latest
upstream/main. It keeps user image operations undercrater image ..., moves platform/admin image operations undercrater admin image ..., covers the image APIs that are part of the image domain, and hardens backend image ownership checks for user write operations.中文
本 PR 基于最新
upstream/main为 Crater CLI 增加镜像与环境管理工作流。用户侧镜像操作统一放在crater image ...,平台管理员镜像操作统一放在crater admin image ...;同时覆盖 image 域相关 API,并补齐后端用户写操作的镜像 owner 权限校验。Added Commands / 新增命令
User image builds / 用户镜像构建
crater image build lscrater image build get <name>crater image build template <name>crater image build pod <id>crater image build pip-apt --name NAME --tag TAG --image BASE ...crater image build dockerfile --name NAME --tag TAG (--dockerfile TEXT | --file PATH)crater image build envd --name NAME --tag TAG (--envd TEXT | --file PATH)crater image build remove --ids 1,2User image records / 用户镜像记录
crater image ls [--available] [--type TYPE] [--arch ARCH] [--visibility VISIBILITY] [--owner OWNER] [--search TEXT]crater image upload --image LINK [--type TYPE]crater image delete <id>crater image delete-many --ids 1,2crater image description <id> --description TEXTcrater image type <id> --type TYPEcrater image tags <id> --tags a,bcrater image arch <id> --archs linux/amd64,linux/arm64crater image valid --links image-a,image-bSharing, CUDA, Harbor / 分享、CUDA、Harbor
crater image share ls <image-id>crater image share users <image-id> [--name NAME]crater image share accounts <image-id>crater image share add <image-id> --share-type user|account --ids 1,2crater image share remove <image-id> --share-type user|account --target-id IDcrater image cuda ls|add|deletecrater image harbor infocrater image harbor credential --yescrater image quota get|set --size BYTESAdmin image workflow / 管理员镜像流程
crater admin image build-lscrater admin image build-remove --ids 1,2crater admin image lscrater admin image delete-many --ids 1,2crater admin image description <id> --description TEXTcrater admin image type <id> --type TYPEcrater admin image tags <id> --tags a,bcrater admin image arch <id> --archs linux/amd64,linux/arm64crater admin image public <id>Implementation Details / 实现说明
English
upstream/mainand reused existing CLI shared helpers instead of reintroducing duplicateapi_client, completion, response, and argument helpers.crater admin image ...; the PR no longer uses--adminorcrater image admin ....allis valid only as a local list filter, not as a writable image task type.cli/docs/COMMANDS.md.中文
upstream/main,复用已有 CLI shared helper,不再重复引入api_client、completion、response 和参数 helper。crater admin image ...,不再使用--admin或crater image admin ...。all只允许作为本地列表过滤值,不允许写入镜像任务类型。cli/docs/COMMANDS.md。Test Coverage / 测试覆盖
Added/updated tests / 新增或更新测试
cli/test/snapshots/image/image_test.gocli/testdata/snapshots/image/image.en.txtarcli/testdata/snapshots/image/image.zh-CN.txtarcli/test/snapshots/read/read_matrix_test.goSnapshot cases cover / 快照覆盖场景
Verification / 验证
GOCACHE=/private/tmp/crater-go-cache go test ./...(cli)GOCACHE=/private/tmp/crater-go-cache go test ./test/snapshots/image(cli)GOCACHE=/private/tmp/crater-go-cache go test ./test/snapshots/read(cli)make lint(backend)make lint-diff(backend)go test ./internal/handler/operations ./internal/bizerr ./internal/resputil(backend)go build ./cmd/crater/main.go(backend)make docs(backend)Notes / 备注
English
This PR focuses on image/environment management only. Job creation, dataset management, and approval-order workflows remain in their dedicated PRs.
中文
本 PR 仅聚焦镜像/环境管理。作业创建、数据集管理和审批工单工作流仍由各自独立 PR 处理。