Audit Apps is a coordinated effort instrument that removes the difficult work from giving a climate to exhibit item changes.
Presentation
Audit Apps:
- Give a programmed live see of changes made in an element branch by turning up a powerful climate for your union solicitations.
- Permit designers and item supervisors to see your progressions without expecting to look at your branch and run your adjustments in a sandbox climate.
- Are completely incorporated with theĀ GitLab DevOps LifeCycle.
- Permit you to send your progressions any place you need.
In the above model:
- A Review App is assembled each time a submit is pushed toĀ topic branch.
- The analyst bombs two audits prior to passing the third survey.
- After the survey has passed,Ā topic branchĀ is consolidated intoĀ masterĀ where it is conveyed to arranging.
- Subsequent to having been affirmed in arranging, the progressions that were consolidated intoĀ masterĀ are sent in to creation.
How Review Apps work
A Review App is a planning of a branch with anĀ environment. Admittance to the Review App is made accessible as a connection on theĀ merge requestĀ relevant to the branch.
Coming up next is an illustration of a consolidation demand with a climate set progressively.
In this model, a branch was:
- Effectively constructed.
- Sent under a unique climate that can be reached by tapping on theĀ View appĀ button.
Subsequent to adding Review Apps to your work process, you follow the expanded Git stream. That is:
- Push a branch and let the sprinter send the Review App dependent on theĀ scriptĀ definition of the dynamic climate work.
- Trust that the sprinter will build and send your web application.
- Snap on the connection gave in the consolidation demand identified with the branch to see the progressions live.
Designing Review Apps
Audit Apps are constructed onĀ dynamic conditions, which permit you to progressively establish another climate for each branch.
The way toward arranging Review Apps is as per the following:
- Set up the foundation to have and convey the Review Apps (check theĀ examplesĀ below).
- InstallĀ andĀ configureĀ a sprinter to do arrangement.
- Set up an occupation inĀ .gitlab-ci.ymlĀ that utilizes theĀ predefined CI climate variableĀ ${CI_COMMIT_REF_NAME}Ā to establish dynamic conditions and confine it to run uniquely on branches. On the other hand, you can get a YML layout for this employment byĀ enabling audit appsĀ for your task.
- Alternatively, set an employment thatĀ manually stopsĀ the Review Apps.
Empower Review Apps button
IntroducedĀ in GitLab 12.8.
When arranging Review Apps for an undertaking, you need to add a new position toĀ .gitlab-ci.yml, as referenced previously. To encourage this and in the event that you are utilizing Kubernetes, you can click theĀ Enable Review AppsĀ button and GitLab will incite you with a format code block that you can reorder intoĀ .gitlab-ci.ymlĀ as a beginning stage. To do as such:
- Go to the undertaking your need to make a Review App work for.
- From the left nav, go toĀ OperationsĀ >Ā Environments.
- Snap on theĀ Enable Review AppsĀ button. It is accessible to you in the event that you have Developer or higherĀ permissionsĀ to that venture.
Duplicate the gave code piece and glue it into yourĀ .gitlab-ci.ymlĀ file:
- Don’t hesitate to tune this layout to your own requirements.
- Survey Apps auto-stop
- Perceive how toĀ configure Review Apps conditions to terminate and auto-stopĀ after a given timeframe.
- Survey Apps models
- Coming up next are model ventures that show Review App setup:
- NGINX.
- OpenShift.
- Other examples of Review Apps:
- Ā Cloud Native Development with GitLab.
- Review Apps for Android.
- Route Maps
- Introduced in GitLab 8.17. In GitLab 11.5, the file links are available in the merge request widget.
- Route Maps allows you to go directly from source files to public pages on theĀ environmentĀ defined for Review Apps.
- Once set up, the review app link in the merge request widget can take you directly to the pages changed, making it easier and faster to preview proposed modifications.
- Configuring Route Maps involves telling GitLab how the paths of files in your repository map to paths of pages on your website using a Route Map. Once set, GitLab will displayĀ View on ā¦Ā buttons, which will take you to the pages changed directly from merge requests.
- To set up a route map, add a file inside the repository atĀ
.gitlab/route-map.yml
, which contains a YAML array that mapsĀsource
Ā paths (in the repository) toĀpublic
Ā paths (on the website). - Route Maps example
- The following is an example of a route map forĀ Middleman, a static site generator (SSG) used to buildĀ GitLabās website, deployed from itsĀ project on 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
- Mappings are defined as entries in the root YAML array, and are identified by aĀ
-
Ā prefix. Within an entry, there is a hash map with two keys:
source
- A string, starting and ending withĀ
'
, for an exact match. - A regular expression, starting and ending withĀ
/
, for a pattern match:- The regular expression needs to match the entire source path –Ā
^
Ā andĀ$
Ā anchors are implied. - Can include capture groups denoted byĀ
()
Ā that can be referred to in theĀpublic
Ā path. - Slashes (
/
) can, but donāt have to, be escaped asĀ\/
. - Literal periods (
.
) should be escaped asĀ\.
.
- The regular expression needs to match the entire source path –Ā
- A string, starting and ending withĀ
public
, a string starting and ending withĀ'
.- Can includeĀ
\N
Ā expressions to refer to capture groups in theĀsource
Ā regular expression in order of their occurrence, starting withĀ\1
.
- Can includeĀ
- The public path for a source path is determined by finding the firstĀ
source
Ā expression that matches it, and returning the correspondingĀpublic
Ā path, replacing theĀ\N
Ā expressions with the values of theĀ()
Ā capture groups if appropriate. - In the example above, the fact that mappings are evaluated in order of their definition is used to ensure thatĀ
source/index.html.haml
Ā will matchĀ/source\/(.+?\.html).*/
Ā instead ofĀ/source\/(.*)/
, and will result in a public path ofĀindex.html
, instead ofĀindex.html.haml
. - After you have the route mapping set up, it will take effect in the following locations:
- In the merge request widget. The:
- View appĀ button will take you to the environment URL set inĀ
.gitlab-ci.yml
. - Dropdown will list the first 5 matched items from the route map, but you can filter them if more than 5 are available.
- View appĀ button will take you to the environment URL set inĀ
- In the diff for a merge request, comparison, or commit.
- In the blob file view.
- Visual Reviews
- STARTER
- BRONZE
- Version history
- With Visual Reviews, members of any team (Product, Design, Quality, and so on) can provide feedback comments through a form in your review apps. The comments are added to the merge request that triggered the review app.
- Using Visual Reviews
- After Visual Reviews has beenĀ configuredĀ for the Review App, the Visual Reviews feedback form is overlaid on the right side of every page.
- To use the feedback form to make a comment in the merge request:
- Click theĀ ReviewĀ tab on the right side of a page.
- Make a comment on the visual review. You can make use of all theĀ Markdown annotationsĀ that are also available in merge request comments.
- Enter your personal information:
- IfĀ
data-require-auth
Ā isĀtrue
, you must enter yourĀ personal access token. - Otherwise, enter your name, and optionally your email.
- IfĀ
- ClickĀ Send feedback.
- Ā To see Visual reviews in action, see theĀ Visual Reviews Walk through.
- Configure Review Apps for Visual Reviews
- The feedback form is served through a script you add to pages in your Review App. If you haveĀ Developer permissionsĀ to the project, you can access it by clicking theĀ ReviewĀ button in theĀ PipelineĀ section of the merge request. The form modal will also show a dropdown for changed pages ifĀ route mapsĀ are configured in the project.
- The provided script should be added to theĀ
<head>
Ā of your application and consists of some project and merge request specific values. Hereās how it looks for a project with code hosted in a project on GitLab.com: <script data-project-id='11790219' data-merge-request-id='1' data-mr-url='https://gitlab.com' data-project-path='sarah/review-app-tester' data-require-auth='true' id='review-app-toolbar-script' src='https://gitlab.com/assets/webpack/visual_review_toolbar.js'> </script>
- Ideally, you should useĀ environment variablesĀ to replace those values at runtime when each review app is created:
data-project-id
Ā is the project ID, which can be found by theĀCI_PROJECT_ID
Ā variable.data-merge-request-id
Ā is the merge request ID, which can be found by theĀCI_MERGE_REQUEST_IID
Ā variable.ĀCI_MERGE_REQUEST_IID
Ā is available only ifĀonly: [merge_requests]
Ā is used and the merge request is created.data-mr-url
Ā is the URL of the GitLab instance and will be the same for all review apps.data-project-path
Ā is the projectās path, which can be found byĀCI_PROJECT_PATH
.data-require-auth
Ā is optional for public projects but required forĀ private and internal ones. If this is set toĀtrue
, the user will be required to enter theirĀ personal access tokenĀ instead of their name and email.id
Ā is alwaysĀreview-app-toolbar-script
, you donāt need to change that.src
Ā is the source of the review toolbar script, which resides in the respective GitLab instance and will be the same for all review apps.
- For example, in a Ruby application with code hosted on in a project GitLab.com, you would need to have this script:
<script data-project-id="ENV['CI_PROJECT_ID']" data-merge-request-id="ENV['CI_MERGE_REQUEST_IID']" data-mr-url='https://gitlab.com' data-project-path="ENV['CI_PROJECT_PATH']" id='review-app-toolbar-script' src='https://gitlab.com/assets/webpack/visual_review_toolbar.js'> </script>
- Then, when your app is deployed via GitLab CI/CD, those variables should get replaced with their real values.
- Determining merge request ID
- The visual review tools retrieve the merge request ID from theĀ
data-merge-request-id
Ā data attribute included in theĀscript
Ā HTML tag used to add the visual review tools to your review app. - āAfter determining the ID for the merge request to link to a visual review app, you can supply the ID by either:āā
- Hard-coding it in the script tag via the data attributeĀ
data-merge-request-id
Ā of the app. - Dynamically adding theĀ
data-merge-request-id
Ā value during the build of the app. - Supplying it manually through the visual review form in the app.
- Enable or disable Visual Reviews
- STARTER
- Visual Reviews is deployed behind a feature flag that isĀ enabled by default.Ā GitLab administrators with access to the GitLab Rails consoleĀ can opt to disable it.
- To disable it:
Feature.disable(:anonymous_visual_review_feedback)
- To enable it:
Feature.enable(:anonymous_visual_review_feedback)
- Authentication for Visual Reviews
- IntroducedĀ in GitLab 12.10.
- To enable visual reviews for private and internal projects, set theĀ
data-require-auth
Ā variableĀ toĀtrue
. When enabled, the user must enter aĀ personal access tokenĀ withĀapi
Ā scope before submitting feedback. - This same method can be used to require authentication for any public projects.
- Limitations