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/` 中删除文件,那么后续的作业将无法再使用该文件。因此,制品的作用就像是流水线的数据缓冲区。

抱歉。
相关文章

原文

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