阿里云 CI/CD 相关技巧
CI 流水线(官方叫云效 Flow)使用技巧
一些经验
- 不要为了几秒钟的 JOB 启动速度而用它的预置环境去构建 PHP 项目,会有很多问题。正解是回到常规手段,启动一个 Docker 容器在里面去做事情,是最稳定的方式。
- 任何 Artifact 都会打包成
.tgz格式,包括构建好的容器镜像信息也是 .tgz 后缀(该文件内容只有docker_url=xxxx而已)。
[已解决] curl error 6 ... thread failed to start
构建 Docker 镜像时执行 composer install/update 会有报错:
[22:28:54] #10 0.422 Loading composer repositories with package information
[22:28:55] #10 1.028
[22:28:55] #10 1.032 In CurlDownloader.php line 372:
[22:28:55] #10 1.032
[22:28:55] #10 1.032 curl error 6 while downloading https://repo.packagist.org/packages.json: ge
[22:28:55] #10 1.032 taddrinfo() thread failed to start
旧版 Docker 的代码不够壮健,可能会由于一些 DNS 的错误导致此问题发生。Docker 20.10.10 以上就不会有此报错了。
If your Docker is older than 20.10.10, update that first. Docker doesn't expose the syscall by default before this version.clone3
流水线 buildkit 的默认版本为 v0.8.0,内置的 Docker 版本过低。
实测选择 v0.11.6 解决问题。
acr_docker_build_step:
name: "镜像构建并推送至阿里云镜像仓库个人版"
step: "ACRDockerBuild"
with:
buildkitVersion: v0.11.6
阿里云的 NPM 私库服务
https://packages.aliyun.com/npm/npm-registry/guide
阿里的代理镜像有很多包是不全的,需要从 npm 官方去下载,代理设置如下:
