<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之旅 廣告
                # Review Apps > 原文:[https://docs.gitlab.com/ee/ci/review_apps/](https://docs.gitlab.com/ee/ci/review_apps/) * [Introduction](#introduction) * [How Review Apps work](#how-review-apps-work) * [Configuring Review Apps](#configuring-review-apps) * [Enable Review Apps button](#enable-review-apps-button) * [Review Apps auto-stop](#review-apps-auto-stop) * [Review Apps examples](#review-apps-examples) * [Route Maps](#route-maps) * [Route Maps example](#route-maps-example) * [Visual Reviews](#visual-reviews-starter) * [Configuring Visual Reviews](#configuring-visual-reviews) * [Determining merge request ID](#determining-merge-request-id) * [Visual Reviews in private or internal projects](#visual-reviews-in-private-or-internal-projects) * [Using Visual Reviews](#using-visual-reviews) * [Limitations](#limitations) # Review Apps[](#review-apps "Permalink") 版本歷史 * 在 GitLab 8.12 中[引入](https://gitlab.com/gitlab-org/gitlab-foss/-/issues/21971) . 在 GitLab 8.13 和 8.14 中進行了進一步添加. * 受到[Heroku 的 Review Apps 的](https://devcenter.heroku.com/articles/github-integration-review-apps)啟發,該[應用程序](https://devcenter.heroku.com/articles/github-integration-review-apps)本身也受到[Fourchette 的](https://github.com/rainforestapp/fourchette)啟發. Review Apps 是一種協作工具,可消除提供展示產品更改環境的艱苦工作. ## Introduction[](#introduction "Permalink") 查看應用程序: * 通過為合并請求擴展動態環境,提供功能分支中所做更改的自動實時預覽. * 允許設計人員和產品經理查看您的更改,而無需檢出分支機構并在沙盒環境中運行您的更改. * 與[GitLab DevOps LifeCycle](../../README.html#the-entire-devops-lifecycle)完全集成. * 允許您將更改部署到任何地方. [![Review Apps Workflow](https://img.kancloud.cn/12/4f/124fb7c5c218f7c8222a8f669dc67183.png)](img/continuous-delivery-review-apps.svg) 在上面的示例中: * 每次將提交推送到`topic branch`時,都會構建一個 Review App. * 審閱者在通過第三次審閱之前未通過兩次審閱. * 審核通過后, `topic branch`將合并到`master` `topic branch`中,并在該`topic branch`中進行部署. * 在階段中獲得批準后,已合并到`master`中的更改將部署到生產中. ## How Review Apps work[](#how-review-apps-work "Permalink") Review App 是分支與[環境](../environments/index.html)的映射. 通過與分支相關的[合并請求](../../user/project/merge_requests.html)上的鏈接,可以訪問 Review App. 以下是動態設置環境的合并請求的示例. [![Review App in merge request](https://img.kancloud.cn/b9/82/b9826487d62d05514abbf49f478cd76a_1832x460.png)](img/review_apps_preview_in_mr.png) 在此示例中,分支為: * 成功建立. * 通過單擊" **查看應用程序"**按鈕可以到達的動態環境中進行部署. 將 Review Apps 添加到您的工作流后,您將遵循分支的 Git 流. 那是: 1. 推送一個分支,讓 Runner 根據動態環境作業的`script`定義部署 Review App. 2. 等待 Runner 構建和部署您的 Web 應用程序. 3. 單擊合并請求中與分支相關的鏈接,以實時查看更改. ## Configuring Review Apps[](#configuring-review-apps "Permalink") Review Apps 建立在[動態環境上](../environments/index.html#configuring-dynamic-environments) ,可讓您為每個分支動態創建一個新環境. 配置 Review Apps 的過程如下: 1. 設置基礎結構以托管和部署 Review Apps(請查看下面的[示例](#review-apps-examples) ). 2. [安裝](https://docs.gitlab.com/runner/install/)并[配置](https://docs.gitlab.com/runner/commands/) Runner 以進行部署. 3. 在`.gitlab-ci.yml`中設置一個作業,該作業使用[預定義的 CI 環境變量](../variables/README.html) `${CI_COMMIT_REF_NAME}`創建動態環境并將其限制為僅在分支上運行. 或者,您可以通過為項目[啟用審閱應用程序](#enable-review-apps-button)來獲得此工作的 YML 模板. 4. (可選)設置一個作業,以[手動停止](../environments/index.html#stopping-an-environment) Review Apps. ### Enable Review Apps button[](#enable-review-apps-button "Permalink") 在 GitLab 12.8 中[引入](https://gitlab.com/gitlab-org/gitlab/-/issues/118844) . 為項目配置 Review Apps 時,如上所述,您需要向`.gitlab-ci.yml`添加新作業. 為此,如果您正在使用 Kubernetes,則可以單擊**Enable Review Apps**按鈕,GitLab 會提示您一個模板代碼塊,您可以將該模板代碼塊復制并粘貼到`.gitlab-ci.yml`作為起點. 為此: 1. 轉到要為其創建 Review App 作業的項目. 2. 從左側導航欄中,轉到**運營** > **環境** . 3. 單擊**啟用審閱應用程序**按鈕. 如果您對該項目具有開發人員或更高[權限,則](../../user/permissions.html)可以使用它. 4. 復制提供的代碼段并將其粘貼到您的`.gitlab-ci.yml`文件中: [![Enable Review Apps modal](https://img.kancloud.cn/81/08/810821b414ae9a55330247d3780e8b03_1000x509.png)](img/enable_review_app_v12_8.png) 5. 可以根據自己的需要隨意調整此模板. ## Review Apps auto-stop[](#review-apps-auto-stop "Permalink") 了解如何在給定的時間段后將[Review Apps 環境配置為過期并自動停止](../environments/index.html#environments-auto-stop) . ## Review Apps examples[](#review-apps-examples "Permalink") 以下是演示 Review App 配置的示例項目: * [NGINX](https://gitlab.com/gitlab-examples/review-apps-nginx). * [OpenShift](https://gitlab.com/gitlab-examples/review-apps-openshift). 評論應用的其他示例: * [Cloud Native Development with GitLab](https://www.youtube.com/watch?v=jfIyQEwrocw). * [Review Apps for Android](https://about.gitlab.com/blog/2020/05/06/how-to-create-review-apps-for-android-with-gitlab-fastlane-and-appetize-dot-io/). ## Route Maps[](#route-maps "Permalink") Introduced in GitLab 8.17\. In GitLab 11.5, the file links are available in the merge request widget. 借助路線圖,您可以直接從源文件進入為 Review Apps 定義的[環境中的](../environments/index.html)公共頁面. 設置完成后,合并請求小部件中的審閱應用程序鏈接可以直接將您帶到更改的頁面,從而使預覽建議的修改變得更加輕松快捷. 配置路由圖涉及到告訴 GitLab 使用路由圖如何將存儲庫中文件的路徑映射到網站上的頁面路徑. 設置后,GitLab 將**在" ..."**按鈕**上**顯示" **視圖"** ,這將帶您進入直接從合并請求更改的頁面. 要設置路線圖,請在資源庫中的`.gitlab/route-map.yml`添加一個文件,其中包含一個 YAML 數組,該數組將`source`路徑(資源庫中)映射到`public`路徑(網站上). ### Route Maps example[](#route-maps-example "Permalink") 以下是[Middleman](https://middlemanapp.com)路線圖的示例, [Middleman](https://middlemanapp.com)是用于構建[GitLab 網站](https://about.gitlab.com)的靜態站點生成器(SSG),是從其[在 GitLab.com 上的項目](https://gitlab.com/gitlab-com/www-gitlab-com)部署的: ``` # Team data - source: 'data/team.yml' # data/team.yml public: 'team/' # team/ # Blogposts - source: /source\/posts\/([0-9]{4})-([0-9]{2})-([0-9]{2})-(.+?)\..*/ # source/posts/2017-01-30-around-the-world-in-6-releases.html.md.erb public: '\1/\2/\3/\4/' # 2017/01/30/around-the-world-in-6-releases/ # HTML files - source: /source\/(.+?\.html).*/ # source/index.html.haml public: '\1' # index.html # Other files - source: /source\/(.*)/ # source/images/blogimages/around-the-world-in-6-releases-cover.png public: '\1' # images/blogimages/around-the-world-in-6-releases-cover.png ``` 映射定義為根 YAML 數組中的條目,并以`-`前綴標識. 在一個條目中,有一個帶有兩個鍵的哈希映射: * `source` * 完全匹配的字符串,以`'`開頭和結尾. * 正則表達式,以`/`開頭和結尾,用于模式匹配: * 正則表達式需要匹配整個源路徑-隱含`^`和`$`錨. * 可以包括由`()`表示的捕獲組,這些捕獲組可以在`public`路徑中引用. * 斜杠( `/` )可以但不必轉為`\/` . * 文字句號( `.` )應轉為`\.` . * `public` ,一個以`'`開頭和結尾的字符串. * 可以包含`\N`表達式,從`source`正則表達式開始,以其出現的順序引用捕獲組,從`\1`開始. 通過找到與之匹配的第一個`source`表達式,然后返回相應的`public`路徑,并用`()`捕獲組的值替換`\N`表達式,來確定源路徑的`public`路徑. 在上面的示例中,按照定義順序對映射進行求值的事實用于確保`source/index.html.haml`將匹配`/source\/(.+?\.html).*/`而不是`/source\/(.*)/` ,并將導致`index.html`的公共路徑,而不是`index.html.haml` . 設置路由映射后,它將在以下位置生效: * 在合并請求小部件中. 該: * **"查看應用程序"**按鈕將帶您進入`.gitlab-ci.yml`設置的環境 URL. * 下拉菜單將列出路線圖中的前 5 個匹配項,但如果有 5 個以上可用項,則可以對其進行過濾. [![在合并請求小部件中查看應用程序文件列表](https://img.kancloud.cn/cd/81/cd81b33362c1e314b5015abe95dc84f2_958x342.png)](img/view_on_mr_widget.png) * 在差異中進行合并請求,比較或提交. [!["View on env" button in merge request diff](https://img.kancloud.cn/e2/45/e2453094e20f42ad6c9d7bb6549394d4_2078x916.png)](img/view_on_env_mr.png) * 在 Blob 文件視圖中. [!["View on env" button in file view](https://img.kancloud.cn/18/83/18838f88f90679c2da7a0191ab406592_1068x141.png)](img/view_on_env_blob.png) ## Visual Reviews[](#visual-reviews-starter "Permalink") [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/10761) in GitLab Starter 12.0. 使用視覺評論,您可以向您的評論應用程序提供反饋表單,以便評論者可以將評論直接從應用程序發布回產生評論應用程序的合并請求. ### Configuring Visual Reviews[](#configuring-visual-reviews "Permalink") 確保啟用了`anonymous_visual_review_feedback`功能標志. 管理員可以使用 Rails 控制臺啟用,如下所示: ``` Feature.enable(:anonymous_visual_review_feedback) ``` 反饋表單是通過您添加到 Review App 中頁面的腳本提供的. 如果您擁有該項目的[開發人員權限](../../user/permissions.html) ,則可以通過單擊合并請求的" **管道"**部分中的" **查看"**按鈕來訪問它. 如果在項目中配置了[路線圖,](#route-maps)則表格模式還將顯示更改頁面的下拉列表. [![review button](https://img.kancloud.cn/0f/46/0f467e4a2d9da9d1a0534ee272206147_1962x300.png)](img/review_button.png) 提供的腳本應添加到應用程序的`<head>`中,并由一些項目和合并請求特定的值組成. 看起來是這樣的: ``` <script data-project-id='11790219' data-merge-request-id='1' data-mr-url='https://gitlab.example.com' data-project-path='sarah/review-app-tester' data-require-auth='true' id='review-app-toolbar-script' src='https://gitlab.example.com/assets/webpack/visual_review_toolbar.js'> </script> ``` 理想情況下,創建每個審閱應用程序時,應在運行時使用[環境變量](../variables/predefined_variables.html)替換這些值: * `data-project-id`是項目 ID,可通過`CI_PROJECT_ID`變量找到. * `data-merge-request-id`是合并請求 ID,可以通過`CI_MERGE_REQUEST_IID`變量找到它. `CI_MERGE_REQUEST_IID`僅當[`only: [merge_requests]`](../merge_request_pipelines/index.html)被使用并且在創建合并請求. * `data-mr-url`是 GitLab 實例的 URL,并且對于所有評論應用程序都是相同的. * `data-project-path`是項目的路徑,可以通過`CI_PROJECT_PATH`找到. * `data-require-auth`對于公共項目是可選的,但對于[私有和內部](#visual-reviews-in-private-or-internal-projects)項目則是必需[的](#visual-reviews-in-private-or-internal-projects) . 如果將其設置為`true` ,則將要求用戶輸入其[個人訪問令牌,](../../user/profile/personal_access_tokens.html)而不是其名稱和電子郵件. * `id`始終是`review-app-toolbar-script` ,您無需更改它. * `src`是審閱工具欄腳本的源代碼,該腳本位于相應的 GitLab 實例中,并且對于所有審閱應用程序都是相同的. 例如,在 Ruby 應用程序中,您需要具有以下腳本: ``` <script data-project-id="ENV['CI_PROJECT_ID']" data-merge-request-id="ENV['CI_MERGE_REQUEST_IID']" data-mr-url='https://gitlab.example.com' data-project-path="ENV['CI_PROJECT_PATH']" id='review-app-toolbar-script' src='https://gitlab.example.com/assets/webpack/visual_review_toolbar.js'> </script> ``` 然后,當通過 GitLab CI / CD 部署您的應用程序時,這些變量應替換為其實際值. ### Determining merge request ID[](#determining-merge-request-id "Permalink") 視覺審核工具從`script` HTML 標簽中包含的`data-merge-request-id`數據屬性中檢索合并請求 ID,該`script` HTML 標簽用于將視覺審核工具添加到您的審核應用中. 確定合并請求以鏈接到可視評論應用程序的 ID 后,您可以通過以下任一方式提供 ID: * 通過應用程序的數據屬性`data-merge-request-id`在 script 標簽中對其進行硬編碼. * 在應用程序的構建過程中動態添加`data-merge-request-id`值. * 通過應用中的視覺查看表單手動提供. ### Visual Reviews in private or internal projects[](#visual-reviews-in-private-or-internal-projects "Permalink") 在 GitLab 12.10 中[引入](https://gitlab.com/gitlab-org/gitlab/-/issues/42750#note_317271120) . 要對私有項目和內部項目啟用可視化審閱,請將[`data-require-auth`變量設置](#configuring-visual-reviews)為`true` . 啟用后,用戶必須輸入具有`api`范圍的[個人訪問令牌](../../user/profile/personal_access_tokens.html) ,然后才能提交反饋. ### Using Visual Reviews[](#using-visual-reviews "Permalink") 在為"評論"應用程序[啟用](#configuring-visual-reviews) "視覺評論"后,"視覺評論"反饋表單將覆蓋在應用程序頁面的右下角. [![Visual review feedback form](https://img.kancloud.cn/d3/bb/d3bbed6d0e9b8312b915a96c2e0b85dc_800x358.png)](img/toolbar_feeback_form.png) 要使用反饋表: 1. 對視覺評論發表評論. 您可以使用合并請求注釋中所有可用的[Markdown 注釋](../../user/markdown.html) . 2. 如果`data-require-auth`為`true` ,則必須輸入[個人訪問令牌](../../user/profile/personal_access_tokens.html) . 否則,您必須輸入您的姓名,以及可選的電子郵件地址. 3. 最后,點擊**發送反饋** . 在視覺檢查框中做出評論并提交評論后,評論將自動出現在相應的合并請求中. ## Limitations[](#limitations "Permalink") Review App 限制與[環境限制](../environments/index.html#limitations)相同.
                  <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>

                              哎呀哎呀视频在线观看