CI 作业产物不应难以获取。
CI jobs artifacts should not be difficult

原始链接: https://deadsimpleci.sparrowhub.io/doc/job-artifacts

### 作业制品 (Job Artifacts) DSCI 大幅简化了流水线中处理制品的流程。要创建制品文件,只需在某个任务文件中将其创建在 `~/artifacts/` 目录下即可,例如: ```bash #!/bin/bash echo "DSCI is cool" > ~/artifacts/artifacts.txt ``` 下一个作业将在同一目录下看到它: ```python #!/usr/bin/python3 from pathlib import Path file_path = Path.home() / "artifacts" / "artifacts.txt" # 2. 使用上下文管理器安全地读取文件 try: with open(file_path, "r", encoding="utf-8") as file: content = file.read() print(content) except FileNotFoundError: print(f"Error: The file at {file_path} was not found.") ``` --- 就是这样。实际上,任何位于 `~/artifacts` 目录下的文件都是制品。如果某个作业决定从 `~/artifacts/` 中删除文件,那么后续的作业将无法再使用该文件。因此,制品的作用就像是流水线的数据缓冲区。

近期 Hacker News 上的一场讨论对旨在简化 CI/CD 流水线的项目“Dead Simple CI”(DSCI) 进行了批评。 该项目因其“无 YAML”(YAMLess)的营销口号立即招致了抵制。尽管作者声称 DSCI 可以避开 YAML,但文档中却出现了 YAML 配置文件,用户认为这损害了项目的信誉。开发者最终承认措辞不当,并更新了网站,澄清尽管高层结构使用 YAML,但实际的流水线逻辑使用的是通用编程语言。 技术层面,关于 CI 制品(artifacts)的实现也引发了辩论。作者提出了一种“共享目录”方法(`~/artifacts`)以避免繁琐的配置,并指出标准 CI 系统在作业间共享文件过于复杂。批评者指出该项目的文档和示例代码存在前后不一致,对其系统的可靠性提出了质疑。另有人指出,共享目录模式可能不适用于大规模并行化的 CI 环境。总而言之,该讨论给开发者的启示是:在发布技术工具时,清晰准确的文档至关重要,而误导性的营销则会带来风险。
相关文章

原文

job-artifacts


# Job Artifacts DSCI dramatically simplify working with artifacts process inside pipelines. To create artifact file just create it in `~/artifacts/` directory in some task file, for example: ```bash #!/bin/bash echo "DSCI is cool" > ~/artifacts.txt ``` The the next job will see it in the same directory: ```python #!/usr/bin/python3 from pathlib import Path file_path = Path.home() / "artifacts.txt" # 2. Read the file safely using a context manager try: with open(file_path, "r", encoding="utf-8") as file: content = file.read() print(content) except FileNotFoundError: print(f"Error: The file at {file_path} was not found.") ``` --- That's it. Artifacts de-facto is any file located in `~/artifacts` dir, If some job decides to remove a file from `~/artifacts/` it won't be available for the next jobs. So artifacts works as a pipeline data buffer

联系我们 contact @ memedata.com