GItLab CI 一直在努力平衡易用性和灵活性,通过多种关键字和预定义变量来让用户更好的使用和构建 Pipeline,同时也不会过多的限制用户的发挥空间,上面这段逻辑,完全可以使用其他 shell 或Python、JS、Go 等编程语言来实现其功能。本文也只是一个引子,通过 Git Push 这个场景来引出include、before_script与a
variables: ENV_TYPE: "dev" GIT_CHECKOUT: "false" pipelineInit: tags: - build stage: .pre variables: GIT_CHECKOUT: "true" script: - ls -l cibuild: tags: - build stage: build script: - ls -l - echo 123 >test.yaml - ls -l citest1: tags: - build stage: test script: - ls ...
Predefined variables become available at three different phases of pipeline execution: Pre-pipeline: Pre-pipeline variables are available before the pipeline is created. These variables are the only variables that can be used withinclude:rulesto control which configuration files to use when creating the...
各种变量可以从这里找到:predefined variables 回滚处理 聊完了正常的流程,那么也该提一下出问题时候的操作了。 人非圣贤孰能无过,很有可能某次上线一些没有考虑到的地方就会导致服务出现异常,这时候首要任务就是让用户还可以照常访问,所以我们会选择回滚到上一个有效的版本去。 在项目中的Pipeline页面 或者Enviroment...
This pipeline runs by default. No configuration is required. Branch pipelines: Run when you push a new commit to a branch. Have access tosome predefined variables. Have access toprotected variablesandprotected runnerswhen the branch is aprotected branch. ...
artifacts:name可以使用任何的预定义变量(predefined variables)。它的默认名称为artifacts,当下载是就变成了artifacts.zip。 配置示例 通过使用当前job的名字作为存档名称: 代码语言:javascript 代码运行次数:0 运行 AI代码解释 job: artifacts: name: "$CI_JOB_NAME" 使用当前分支名称或者是tag作为存到名称,只存档没...
name允许定义创建的artifacts存档的名称。这样一来,我们可以为每个存档提供一个唯一的名称,当需要从GitLab中下载是才不会混乱。artifacts:name可以使用任何的预定义变量(predefined variables)。它的默认名称为artifacts,当下载是就变成了artifacts.zip。 配置示例 ...
only/except 支持的关键字 看了文档发现gitlab pipeline还支持rulesif关键字,再加上predefined_variables里的CI_COMMIT_TAG,尝试一下 build-code-job: script: echo rules: if: 'CI_COMMIT_TAG =~ /^\d+\.\d+\.\d+$/' push一下终于触发成功了。
Deployment variables. Predefined environment variables. 翻译过来,是这样的: 不同类型的变量可以优先于其他变量,具体取决于它们的定义位置。 变量的优先顺序是(从最高到最低): 触发变量或预定的流水线变量。 项目级别变量或受保护变量。 组级别变量或受保护变量。 YAML定义的作业级变量。 YAML定义的全局变量。
Create a variable at the project level that references at least one predefined variable variables:SHORT_SHA_TAG:${CI_COMMIT_SHORT_SHA} Pass the variable to a downstream project .update-image:stage:deployvariables:APP_NAME:app-name-heretrigger:project:group/some/downstream/projectstrategy:dependupdate...