<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                # GitLab CI/CD environment variables > 原文:[https://docs.gitlab.com/ee/ci/variables/README.html](https://docs.gitlab.com/ee/ci/variables/README.html) * [Predefined environment variables](#predefined-environment-variables) * [Use predefined environment variables](#use-predefined-environment-variables) * [Custom environment variables](#custom-environment-variables) * [Create a custom variable in `.gitlab-ci.yml`](#create-a-custom-variable-in-gitlab-ciyml) * [Create a custom variable in the UI](#create-a-custom-variable-in-the-ui) * [Custom environment variables of type Variable](#custom-environment-variables-of-type-variable) * [Custom environment variables of type File](#custom-environment-variables-of-type-file) * [Mask a custom variable](#mask-a-custom-variable) * [Masked variable requirements](#masked-variable-requirements) * [Protect a custom variable](#protect-a-custom-variable) * [Custom variables validated by GitLab](#custom-variables-validated-by-gitlab) * [Syntax of environment variables in job scripts](#syntax-of-environment-variables-in-job-scripts) * [Bash](#bash) * [PowerShell](#powershell) * [Windows Batch](#windows-batch) * [List all environment variables](#list-all-environment-variables) * [`.gitlab-ci.yml` defined variables](#gitlab-ciyml-defined-variables) * [Group-level environment variables](#group-level-environment-variables) * [Instance-level CI/CD environment variables](#instance-level-cicd-environment-variables) * [Enable or disable UI interface for instance-level CI/CD variables](#enable-or-disable-ui-interface-for-instance-level-cicd-variables) * [Inherit environment variables](#inherit-environment-variables) * [Priority of environment variables](#priority-of-environment-variables) * [Unsupported variables](#unsupported-variables) * [Where variables can be used](#where-variables-can-be-used) * [Advanced use](#advanced-use) * [Limit the environment scopes of environment variables](#limit-the-environment-scopes-of-environment-variables) * [Deployment environment variables](#deployment-environment-variables) * [Auto DevOps environment variables](#auto-devops-environment-variables) * [Override a variable by manually running a pipeline](#override-a-variable-by-manually-running-a-pipeline) * [Environment variables expressions](#environment-variables-expressions) * [Syntax of environment variable expressions](#syntax-of-environment-variable-expressions) * [Storing regular expressions in variables](#storing-regular-expressions-in-variables) * [Debug logging](#debug-logging) * [Video walkthrough of a working example](#video-walkthrough-of-a-working-example) # GitLab CI/CD environment variables[](#gitlab-cicd-environment-variables "Permalink") 環境變量是一個動態命名的值,它可以影響正在運行的進程在操作系統上的行為方式. 環境變量是進程在其中運行的環境的一部分. 例如,正在運行的進程可以查詢`TEMP`環境變量的值以發現合適的位置來存儲臨時文件,或者為可以在不同腳本中重用的數據庫定義`URL` . 變量對于在 GitLab CI / CD 中自定義作業很有用. 使用變量時,不必對值進行硬編碼. > 有關高級使用 GitLab CI / CD 的更多信息: > > * 由 GitLab 工程師共享的這[7 種高級 GitLab CI 工作流程黑客,](https://about.gitlab.com/webcast/7cicd-hacks/)可以更快地提高生產力. > * 了解 Cloud Native Computing Foundation(CNCF)如何通過 GitLab CI / CD [消除](https://about.gitlab.com/customers/cncf/)許多云提供商之間管理項目[的復雜性](https://about.gitlab.com/customers/cncf/) . ## Predefined environment variables[](#predefined-environment-variables "Permalink") GitLab CI / CD 具有一組[默認的預定義變量](predefined_variables.html) ,您可以使用它們而無需任何其他說明. 您可以呼叫問題編號,用戶名,分支名稱,管道和提交 ID 等. GitLab 為 Runner 的本地環境提供了預定義的環境變量. GitLab 讀取`.gitlab-ci.yml`文件,并將信息發送到 Runner,在此處公開變量. 然后,運行程序運行腳本命令. ### Use predefined environment variables[](#use-predefined-environment-variables "Permalink") 您可以選擇現有的預定義變量之一,以由 Runner 輸出. 本示例說明如何使用預定義變量`CI_JOB_STAGE`輸出作業的階段. 在您的`.gitlab-ci.yml`文件中,從腳本中調用變量. 確保使用正確的[語法](#syntax-of-environment-variables-in-job-scripts) . ``` test_variable: stage: test script: - echo $CI_JOB_STAGE ``` 在這種情況下,跑步者輸出工作`test_variable`的`stage` ,即`test` : [![Output `$CI_JOB_STAGE`](https://img.kancloud.cn/04/42/044279c5260f8e17b42ee0a5f500c962_1010x531.png)](img/ci_job_stage_output_example.png) 再舉一個例子,假設您使用自己的 GitLab 實例,并且想知道 GitLab 頁面在哪個域下提供服務. 您可以通過在腳本中使用預定義變量`$CI_PAGES_DOMAIN`來調用它: ``` pages: script: - ... - echo $CI_PAGES_DOMAIN ``` 對于 GitLab.com 用戶,輸出將為`gitlab.io` . 對于您的私有實例,輸出將是您的系統管理員定義的任何內容. ## Custom environment variables[](#custom-environment-variables "Permalink") 當需要特定的自定義環境變量時,可以[在 UI](#create-a-custom-variable-in-the-ui)中[,API](../../api/project_level_variables.html)中或直接[在`.gitlab-ci.yml`文件中進行設置](#create-a-custom-variable-in-gitlab-ciyml) . 每當管道運行時,Runner 就會使用這些變量. 您還[可以手動覆蓋特定管道的變量值](../pipelines/index.html#specifying-variables-when-running-manual-jobs) . 變量有兩種類型: **Variable**和**File** . 您無法在`.gitlab-ci.yml`文件中設置類型,但可以在 UI 和 API 中進行設置. ### Create a custom variable in `.gitlab-ci.yml`[](#create-a-custom-variable-in-gitlab-ciyml "Permalink") 要創建自定義`env_var`在可變[`.gitlab-ci.yml`](../yaml/README.html#variables)文件中,定義下的變量/值對`variables` : ``` variables: TEST: "HELLO WORLD" ``` 然后,您可以在腳本中調用其值: ``` script: - echo "$TEST" ``` 有關更多詳細信息,請參見[`.gitlab-ci.yml`定義的變量](#gitlab-ciyml-defined-variables) . ### Create a custom variable in the UI[](#create-a-custom-variable-in-the-ui "Permalink") 在用戶界面中,您可以添加或更新自定義環境變量: 1. 轉到項目的**"設置">" CI / CD",**然后展開" **變量"**部分. 2. 單擊**添加變量**按鈕. 在" **添加變量**模式"中,填寫詳細信息: * **密鑰** :必須是一行,沒有空格,只能使用字母,數字或`_` . * **價值** :無限制. * **Type**: `File` or `Variable`. * **環境范圍** : `All`或特定環境. * **保護變量** (可選):如果選中,則該變量將僅在在受保護的分支或標簽上運行的管道中可用. * **屏蔽變量** (可選):如果選中,則變量的**值**將在作業日志中被屏蔽. 如果該值不滿足[屏蔽要求,](#masked-variable-requirements)則變量將無法保存. 創建變量后,您可以通過點擊 **編輯**按鈕. 設置變量后,請從`.gitlab-ci.yml`文件中調用它: ``` test_variable: stage: test script: - echo $CI_JOB_STAGE # calls a predefined variable - echo $TEST # calls a custom variable of type `env_var` - echo $GREETING # calls a custom variable of type `file` that contains the path to the temp file - cat $GREETING # the temp file itself contains the variable value ``` 輸出將是: [![Output custom variable](https://img.kancloud.cn/9a/ce/9acebfbdd3bdcfb9ab5fa6cef34de401_982x675.png)](img/custom_variables_output.png) ### Custom environment variables of type Variable[](#custom-environment-variables-of-type-variable "Permalink") 在 GitLab 11.11 中[引入](https://gitlab.com/gitlab-org/gitlab-foss/-/issues/46806) . 對于類型為**Variable 的變量** ,Runner 會創建一個環境變量,該環境變量將鍵用作名稱,并將值用作值. 有[一些](#custom-variables-validated-by-gitlab)這種類型的[預定義變量](#custom-variables-validated-by-gitlab) ,可以進一步驗證. 它們在您在 UI 中添加或更新變量時出現. ### Custom environment variables of type File[](#custom-environment-variables-of-type-file "Permalink") 在 GitLab 11.11 中[引入](https://gitlab.com/gitlab-org/gitlab-foss/-/issues/46806) . 對于**File**類型的變量,Runner 創建一個環境變量,該環境變量使用鍵作為名稱. 對于該值,Runner 將變量值寫入臨時文件并使用此路徑. 您可以使用諸如[AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-envvars.html)和[`kubectl`](https://kubernetes.io/docs/concepts/configuration/organize-cluster-access-kubeconfig/#the-kubeconfig-environment-variable)類[的](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-envvars.html)工具通過使用**File** type 變量來自定義配置. 過去,常見的模式是讀取 CI 變量的值,將其保存在文件中,然后在腳本中使用新創建的文件: ``` # Read certificate stored in $KUBE_CA_PEM variable and save it in a new file echo "$KUBE_CA_PEM" > "$(pwd)/kube.ca.pem" # Pass the newly created file to kubectl kubectl config set-cluster e2e --server="$KUBE_URL" --certificate-authority="$(pwd)/kube.ca.pem" ``` 代替此,您可以使用**文件**類型變量. 例如,如果您具有以下變量: * 類型為**Variable** : `KUBE_URL` **變量** ,其值為`https://example.com` . * 類型為**File** : `KUBE_CA_PEM`變量,其值為證書. 您可以從`.gitlab-ci.yml`調用它們,如下所示: ``` kubectl config set-cluster e2e --server="$KUBE_URL" --certificate-authority="$KUBE_CA_PEM" ``` ### Mask a custom variable[](#mask-a-custom-variable "Permalink") 在 GitLab 11.10 中[引入](https://gitlab.com/gitlab-org/gitlab-foss/-/issues/13784) 可以屏蔽變量,以便將變量的值隱藏在作業日志中. 要屏蔽變量: 1. 轉到**設置> CI / CD** . 2. 展開**變量**部分. 3. 在您要保護的變量旁邊,點擊**編輯** . 4. 選擇**掩碼變量**復選框. 5. Click **更新變量**. #### Masked variable requirements[](#masked-variable-requirements "Permalink") 變量的值必須: * 在一行中. * 至少要包含 8 個字符. * 不是預定義或自定義環境變量. * 僅由 Base64 字母(RFC4648)中的字符組成. [在 GitLab 12.2](https://gitlab.com/gitlab-org/gitlab-foss/-/issues/63043)和更高版本中, `@`和`:`也是有效值. 您不能屏蔽不滿足這些要求的變量. ### Protect a custom variable[](#protect-a-custom-variable "Permalink") 在 GitLab 9.3 中引入. 變量可以被保護. 受保護的變量將安全地傳遞到僅在[受保護的分支](../../user/project/protected_branches.html)或[受保護的標簽](../../user/project/protected_tags.html)上運行的管道. 其他管道不獲取受保護的變量. 要保護變量: 1. 轉到**設置> CI / CD** . 2. 展開**變量**部分. 3. 在您要保護的變量旁邊,點擊**編輯** . 4. 選擇**保護變量**復選框. 5. Click **更新變量**. 該變量可用于所有后續管道. 受保護的變量只能由擁有[維護者權限的](../../user/permissions.html#project-members-permissions)項目成員更新或查看. ### Custom variables validated by GitLab[](#custom-variables-validated-by-gitlab "Permalink") UI 中列出了一些變量,因此您可以更快地選擇它們. GitLab 會驗證這些變量的值,以確保它們的格式正確. | Variable | 允許值 | 引入 | | --- | --- | --- | | `AWS_ACCESS_KEY_ID` | 20 個字符:字母,數字 | 12.10 | | `AWS_DEFAULT_REGION` | Any | 12.10 | | `AWS_SECRET_ACCESS_KEY` | 40 個字符:字母,數字,特殊字符 | 12.10 | **注意:**存儲憑據時,會涉及安全性. 例如,如果您使用的是 AWS 密鑰,請遵循其[最佳做法](https://docs.aws.amazon.com/general/latest/gr/aws-access-keys-best-practices.html) . ## Syntax of environment variables in job scripts[](#syntax-of-environment-variables-in-job-scripts "Permalink") 所有變量都在構建環境中設置為環境變量,并且可以使用用于訪問此類變量的常規方法來訪問它們. 在大多數情況下, `bash`或`sh`用于執行作業腳本. 要訪問環境變量,請為 Runner's [shell](https://docs.gitlab.com/runner/executors/)使用語法. | Shell | Usage | | --- | --- | | bash/sh | `$variable` | | PowerShell | `$env:variable` (主`$env:variable` )或`$variable` | | Windows 批處理 | `%variable%` | ### Bash[](#bash "Permalink") 要在**bash 中**訪問環境變量,請在變量名前加上( `$` ): ``` job_name: script: - echo $CI_JOB_ID ``` ### PowerShell[](#powershell "Permalink") 要訪問**Windows PowerShell**環境中的環境變量,請在變量名前加上( `$env:` . 對于由 GitLab CI 設置的環境變量,包括由[`variables`](https://gitlab.com/gitlab-org/gitlab/blob/master/doc/ci/yaml/README.md#variables)參數設置的環境[`variables`](https://gitlab.com/gitlab-org/gitlab/blob/master/doc/ci/yaml/README.md#variables) ,還可以通過在[GitLab Runner 1.0.0 開始](https://gitlab.com/gitlab-org/gitlab-runner/-/commit/abc44bb158008cd3a49c0d8173717c38dadb29ae#47afd7e8f12afdb8f0246262488f24e6dd071a22) ,通過在變量名稱前加上( `$` )來訪問它們. 但是,必須使用( `$env:`訪問系統設置的環境變量. ``` job_name: script: - echo $env:CI_JOB_ID - echo $CI_JOB_ID - echo $env:PATH ``` 在[某些情況下,](https://gitlab.com/gitlab-org/gitlab-runner/-/issues/4115#note_157692820)環境變量可能需要用引號引起來才能正確擴展: ``` job_name: script: - D:\\qislsf\\apache-ant-1.10.5\\bin\\ant.bat "-DsosposDailyUsr=$env:SOSPOS_DAILY_USR" portal_test ``` ### Windows Batch[](#windows-batch "Permalink") 要訪問**Windows Batch 中的**環境變量,請用( `%` )包圍變量: ``` job_name: script: - echo %CI_JOB_ID% ``` ### List all environment variables[](#list-all-environment-variables "Permalink") 您還可以使用 Bash 中的`export`命令或 PowerShell 中的`dir env:`命令列出所有環境變量. 請注意,這還將在作業日志中公開您設置的所有變量的值: ``` job_name: script: - export # - 'dir env:' # use this for PowerShell ``` 值示例: ``` export CI_JOB_ID="50" export CI_COMMIT_SHA="1ecfd275763eff1d6b4844ea3168962458c9f27a" export CI_COMMIT_SHORT_SHA="1ecfd275" export CI_COMMIT_REF_NAME="master" export CI_REPOSITORY_URL="https://gitlab-ci-token:abcde-1234ABCD5678ef@example.com/gitlab-org/gitlab-foss.git" export CI_COMMIT_TAG="1.0.0" export CI_JOB_NAME="spec:other" export CI_JOB_STAGE="test" export CI_JOB_MANUAL="true" export CI_JOB_TRIGGERED="true" export CI_JOB_TOKEN="abcde-1234ABCD5678ef" export CI_PIPELINE_ID="1000" export CI_PIPELINE_IID="10" export CI_PAGES_DOMAIN="gitlab.io" export CI_PAGES_URL="https://gitlab-org.gitlab.io/gitlab-foss" export CI_PROJECT_ID="34" export CI_PROJECT_DIR="/builds/gitlab-org/gitlab-foss" export CI_PROJECT_NAME="gitlab-foss" export CI_PROJECT_TITLE="GitLab FOSS" export CI_PROJECT_NAMESPACE="gitlab-org" export CI_PROJECT_ROOT_NAMESPACE="gitlab-org" export CI_PROJECT_PATH="gitlab-org/gitlab-foss" export CI_PROJECT_URL="https://example.com/gitlab-org/gitlab-foss" export CI_REGISTRY="registry.example.com" export CI_REGISTRY_IMAGE="registry.example.com/gitlab-org/gitlab-foss" export CI_REGISTRY_USER="gitlab-ci-token" export CI_REGISTRY_PASSWORD="longalfanumstring" export CI_RUNNER_ID="10" export CI_RUNNER_DESCRIPTION="my runner" export CI_RUNNER_TAGS="docker, linux" export CI_SERVER="yes" export CI_SERVER_URL="https://example.com" export CI_SERVER_HOST="example.com" export CI_SERVER_PORT="443" export CI_SERVER_PROTOCOL="https" export CI_SERVER_NAME="GitLab" export CI_SERVER_REVISION="70606bf" export CI_SERVER_VERSION="8.9.0" export CI_SERVER_VERSION_MAJOR="8" export CI_SERVER_VERSION_MINOR="9" export CI_SERVER_VERSION_PATCH="0" export GITLAB_USER_EMAIL="user@example.com" export GITLAB_USER_ID="42" ``` ## `.gitlab-ci.yml` defined variables[](#gitlab-ciyml-defined-variables "Permalink") **注意:**此功能需要 GitLab Runner 0.5.0 或更高版本以及 GitLab 7.14 或更高版本. 您可以將在構建環境中設置的變量添加到`.gitlab-ci.yml` . 這些變量保存在存儲庫中,它們旨在存儲非敏感項目配置,例如`RAILS_ENV`或`DATABASE_URL` . 例如,如果將變量全局設置為下方(而不是在作業內部),它將在所有已執行的命令和腳本中使用: ``` variables: DATABASE_URL: "postgres://postgres@postgres/my_database" ``` 還將 YAML 定義的變量設置為所有創建的[服務容器](../docker/using_docker_images.html) ,以便您可以對其進行微調. 變量可以在全局級別定義,也可以在作業級別定義. 要在作業中關閉全局定義的變量,請定義一個空哈希: ``` job_name: variables: {} ``` 您可以在變量定義內使用其他變量(或使用`$$`對其進行轉義): ``` variables: LS_CMD: 'ls $FLAGS $$TMP_DIR' FLAGS: '-al' script: - 'eval $LS_CMD' # will execute 'ls -al $TMP_DIR' ``` ## Group-level environment variables[](#group-level-environment-variables "Permalink") Introduced in GitLab 9.4. 您可以定義在管道環境中設置的每個項目或每個組的變量. 組級變量存儲在存儲庫之外(不在`.gitlab-ci.yml` ),并安全地傳遞到 GitLab Runner,這使它們在管道運行期間可用. 對于**不**使用外部密鑰存儲或使用 GitLab [與 HashiCorp Vault 集成的](../examples/authenticating-with-hashicorp-vault/index.html)高級用戶,我們建議使用組環境變量來存儲密碼,SSH 密鑰和憑據之類的機密. 組級變量可以通過以下方式添加: 1. 導航到組的**"設置">" CI / CD"**頁面. 2. 在" **變量"**部分中輸入變量類型,鍵和值. [子組的](../../user/group/subgroups/index.html)任何變量將被遞歸繼承. 設置它們后,它們將可用于所有后續管道. 可以通過以下方式在項目中查看任何組級用戶定義的變量: 1. 導航到項目的**"設置">" CI / CD"**頁面. 2. 展開**變量**部分. [![CI/CD settings - inherited variables](https://img.kancloud.cn/63/ee/63eeabd249cae50defebb5e1d4ba2f5b_915x331.png)](img/inherited_group_variables_v12_5.png) ## Instance-level CI/CD environment variables[](#instance-level-cicd-environment-variables "Permalink") 在 GitLab 13.0 中[引入](https://gitlab.com/gitlab-org/gitlab/-/issues/14108) . 實例變量非常有用,因為不再需要為所有項目重復手動輸入相同的憑據. 實例級變量可用于實例上的所有項目和組. **注意:**實例級變量的最大數量[計劃為 25](https://gitlab.com/gitlab-org/gitlab/-/issues/216097) . 您可以通過 UI 或[API](../../api/instance_level_ci_variables.html)定義實例級變量. 要添加實例級變量: 1. 導航到管理區域的**"設置">" CI / CD",**然后展開" **變量"**部分. 2. 單擊**添加變量**按鈕,然后填寫詳細信息: * **密鑰** :必須為一行,只能使用字母,數字或`_` (下劃線),且不能有空格. * **值** :允許 700 個字符. * **Type**: `File` or `Variable`. * **保護變量** (可選):如果選中,則該變量將僅在在受保護的分支或標簽上運行的管道中可用. * **屏蔽變量** (可選):如果選中,則變量的**值**將不會顯示在作業日志中. 如果該值不滿足[屏蔽要求,](#masked-variable-requirements)則不會保存該變量. 創建變量后,您可以通過點擊 **編輯**按鈕. ### Enable or disable UI interface for instance-level CI/CD variables[](#enable-or-disable-ui-interface-for-instance-level-cicd-variables "Permalink") 實例級 CI / CD 變量的 UI 界面正在開發中,但可用于生產環境. 它部署在**默認情況下啟用**的功能標志的后面. [有權訪問 GitLab Rails 控制臺的 GitLab 管理員](../../administration/feature_flags.html)可以選擇為您的實例禁用它. 禁用它: ``` Feature.disable(:instance_variables_ui) ``` 要啟用它: ``` Feature.enable(:instance_variables_ui) ``` ## Inherit environment variables[](#inherit-environment-variables "Permalink") 版本歷史 * [介紹](https://gitlab.com/gitlab-org/gitlab/-/issues/22638)在 GitLab 13.0 后面的禁用[功能標志](../../administration/feature_flags.html) : `ci_dependency_variables` . * 在 GitLab 13.1 中[已刪除功能標記](https://gitlab.com/gitlab-org/gitlab/-/issues/217834) . 您可以從相關作業中繼承環境變量. 該功能利用了[`artifacts:reports:dotenv`](../pipelines/job_artifacts.html#artifactsreportsdotenv)報告功能. 帶有[`dependencies`](../yaml/README.html#dependencies)關鍵字的示例. ``` build: stage: build script: - echo "BUILD_VERSION=hello" >> build.env artifacts: reports: dotenv: build.env deploy: stage: deploy script: - echo $BUILD_VERSION # => hello dependencies: - build ``` 帶[`needs`](../yaml/README.html#artifact-downloads-with-needs)關鍵字的示例: ``` build: stage: build script: - echo "BUILD_VERSION=hello" >> build.env artifacts: reports: dotenv: build.env deploy: stage: deploy script: - echo $BUILD_VERSION # => hello needs: - job: build artifacts: true ``` ## Priority of environment variables[](#priority-of-environment-variables "Permalink") 不同類型的變量可以優先于其他變量,具體取決于它們的定義位置. 變量的優先順序為(從最高到最低): 1. [觸發器變量](../triggers/README.html#making-use-of-trigger-variables) , [計劃的管道變量](../pipelines/schedules.html#using-variables)和[手動管道運行變量](#override-a-variable-by-manually-running-a-pipeline) . 2. Project-level [variables](#custom-environment-variables) or [protected variables](#protect-a-custom-variable). 3. Group-level [variables](#group-level-environment-variables) or [protected variables](#protect-a-custom-variable). 4. [Inherited environment variables](#inherit-environment-variables). 5. YAML-defined [job-level variables](../yaml/README.html#variables). 6. YAML-defined [global variables](../yaml/README.html#variables). 7. [Deployment variables](#deployment-environment-variables). 8. [Predefined environment variables](predefined_variables.html). 例如,如果您定義: * `API_TOKEN=secure`作為項目變量. * 您的`.gitlab-ci.yml` `API_TOKEN=yaml` . `API_TOKEN`將采用`secure`值,因為項目變量優先于`.gitlab-ci.yml`定義`.gitlab-ci.yml` . ## Unsupported variables[](#unsupported-variables "Permalink") Variable names are limited by the underlying shell used to execute scripts (see [available shells](https://docs.gitlab.com/runner/shells/index.html). Each shell has its own unique set of reserved variable names. You will also want to keep in mind the [scope of environment variables](where_variables_can_be_used.html) to ensure a variable is defined in the scope in which you wish to use it. ## Where variables can be used[](#where-variables-can-be-used "Permalink") 單擊[此處](where_variables_can_be_used.html)以獲得描述在何處以及如何使用不同類型的變量的部分. ## Advanced use[](#advanced-use "Permalink") ### Limit the environment scopes of environment variables[](#limit-the-environment-scopes-of-environment-variables "Permalink") 您可以通過[定義](../environments/index.html)變量可用于的環境來限制變量的環境范圍. 要了解有關范圍界定環境的更多信息,請參閱[使用規范范圍界定環境](../environments/index.html#scoping-environments-with-specs) . ### Deployment environment variables[](#deployment-environment-variables "Permalink") 在 GitLab 8.15 中引入. 負責部署配置的[集成](../../user/project/integrations/overview.html)可以定義在構建環境中設置的自己的變量. 這些變量僅為[部署作業](../environments/index.html)定義. 請查閱所用集成的文檔,以了解它們定義了哪些變量. 定義部署變量的示例集成是[Kubernetes 集成](../../user/project/clusters/index.html#deployment-variables) . ### Auto DevOps environment variables[](#auto-devops-environment-variables "Permalink") 在 GitLab 11.7 中[引入](https://gitlab.com/gitlab-org/gitlab-foss/-/issues/49056) . 您可以配置[Auto DevOps,](../../topics/autodevops/index.html)以將 CI 變量傳遞給正在運行的應用程序,方法是在變量的鍵之前添加`K8S_SECRET_` . 然后,這些[前綴變量](../../topics/autodevops/customize.html#application-secret-variables)將在運行的應用程序容器上用作環境變量. **警告:**由于當前 Auto DevOps 腳本環境的限制,當前不支持具有多行值的變量. ### Override a variable by manually running a pipeline[](#override-a-variable-by-manually-running-a-pipeline "Permalink") 在 GitLab 10.8 中[引入](https://gitlab.com/gitlab-org/gitlab-foss/-/issues/44059) . 您可以通過[手動運行管道](../pipelines/index.html#run-a-pipeline-manually)來覆蓋當前變量的值. 例如,假設您添加了一個名為`$TEST`的自定義變量,并且想在手動管道中覆蓋它. 導航到項目的**CI / CD>管道** ,然后單擊**運行管道** . 選擇要為其運行管道的分支,然后在 UI 中添加變量及其值: [![Override variable value](https://img.kancloud.cn/35/20/35204667767f23a7eafafaa746222e79_1014x330.png)](img/override_variable_manual_pipeline.png) 運行器將覆蓋先前設置的值,并將自定義值用于此特定管道. [![Manually overridden variable output](https://img.kancloud.cn/28/12/28121a9f09b8681817aed9edcdca65d0_1676x926.png)](img/override_value_via_manual_pipeline_output.png) ## Environment variables expressions[](#environment-variables-expressions "Permalink") 版本歷史 * 在 GitLab 10.7 中[引入](https://gitlab.com/gitlab-org/gitlab-foss/-/issues/37397) [了`only`和`except` CI 關鍵字](../yaml/README.html#onlyexcept-advanced) * 在 GitLab 12.3 中使用[`rules`關鍵字](../yaml/README.html#rules) [擴展](https://gitlab.com/gitlab-org/gitlab/-/issues/27863) 使用變量表達式來限制將更改推送到 GitLab 之后在管道中創建的作業. 在`.gitlab-ci.yml` ,變量表達式可同時用于以下兩種情況: * [`rules`](../yaml/README.html#rules) ,這是推薦的方法,以及 * [`only`和`except`](../yaml/README.html#onlyexcept-basic) ,它們是不推薦使用的候選對象. 與變量和觸發的管道變量結合使用時,這特別有用. ``` deploy: script: cap staging deploy environment: staging only: variables: - $RELEASE == "staging" - $STAGING ``` 在創建管道之前,將對提供的每個表達式進行求值. 如果`only`使用時`variables`任何條件評估為 true,則會創建一個新作業. 如果在使用`except`任何表達式的結果為 true,則不會創建作業. 這遵循[`only` / `except`策略](../yaml/README.html#onlyexcept-advanced)的常規規則. ### Syntax of environment variable expressions[](#syntax-of-environment-variable-expressions "Permalink") 您可以在下面找到受支持的語法參考: 1. 使用字符串進行相等匹配 Examples: * `$VARIABLE == "some value"` * `$VARIABLE != "some value"` (在 GitLab 11.11 中引入) 您可以使用等于運算符`==`或`!=`將變量內容與字符串進行比較. 我們支持雙引號和單引號來定義字符串值,因此同時支持`$VARIABLE == "some value"`和`$VARIABLE == 'some value'` . `"some value" == $VARIABLE`也正確. 2. 檢查未定義的值 Examples: * `$VARIABLE == null` * `$VARIABLE != null` (在 GitLab 11.11 中引入) 有時,您可能想檢查是否定義了變量. 為此,您可以將變量與`null`關鍵字進行比較,例如`$VARIABLE == null` . 如果在使用`==`時未定義變量,則該表達式的值為 true;如果使用`!=`則該表達式的值為 false. 3. 檢查空變量 Examples: * `$VARIABLE == ""` * `$VARIABLE != ""` (introduced in GitLab 11.11) 如果要檢查變量是否已定義但為空,則可以將其與空字符串(例如`$VAR == ''`或非空字符串`$VARIABLE != ""` . 4. 比較兩個變量 Examples: * `$VARIABLE_1 == $VARIABLE_2` * `$VARIABLE_1 != $VARIABLE_2` (在 GitLab 11.11 中引入) 可以比較兩個變量. 這將比較這些變量的值. 5. 可變狀態檢查 Example: `$STAGING` 如果只想在存在某個變量時創建作業,這意味著它是已定義且非空的,則可以簡單地使用變量名作為表達式,例如`$STAGING` . 如果`$STAGING`變量已定義且不為空,則表達式將求值為真. `$STAGING`值必須是長度大于零的字符串. 僅包含空格字符的變量不是空變量. 6. 模式匹配(在 GitLab 11.0 中引入) Examples: * `=~` :如果模式匹配則為真. 例如: `$VARIABLE =~ /^content.*/` * `!~` :如果模式不匹配,則為 true. 例如: `$VARIABLE_1 !~ /^content.*/` (在 GitLab 11.11 中[引入](https://gitlab.com/gitlab-org/gitlab-foss/-/issues/61900) ) 與正則表達式匹配的變量模式使用[RE2 正則表達式語法](https://github.com/google/re2/wiki/Syntax) . 如果滿足以下條件,則表達式的計算結果為`true` : * 使用`=~`時找到匹配項. * 當使用火柴都*沒有*發現`!~` 模式匹配默認情況下區分大小寫. 使用`i`標志修飾符,例如`/pattern/i` ,使模式不區分大小寫. 7. Conjunction / Disjunction ([introduced](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/27925) in GitLab 12.0) Examples: * `$VARIABLE1 =~ /^content.*/ && $VARIABLE2 == "something"` * `$VARIABLE1 =~ /^content.*/ && $VARIABLE2 =~ /thing$/ && $VARIABLE3` * `$VARIABLE1 =~ /^content.*/ || $VARIABLE2 =~ /thing$/ && $VARIABLE3` 可以使用`&&`或`||`加入多個條件 . 任何在其他情況下受支持的語法都可以在合并或不合并語句中使用. 運算符的優先級遵循[Ruby 2.5 標準](https://ruby-doc.org/core-2.5.0/doc/syntax/precedence_rdoc.html) ,因此`&&`在`||`之前進行評估 . ### Storing regular expressions in variables[](#storing-regular-expressions-in-variables "Permalink") 可以將正則表達式存儲在變量中,以用于模式匹配: ``` variables: STAGINGRELS: '/staging0|staging1/' deploy_staging: script: do.sh deploy staging environment: staging rules: - if: '$RELEASE =~ $STAGINGRELS' ``` **注意:**可用的正則表達式語法受到限制. 有關更多詳細信息,請參見[相關問題](https://gitlab.com/gitlab-org/gitlab/-/issues/35438) . 如果需要,您可以使用測試管道來確定正則表達式是否可以在變量中工作. 下面的示例直接從變量內部測試`^mast.*`正則表達式: ``` variables: MYSTRING: 'master' MYREGEX: '/^mast.*/' testdirect: script: /bin/true rules: - if: '$MYSTRING =~ /^mast.*/' testvariable: script: /bin/true rules: - if: '$MYSTRING =~ $MYREGEX' ``` ## Debug logging[](#debug-logging "Permalink") 在 GitLab Runner 1.7 中引入. **警告:**啟用調試跟蹤可能會嚴重影響安全性. 輸出**將**包含所有變量和其他任何秘密的內容! 輸出**將**上傳到 GitLab 服務器,并在作業日志中顯示! 默認情況下,GitLab Runner 隱藏處理作業時所執行操作的大多數細節. 此行為使作業日志簡短,并防止機密信息泄露到日志中,除非您的腳本將其寫入屏幕. 如果一項工作沒有按預期進行,則可能使問題難以調查. 在這種情況下,您可以在`.gitlab-ci.yml`啟用調試跟蹤. 在 GitLab Runner v1.7 +上可用,此功能啟用外殼程序的執行日志,從而產生詳細的作業日志,其中列出了所有已運行的命令,已設置的變量等. 在啟用此功能之前,您應確保作業[僅對團隊成員](../../user/permissions.html#project-features)可見. 您還應該[清除](../pipelines/index.html#view-jobs-in-a-pipeline)所有生成的作業日志,然后才能再次顯示它們. 要啟用調試日志(跟蹤),請將`CI_DEBUG_TRACE`變量設置為`true` : ``` job_name: variables: CI_DEBUG_TRACE: "true" ``` 將`CI_DEBUG_TRACE`設置為`true`示例截斷輸出: ``` ... export CI_SERVER_TLS_CA_FILE="/builds/gitlab-examples/ci-debug-trace.tmp/CI_SERVER_TLS_CA_FILE" if [[ -d "/builds/gitlab-examples/ci-debug-trace/.git" ]]; then echo $'\''\x1b[32;1mFetching changes...\x1b[0;m'\'' $'\''cd'\'' "/builds/gitlab-examples/ci-debug-trace" $'\''git'\'' "config" "fetch.recurseSubmodules" "false" $'\''rm'\'' "-f" ".git/index.lock" $'\''git'\'' "clean" "-ffdx" $'\''git'\'' "reset" "--hard" $'\''git'\'' "remote" "set-url" "origin" "https://gitlab-ci-token:xxxxxxxxxxxxxxxxxxxx@example.com/gitlab-examples/ci-debug-trace.git" $'\''git'\'' "fetch" "origin" "--prune" "+refs/heads/*:refs/remotes/origin/*" "+refs/tags/*:refs/tags/lds" ++ CI_BUILDS_DIR=/builds ++ export CI_PROJECT_DIR=/builds/gitlab-examples/ci-debug-trace ++ CI_PROJECT_DIR=/builds/gitlab-examples/ci-debug-trace ++ export CI_CONCURRENT_ID=87 ++ CI_CONCURRENT_ID=87 ++ export CI_CONCURRENT_PROJECT_ID=0 ++ CI_CONCURRENT_PROJECT_ID=0 ++ export CI_SERVER=yes ++ CI_SERVER=yes ++ mkdir -p /builds/gitlab-examples/ci-debug-trace.tmp ++ echo -n '-----BEGIN CERTIFICATE----- -----END CERTIFICATE-----' ++ export CI_SERVER_TLS_CA_FILE=/builds/gitlab-examples/ci-debug-trace.tmp/CI_SERVER_TLS_CA_FILE ++ CI_SERVER_TLS_CA_FILE=/builds/gitlab-examples/ci-debug-trace.tmp/CI_SERVER_TLS_CA_FILE ++ export CI_PIPELINE_ID=52666 ++ CI_PIPELINE_ID=52666 ++ export CI_PIPELINE_URL=https://gitlab.com/gitlab-examples/ci-debug-trace/pipelines/52666 ++ CI_PIPELINE_URL=https://gitlab.com/gitlab-examples/ci-debug-trace/pipelines/52666 ++ export CI_JOB_ID=7046507 ++ CI_JOB_ID=7046507 ++ export CI_JOB_URL=https://gitlab.com/gitlab-examples/ci-debug-trace/-/jobs/379424655 ++ CI_JOB_URL=https://gitlab.com/gitlab-examples/ci-debug-trace/-/jobs/379424655 ++ export CI_JOB_TOKEN=[MASKED] ++ CI_JOB_TOKEN=[MASKED] ++ export CI_BUILD_ID=379424655 ++ CI_BUILD_ID=379424655 ++ export CI_BUILD_TOKEN=[MASKED] ++ CI_BUILD_TOKEN=[MASKED] ++ export CI_REGISTRY_USER=gitlab-ci-token ++ CI_REGISTRY_USER=gitlab-ci-token ++ export CI_REGISTRY_PASSWORD=[MASKED] ++ CI_REGISTRY_PASSWORD=[MASKED] ++ export CI_REPOSITORY_URL=https://gitlab-ci-token:[MASKED]@gitlab.com/gitlab-examples/ci-debug-trace.git ++ CI_REPOSITORY_URL=https://gitlab-ci-token:[MASKED]@gitlab.com/gitlab-examples/ci-debug-trace.git ++ export CI_JOB_NAME=debug_trace ++ CI_JOB_NAME=debug_trace ++ export CI_JOB_STAGE=test ++ CI_JOB_STAGE=test ++ export CI_NODE_TOTAL=1 ++ CI_NODE_TOTAL=1 ++ export CI_BUILD_NAME=debug_trace ++ CI_BUILD_NAME=debug_trace ++ export CI_BUILD_STAGE=test ++ CI_BUILD_STAGE=test ++ export CI=true ++ CI=true ++ export GITLAB_CI=true ++ GITLAB_CI=true ++ export CI_SERVER_URL=https://gitlab.com:3000 ++ CI_SERVER_URL=https://gitlab.com:3000 ++ export CI_SERVER_HOST=gitlab.com ++ CI_SERVER_HOST=gitlab.com ++ export CI_SERVER_PORT=3000 ++ CI_SERVER_PORT=3000 ++ export CI_SERVER_PROTOCOL=https ++ CI_SERVER_PROTOCOL=https ++ export CI_SERVER_NAME=GitLab ++ CI_SERVER_NAME=GitLab ++ export CI_SERVER_VERSION=12.6.0-pre ++ CI_SERVER_VERSION=12.6.0-pre ++ export CI_SERVER_VERSION_MAJOR=12 ++ CI_SERVER_VERSION_MAJOR=12 ++ export CI_SERVER_VERSION_MINOR=6 ++ CI_SERVER_VERSION_MINOR=6 ++ export CI_SERVER_VERSION_PATCH=0 ++ CI_SERVER_VERSION_PATCH=0 ++ export CI_SERVER_REVISION=f4cc00ae823 ++ CI_SERVER_REVISION=f4cc00ae823 ++ export GITLAB_FEATURES=audit_events,burndown_charts,code_owners,contribution_analytics,description_diffs,elastic_search,group_bulk_edit,group_burndown_charts,group_webhooks,issuable_default_templates,issue_weights,jenkins_integration,ldap_group_sync,member_lock,merge_request_approvers,multiple_issue_assignees,multiple_ldap_servers,multiple_merge_request_assignees,protected_refs_for_users,push_rules,related_issues,repository_mirrors,repository_size_limit,scoped_issue_board,usage_quotas,visual_review_app,wip_limits,adjourned_deletion_for_projects_and_groups,admin_audit_log,auditor_user,batch_comments,blocking_merge_requests,board_assignee_lists,board_milestone_lists,ci_cd_projects,cluster_deployments,code_analytics,code_owner_approval_required,commit_committer_check,cross_project_pipelines,custom_file_templates,custom_file_templates_for_namespace,custom_project_templates,custom_prometheus_metrics,cycle_analytics_for_groups,db_load_balancing,default_project_deletion_protection,dependency_proxy,deploy_board,design_management,email_additional_text,extended_audit_events,external_authorization_service_api_management,feature_flags,file_locks,geo,github_project_service_integration,group_allowed_email_domains,group_project_templates,group_saml,issues_analytics,jira_dev_panel_integration,ldap_group_sync_filter,merge_pipelines,merge_request_performance_metrics,merge_trains,metrics_reports,multiple_approval_rules,multiple_group_issue_boards,object_storage,operations_dashboard,packages,productivity_analytics,project_aliases,protected_environments,reject_unsigned_commits,required_ci_templates,scoped_labels,service_desk,smartcard_auth,group_timelogs,type_of_work_analytics,unprotection_restrictions,ci_project_subscriptions,container_scanning,dast,dependency_scanning,epics,group_ip_restriction,incident_management,insights,license_management,personal_access_token_expiration_policy,pod_logs,prometheus_alerts,pseudonymizer,report_approver_rules,sast,security_dashboard,tracing,web_ide_terminal ++ GITLAB_FEATURES=audit_events,burndown_charts,code_owners,contribution_analytics,description_diffs,elastic_search,group_bulk_edit,group_burndown_charts,group_webhooks,issuable_default_templates,issue_weights,jenkins_integration,ldap_group_sync,member_lock,merge_request_approvers,multiple_issue_assignees,multiple_ldap_servers,multiple_merge_request_assignees,protected_refs_for_users,push_rules,related_issues,repository_mirrors,repository_size_limit,scoped_issue_board,usage_quotas,visual_review_app,wip_limits,adjourned_deletion_for_projects_and_groups,admin_audit_log,auditor_user,batch_comments,blocking_merge_requests,board_assignee_lists,board_milestone_lists,ci_cd_projects,cluster_deployments,code_analytics,code_owner_approval_required,commit_committer_check,cross_project_pipelines,custom_file_templates,custom_file_templates_for_namespace,custom_project_templates,custom_prometheus_metrics,cycle_analytics_for_groups,db_load_balancing,default_project_deletion_protection,dependency_proxy,deploy_board,design_management,email_additional_text,extended_audit_events,external_authorization_service_api_management,feature_flags,file_locks,geo,github_project_service_integration,group_allowed_email_domains,group_project_templates,group_saml,issues_analytics,jira_dev_panel_integration,ldap_group_sync_filter,merge_pipelines,merge_request_performance_metrics,merge_trains,metrics_reports,multiple_approval_rules,multiple_group_issue_boards,object_storage,operations_dashboard,packages,productivity_analytics,project_aliases,protected_environments,reject_unsigned_commits,required_ci_templates,scoped_labels,service_desk,smartcard_auth,group_timelogs,type_of_work_analytics,unprotection_restrictions,ci_project_subscriptions,cluster_health,container_scanning,dast,dependency_scanning,epics,group_ip_restriction,incident_management,insights,license_management,personal_access_token_expiration_policy,pod_logs,prometheus_alerts,pseudonymizer,report_approver_rules,sast,security_dashboard,tracing,web_ide_terminal ++ export CI_PROJECT_ID=17893 ++ CI_PROJECT_ID=17893 ++ export CI_PROJECT_NAME=ci-debug-trace ++ CI_PROJECT_NAME=ci-debug-trace ++ export CI_PROJECT_TITLE='GitLab FOSS' ++ CI_PROJECT_TITLE='GitLab FOSS' ++ export CI_PROJECT_PATH=gitlab-examples/ci-debug-trace ++ CI_PROJECT_PATH=gitlab-examples/ci-debug-trace ++ export CI_PROJECT_PATH_SLUG=gitlab-examples-ci-debug-trace ++ CI_PROJECT_PATH_SLUG=gitlab-examples-ci-debug-trace ++ export CI_PROJECT_NAMESPACE=gitlab-examples ++ CI_PROJECT_NAMESPACE=gitlab-examples ++ export CI_PROJECT_ROOT_NAMESPACE=gitlab-examples ++ CI_PROJECT_ROOT_NAMESPACE=gitlab-examples ++ export CI_PROJECT_URL=https://gitlab.com/gitlab-examples/ci-debug-trace ++ CI_PROJECT_URL=https://gitlab.com/gitlab-examples/ci-debug-trace ++ export CI_PROJECT_VISIBILITY=public ++ CI_PROJECT_VISIBILITY=public ++ export CI_PROJECT_REPOSITORY_LANGUAGES= ++ CI_PROJECT_REPOSITORY_LANGUAGES= ++ export CI_DEFAULT_BRANCH=master ++ CI_DEFAULT_BRANCH=master ++ export CI_REGISTRY=registry.gitlab.com ++ CI_REGISTRY=registry.gitlab.com ++ export CI_API_V4_URL=https://gitlab.com/api/v4 ++ CI_API_V4_URL=https://gitlab.com/api/v4 ++ export CI_PIPELINE_IID=123 ++ CI_PIPELINE_IID=123 ++ export CI_PIPELINE_SOURCE=web ++ CI_PIPELINE_SOURCE=web ++ export CI_CONFIG_PATH=.gitlab-ci.yml ++ CI_CONFIG_PATH=.gitlab-ci.yml ++ export CI_COMMIT_SHA=dd648b2e48ce6518303b0bb580b2ee32fadaf045 ++ CI_COMMIT_SHA=dd648b2e48ce6518303b0bb580b2ee32fadaf045 ++ export CI_COMMIT_SHORT_SHA=dd648b2e ++ CI_COMMIT_SHORT_SHA=dd648b2e ++ export CI_COMMIT_BEFORE_SHA=0000000000000000000000000000000000000000 ++ CI_COMMIT_BEFORE_SHA=0000000000000000000000000000000000000000 ++ export CI_COMMIT_REF_NAME=master ++ CI_COMMIT_REF_NAME=master ++ export CI_COMMIT_REF_SLUG=master ++ CI_COMMIT_REF_SLUG=master ++ export CI_COMMIT_MESSAGE=s/CI/Runner ++ CI_COMMIT_MESSAGE=s/CI/Runner ++ export CI_COMMIT_TITLE=s/CI/Runner ++ CI_COMMIT_TITLE=s/CI/Runner ++ export CI_COMMIT_DESCRIPTION= ++ CI_COMMIT_DESCRIPTION= ++ export CI_COMMIT_REF_PROTECTED=true ++ CI_COMMIT_REF_PROTECTED=true ++ export CI_BUILD_REF=dd648b2e48ce6518303b0bb580b2ee32fadaf045 ++ CI_BUILD_REF=dd648b2e48ce6518303b0bb580b2ee32fadaf045 ++ export CI_BUILD_BEFORE_SHA=0000000000000000000000000000000000000000 ++ CI_BUILD_BEFORE_SHA=0000000000000000000000000000000000000000 ++ export CI_BUILD_REF_NAME=master ++ CI_BUILD_REF_NAME=master ++ export CI_BUILD_REF_SLUG=master ++ CI_BUILD_REF_SLUG=master ++ export CI_RUNNER_ID=1337 ++ CI_RUNNER_ID=1337 ++ export CI_RUNNER_DESCRIPTION=shared-runners-manager-4.gitlab.com ++ CI_RUNNER_DESCRIPTION=shared-runners-manager-4.gitlab.com ++ export 'CI_RUNNER_TAGS=gce, east-c, shared, docker, linux, ruby, mysql, postgres, mongo, git-annex' ++ CI_RUNNER_TAGS='gce, east-c, shared, docker, linux, ruby, mysql, postgres, mongo, git-annex' ++ export CI_DEBUG_TRACE=true ++ CI_DEBUG_TRACE=true ++ export GITLAB_USER_ID=42 ++ GITLAB_USER_ID=42 ++ export GITLAB_USER_EMAIL=user@example.com ++ GITLAB_USER_EMAIL=user@example.com ++ export GITLAB_USER_LOGIN=root ++ GITLAB_USER_LOGIN=root ++ export 'GITLAB_USER_NAME=User' ++ GITLAB_USER_NAME='User' ++ export CI_DISPOSABLE_ENVIRONMENT=true ++ CI_DISPOSABLE_ENVIRONMENT=true ++ export CI_RUNNER_VERSION=12.5.0 ++ CI_RUNNER_VERSION=12.5.0 ++ export CI_RUNNER_REVISION=577f813d ++ CI_RUNNER_REVISION=577f813d ++ export CI_RUNNER_EXECUTABLE_ARCH=linux/amd64 ++ CI_RUNNER_EXECUTABLE_ARCH=linux/amd64 ++ export VERY_SECURE_VARIABLE=imaverysecurevariable ++ VERY_SECURE_VARIABLE=imaverysecurevariable ... ``` ## Video walkthrough of a working example[](#video-walkthrough-of-a-working-example "Permalink") [使用 GitLab 管理復雜配置數據管理怪獸](https://www.youtube.com/watch?v=v4ZOJ96hAck)視頻是[復雜配置數據 Monorepo](https://gitlab.com/guided-explorations/config-data-top-scope/config-data-subscope/config-data-monorepo)工作示例項目的演練. 它解釋了如何將多個級別的組 CI / CD 變量與環境范圍的項目變量組合在一起,以實現應用程序構建或部署的復雜配置. 可以將示例復制到您自己的組或實例中進行測試. 項目頁面上提供了有關演示其他 GitLab CI 模式的更多詳細信息.
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看