AlloyCI v0.7.0 发布!
AlloyCI v0.7.0 已经发布!此版本包括一些_major_ 更改。继续阅读以获得更好的描述,或在此处访问以查看代码。
弃用
此版本的最大变化是 JSON 配置文件已被弃用。您将无法再使用它们来配置您的 AlloyCI 构建。从现在开始,您将需要一个 YAML 配置文件。
这个决定背后的主要原因是 YAML 比 JSON 灵活得多。它允许我们在 oder 中使用别名以避免重复,添加注释使配置文件更易于理解,它是市场上几乎所有 CI 系统事实上的标准配置文件。
当我第一次开始编写 AlloyCI 时,我最初的意图是使用 YAML 作为配置文件,但当时 YamlElixir 库并不支持所有现代 YAML 功能。几个月前,这些功能被添加到库中,但它仍然缺乏对别名的适当支持。我决定看看添加该功能有多么困难。幸运的是它非常简单,所以现在 AlloyCI 使用它自己的 YamlEixir 库[分支正确支持别名。
此外,YAML 使配置文件更易于编写和阅读。例如,这里是用于 AlloyCI 的 JSON 格式的配置文件:
{
"image": "elixir:latest",
"services": [
"postgres:9.6"
],
"cache": {
"paths": [
"_build/",
"deps/"
]
},
"variables": {
"MIX_ENV": "test",
"GITHUB_CLIENT_ID": "fake-id",
"GITHUB_CLIENT_SECRET": "fake-secret",
"GITHUB_SECRET_TOKEN": "fake-token",
"SECRET_KEY_BASE": "NULr4xlNDNzEwE77UHdId7cQU+vuaPJ+Q5x3l+7dppQngBsL5EkjEaMu0S9cCGbk",
"DATABASE_URL": "postgres://postgres@postgres:5432/alloy_ci_test"
},
"before_script": [
"mix local.hex --force",
"mix local.rebar --force",
"mix deps.get",
"mix ecto.setup"
],
"mix + coveralls": {
"stage": "test",
"tags": [
"elixir",
"postgres"
],
"script": [
"mix coveralls.post --branch \"$CI_COMMIT_REF_SLUG\" --name \"$CI_SERVER_NAME\" --sha \"$CI_COMMIT_SHA\" --committer \"$CI_COMMIT_PUSHER\" --message \"$CI_COMMIT_MESSAGE\""
]
},
"credo + formatter": {
"stage": "test",
"tags": [
"elixir"
],
"script": [
"mix credo",
"mix format --check-formatted"
]
}
}
这是 YAML 中完全相同的配置:
image: elixir:latest
services:
- postgres:9.6
cache:
paths:
- _build/
- deps/
variables:
MIX_ENV: test
GITHUB_CLIENT_ID: fake-id
GITHUB_CLIENT_SECRET: fake-secret
GITHUB_SECRET_TOKEN: fake-token
SECRET_KEY_BASE: NULr4xlNDNzEwE77UHdId7cQU+vuaPJ+Q5x3l+7dppQngBsL5EkjEaMu0S9cCGbk
DATABASE_URL: postgres://postgres@postgres:5432/alloy_ci_test
before_script:
- mix local.hex --force
- mix local.rebar --force
- mix deps.get
- mix ecto.setup
mix + coveralls:
stage: test
tags:
- elixir
- postgres
script:
- mix coveralls.post --branch "$CI_COMMIT_REF_SLUG" --name "$CI_SERVER_NAME" --sha
"$CI_COMMIT_SHA" --committer "$CI_COMMIT_PUSHER" --message "$CI_COMMIT_MESSAGE"
credo + formatter:
stage: test
tags:
- elixir
script:
- mix credo
- mix format --check-formatted
干净多了,对吧?
此外,YAML 允许您在文件中使用注释,这意味着如果您有特别复杂的设置,您可以在其中留下注释,以便项目新手更容易理解。
除此之外,YAML 允许您在文件中声明别名,如通用部分,可以在其他声明中重用以避免额外的输入,例如:
image: elixir:latest
# This is the generic part we want to reuse.
.docker: &docker
image: elixir:1.5
entrypoint:
- "/bin/bash"
mix:
# In here he use that generic part, so everything declared there, will be added here
<<: *docker
services:
- postgres:9.6
stage: test
tags:
- elixir
- postgres
script:
- mix test
credo:
# Same goes for here
<<: *docker
services:
- postgres:latest
- redis:latest
stage: test
tags:
- elixir
script:
- mix credo
# This one does not use the generic part, so it will use the `image` declared in the first line
distillery:
tags:
- elixir
- postgres
variables:
MIX_ENV: prod
script:
- mix docker.build --tag latest
artifacts:
paths:
- alloy_ci.tar.gz
- _build/prod/lib/alloy_ci
而且 AlloyCI 足够聪明,不会将.
开头的元素视为构建指令,因此不会创建名为.docker
的构建。
我确信使用 YAML 将使 AlloyCI 更加友好和易于使用。
新功能
此版本不包含许多新功能。最臭名昭著的是管道和构建的状态将通过各自页面中的 websockets 自动更新。
这意味着无论何时您在项目视图(查看管道列表)或管道视图(查看构建作业列表)中,只要后端的状态发生变化,每个项目的状态都会自动更新。这是通过凤凰频道完成的。您可以在此处看到为此工作所需的更改。
错误修复
-
修复了身份验证令牌过期时会发生的重定向循环。
-
恢复到 Kerosene v0.7.0,因为更新的 v0.8.0 存在分页错误。
感谢您对 AlloyCI 的关注,我希望此更新对您有用。一如既往,毫不犹豫地提出任何问题,或通过 GitHub 上的问题跟踪器报告任何错误。
查看 AlloyCI v0.7.0
🎉🐣
更多推荐
所有评论(0)