vrealize Code Stream Trigger for Gerrit

Similar documents
vrealize Code Stream Trigger for Git

Migrating vrealize Automation 6.2 to 7.2

PostgreSQL Solution 1.1

Multi-Tenancy in vrealize Orchestrator. vrealize Orchestrator 7.4

Migrating vrealize Automation 6.2 to 7.1

vrealize Suite Lifecycle Manager 1.0 Installation and Management vrealize Suite 2017

Using vrealize Operations Tenant App for vcloud Director as a Tenant Admin

vrealize Log Insight Developer Resources

vrealize Suite Lifecycle Manager 1.1 Installation, Upgrade, and Management vrealize Suite 2017

VMware Skyline Collector User Guide. VMware Skyline 1.4

vrealize Code Stream Plug-In SDK Development Guide

VMware vrealize Code Stream Reference Architecture. 16 MAY 2017 vrealize Code Stream 2.3

Workspace ONE UEM Certificate Authentication for Cisco IPSec VPN. VMware Workspace ONE UEM 1810

vrealize Log Insight Developer Resources Update 1 Modified on 03 SEP 2017 vrealize Log Insight 4.0

vrealize Operations Compliance Pack for PCI

VMware vrealize Code Stream Reference Architecture. 12 APRIL 2018 vrealize Code Stream 2.4

vrealize Production Test Upgrade Assessment Guide

Installing and Configuring vrealize Code Stream. 28 JULY 2017 vrealize Code Stream 2.3

Installing and Configuring vrealize Code Stream

Setting Up Resources in VMware Identity Manager 3.1 (On Premises) Modified JUL 2018 VMware Identity Manager 3.1

Installation and Configuration

Integrating AirWatch and VMware Identity Manager

Getting Started with VMware Cloud Assembly. 27 August 2018 VMware Cloud Assembly

Setting Up Resources in VMware Identity Manager. VMware Identity Manager 2.8

Using VMware Identity Manager Apps Portal

Using vrealize Code Stream. 16 MAY 2017 vrealize Code Stream 2.3

Using vrealize Code Stream

Workspace ONE UEM Integration with RSA PKI. VMware Workspace ONE UEM 1810

vrealize Automation Management Pack 2.0 Guide

Tenant Administration. vrealize Automation 6.2

Setting Up Resources in VMware Identity Manager

Setting Up Resources in VMware Identity Manager (SaaS) Modified 15 SEP 2017 VMware Identity Manager

Installing and Configuring vcloud Connector

Horizon Workspace Administrator's Guide

IaaS Integration for Multi- Machine Services. vrealize Automation 6.2

Guide to Deploying VMware Workspace ONE with VMware Identity Manager. SEP 2018 VMware Workspace ONE

Site Recovery Manager Security

VMware AirWatch Content Gateway for Linux. VMware Workspace ONE UEM 1811 Unified Access Gateway

Using vrealize Operations Tenant App as a Service Provider

Guide to Deploying VMware Workspace ONE. DEC 2017 VMware AirWatch 9.2 VMware Identity Manager 3.1

Installing and Configuring vcenter Multi-Hypervisor Manager

Using the VMware vrealize Orchestrator Client

Using the vrealize Orchestrator Operations Client. vrealize Orchestrator 7.5

Installing and Configuring vcloud Connector

Installation and Configuration. vrealize Code Stream 2.1

Installing and Configuring vcenter Support Assistant

Workspace ONE UEM Notification Service. VMware Workspace ONE UEM 1811

DCLI User's Guide. Modified on 20 SEP 2018 Data Center Command-Line Interface

Guide to Deploying VMware Workspace ONE. VMware Identity Manager VMware AirWatch 9.1

Using vrealize Code Stream. 12 APRIL 2018 vrealize Code Stream 2.4

Dell Provisioning for VMware Workspace ONE. VMware Workspace ONE UEM 1902

Installing and Configuring vrealize Automation for the Rainpole Scenario. 12 April 2018 vrealize Automation 7.4

Copyright 2018 VMware, Inc. All rights reserved. Copyright and trademark information.

VMware Identity Manager Connector Installation and Configuration (Legacy Mode)

Using the vrealize Orchestrator Plug-In for vrealize Automation 7.0. vrealize Orchestrator 7.0

Setting Up Resources in VMware Identity Manager (On Premises) Modified on 30 AUG 2017 VMware AirWatch 9.1.1

VMware vrealize Configuration Manager SQL Migration Helper Tool User's Guide vrealize Configuration Manager 5.8

DCLI User's Guide. Data Center Command-Line Interface

VMware Identity Manager Administration

Using vrealize Log Insight Importer. April 12, 2018 vrealize Log Insight 4.6

IaaS Integration for Multi-Machine Services

DCLI User's Guide. Data Center Command-Line Interface 2.9.1

Microsoft Intune App Protection Policies Integration. VMware Workspace ONE UEM 1811

VMware Identity Manager Administration

Lifecycle Manager User's Guide

vcenter Operations Management Pack for vcns

VMware vrealize Operations Management Pack for vcloud Director 4.5 Guide

Samsung Knox Mobile Enrollment. VMware Workspace ONE UEM 1902

Advanced Service Design. vrealize Automation 6.2

Tenant Administration

vcenter Support Assistant User's Guide

Reconfiguring VMware vsphere Update Manager. Update 1 VMware vsphere 6.5 vsphere Update Manager 6.5

vrealize Operations Management Pack for NSX for vsphere 3.5 Release Notes

vrealize Suite Lifecycle Manager 2.0 Installation, Upgrade, and Management VMware vrealize Suite Lifecycle Manager 2018

VMware Infrastructure 3 Primer Update 2 and later for ESX Server 3.5, ESX Server 3i version 3.5, VirtualCenter 2.5

Google Sync Integration Guide. VMware Workspace ONE UEM 1902

VMware Workspace Portal End User Guide

Getting Started with ESXi Embedded

vrealize Suite Lifecycle Manager 1.2 Installation, Upgrade, and Management vrealize Suite 2017

Getting Started with ESX Server 3i Installable Update 2 and later for ESX Server 3i version 3.5 Installable and VirtualCenter 2.5

Tenant Administration

Reconfiguring VMware vsphere Update Manager. 17 APR 2018 VMware vsphere 6.7 vsphere Update Manager 6.7

Using the VMware vcenter Orchestrator Client. vrealize Orchestrator 5.5.1

Administering vrealize Log Insight. 12-OCT-2017 vrealize Log Insight 4.5

Installing and Configuring VMware Identity Manager Connector (Windows) OCT 2018 VMware Identity Manager VMware Identity Manager 3.

VMware Identity Manager Cloud Deployment. Modified on 01 OCT 2017 VMware Identity Manager

VMware Identity Manager Cloud Deployment. DEC 2017 VMware AirWatch 9.2 VMware Identity Manager

IaaS Configuration for Cloud Platforms

Upgrading VMware Identity Manager Connector

VMware Mirage Getting Started Guide

Administering vrealize Log Insight. September 20, 2018 vrealize Log Insight 4.7

Workspace ONE UEM Certificate Authority Integration with JCCH. VMware Workspace ONE UEM 1810

vcenter Server Installation and Setup Modified on 11 MAY 2018 VMware vsphere 6.7 vcenter Server 6.7

VMware Skyline Collector Installation and Configuration Guide. VMware Skyline 1.4

vrealize Operations Manager Customization and Administration Guide vrealize Operations Manager 6.4

vcenter Server Installation and Setup Update 1 Modified on 30 OCT 2018 VMware vsphere 6.7 vcenter Server 6.7

Using the vrealize Orchestrator Chef Plug-In 1.0

VMware Mirage Getting Started Guide

VMware vcenter Configuration Manager and VMware vcenter Application Discovery Manager Integration Guide

Platform Services Controller Administration. Update 1 Modified 03 NOV 2017 VMware vsphere 6.5 VMware ESXi 6.5 vcenter Server 6.5

Transcription:

vrealize Code Stream 2.3 This document supports the version of each product listed and supports all subsequent versions until the document is replaced by a new edition. To check for more recent editions of this document, see http://www.vmware.com/support/pubs. EN-002488-00

You can find the most up-to-date technical documentation on the VMware Web site at: http://www.vmware.com/support/ The VMware Web site also provides the latest product updates. If you have comments about this documentation, submit your feedback to: docfeedback@vmware.com Copyright 2017 VMware, Inc. All rights reserved. Copyright and trademark information. VMware, Inc. 3401 Hillview Ave. Palo Alto, CA 94304 www.vmware.com 2 VMware, Inc.

Contents 1 Integrating vrealize Code Stream With Gerrit 5 2 Set Up and Run the Trigger for Gerrit 7 Example Configuration File for Gerrit Events 8 3 Configure Your Pipeline to View Gerrit Events 11 Pipeline Input Properties for Integration with Gerrit 12 Index 15 VMware, Inc. 3

4 VMware, Inc.

Integrating vrealize Code Stream With Gerrit 1 The vrealize Code Stream Trigger for Gerrit integrates vrealize Code Stream with the Gerrit code review lifecycle. The Trigger for Gerrit enables reviews and merges of developer code to trigger a pipeline based on events. When developers create a patch set for a code change, or merge code changes, Gerrit sends the change events to the trigger for Gerrit. The events trigger the tasks in your pipeline. For example, your pipeline might include the following stages and tasks. Table 1 1. Tasks in a Pipeline Task Unit tests Integration tests Performance tests Task type Bamboo Bamboo Bamboo These tasks might appear in your pipeline as shown here: To connect the trigger for Gerrit to the Gerrit server, you must generate a configuration file. The configuration file establishes an SSH connection to the server. Gerrit sends the change events over the SSH connection, which trigger the pipeline. VMware, Inc. 5

6 VMware, Inc.

Set Up and Run the Trigger for Gerrit 2 You can install and run the trigger for Gerrit on a 32-bit or 64-bit Linux machine, or on your vrealize Code Stream appliance. Then, you must create and run a configuration file for the tool to listen for events. When a user changes code, that change modifies a file in your repository. Then, the trigger for Gerrit receives the JSON payload of events from the Gerrit server, and uses that payload to trigger the pipeline. This procedure establishes the SSH connection to the Gerrit server. Prerequisites Verify that Gerrit is installed on your development machine. See https://www.gerritcodereview.com/. Verify that you can access https://code.vmware.com to download the binary files. Familiarize yourself with the example configuration file and the sections that you must customize. See Example Configuration File for Gerrit Events, on page 8. Procedure 1 Download the trigger for Gerrit to your Linux machine or vrealize Code Stream appliance. a b c Access https://code.vmware.com. To locate the trigger for Gerrit, search for vrealize Code Stream, and click the link to the latest version. Download vrcs-trigger<version>.zip, which contains the readme, binary, and sample configuration files for the trigger for Gerrit. 2 Install the trigger for Gerrit on your Linux machine or vrealize Code Stream appliance. a Extract the ZIP file to a directory, such as /opt/vrcs-trigger. The top level directory includes a directory named dist, which includes a README file that summarizes the tool commands, samples, and deployment. It also includes the directories named /bin and /bin32, which contain the binary files. The directory named samples contains the sample YAML configuration file. b Export the PATH variable so that it includes the directory named /bin. export PATH=$PATH:/opt/vrcs-trigger/dist/bin 3 Generate your configuration file. vrcsgt generate /your_path/your_yaml-configuration-file 4 In the configuration file, update the sections named gerritserver, gerritproject, and vrcsserver with your values. VMware, Inc. 7

5 Validate the configuration file, which reports any errors. vrcsgt configure gerrittrigger.yaml The trigger for Gerrit verifies the credentials for the vrealize Code Stream instance, and encrypts the password and private key. It logs the results and any error messages to gerrittrigger/configuration.log. The result resembles: Logging to gerrittrigger/configuration.log INFO: 2017/03/15 11:01:59 Validating vrcs Server Configuration... INFO: 2017/03/15 11:02:06 Validating Gerrit Server Configuration... INFO: 2017/03/15 11:02:06 Rest endpoint connection successful. INFO: 2017/03/15 11:02:06 Attempting SSH connection... INFO: 2017/03/15 11:02:07 Running command 'gerrit version'. INFO: 2017/03/15 11:02:10 Response from server gerrit version 2.11.8 INFO: 2017/03/15 11:02:10 Configuration complete. Peform 'run' to start listening. When the log files reach 1 MB, they rotate, and the old log is saved with the current time stamp. 6 Run the configuration file to have the trigger for Gerrit start to listen for Gerrit events. vrcsgt run gerrittrigger.yaml This command connects the trigger for Gerrit directly to the Gerrit server. It logs the results and any error messages to gerrittrigger/execution.log. The result resembles: Logging to gerrittrigger/execution.log INFO: 2017/01/31 16:15:39 Validating vrcs Server Configuration... INFO: 2017/01/31 16:15:40 Validating Gerrit Server Configuration... INFO: 2017/01/31 16:15:41 Rest endpoint connection successful. INFO: 2017/01/31 16:15:41 Attempting SSH connection... INFO: 2017/01/31 16:15:41 Running command 'gerrit version'. INFO: 2017/01/31 16:15:44 Response from server gerrit version 2.11.8 INFO: 2017/01/31 16:15:44 Running command 'gerrit stream-events'. INFO: 2017/01/31 16:16:14 patchset-created -> cs-preflight -> Verified http://bellevue-ci.eng.vmware.com:8080/6237 refs/changes/37/6237/2 Event Created The tool logs the events from Gerrit. It also logs the status of the pipeline as either started, completed, cancelled, or failed. You established an SSH connection to the Gerrit server for the trigger for Gerrit to listen for events. What to do next Configure your pipeline to receive the input properties. All properties are optional. See Chapter 3, Configure Your Pipeline to View Gerrit Events, on page 11. Example Configuration File for Gerrit Events You create a configuration file to listen for events from Gerrit. The configuration file links events for a specific Gerrit project to the pipeline in vrealize Code Stream. After an event triggers the pipeline, and the pipeline completes, vrealize Code Stream returns the user configured label to the trigger for Gerrit to bind the tool with the Gerrit server, which defines the interaction. 8 VMware, Inc.

Chapter 2 Set Up and Run the Trigger for Gerrit Table 2 1. Sections in the YAML Configuration File Section GerritServer GerritProject vrcsserver Description Identifies where the Gerrit server is hosted. The trigger for Gerrit connects to the Gerrit server through an SSH connection to listen for events. When a pipeline is mapped to an event, the event triggers the pipeline. When the pipeline completes or fails, an action is taken such as to add a comment or a verified label. To connect to the Gerrit server, a user in Gerrit must be in a non-interactive group, and must supply a privatekey to connect over SSH. Note that the trigger for Gerrit only supports a private key without a passphrase. You set the frequency to retry the connection to the server when it appears to be down. Identifies a specific project in Gerrit. The trigger for Gerrit supports events that occur in the project when developers create patch sets, and when they merge changes after a code review. If the pipeline does not finish in the time indicated, the tool sends a failure message to Gerrit, which indicates that the event is no longer valid. Requires the vrealize Code Stream instance where the pipeline resides. When you enter the password the first time, it appears as clear text, but in following steps it is encrypted. The configuration file includes the following code: gerritserver: name: git-listener-1 URL: https://review.example.com:8080 username: non-interactive-user password: password (non-encrypted the first time) privatekeypath: /path/to/privatekey retrywaitinminutes: 1 gerritproject: name: project-name events: - eventname: patchset-created pipelinename: preflight verifiedlabel: Verified - eventname: change-merged pipelinename: postflight eventexpiryindays: 2 vrcsserver: name: vrcs-server url: https://vrcs.example.com username: vrcs-user<@domain> password: vrcs-user-password tenant: tenant1 pollintervalinminutes: 1 After the trigger for Gerrit verifies that the configuration is correct, it maps an event to a pipeline for the specific project. vrealize Code Stream then logs the Gerrit events received, and the status of the pipeline. VMware, Inc. 9

10 VMware, Inc.

Configure Your Pipeline to View 3 Gerrit Events You can configure your pipeline in vrealize Code Stream, and examine the Gerrit events that occurred. When the trigger for Gerrit receives events from Gerrit through the SSH connection that you established, the tool sends a request to trigger the pipeline. Prerequisites Generate and run the configuration file to establish the SSH connection to the Gerrit server. See Chapter 2, Set Up and Run the Trigger for Gerrit, on page 7. You are familiar with the pipeline configuration input properties to integrate with Gerrit. See Pipeline Input Properties for Integration with Gerrit, on page 12. Procedure 1 In vrealize Code Stream, click Pipelines. 2 Configure the input properties to your pipeline so that it can receive events from Gerrit. a b Select the pipeline that you included in the configuration file. Configure the input properties for the pipeline. For example: VMware, Inc. 11

c To have a pipeline task trigger only when a developer merges changes in Gerrit, enter the condition string in the Execute Task check box. For example: When the input property named GERRIT_CHANGE_ID matches the change number of the merged change, the pipeline triggers. d Save the task and the pipeline. 3 Click Pipeline Executions and view the status of the pipeline that the events triggered. You configured your pipeline and examined the Gerrit events that triggered the pipeline. Pipeline Input Properties for Integration with Gerrit To integrate vrealize Code Stream with Gerrit, you enter input properties in your pipeline configuration. Gerrit Events The events that the pipeline receives are based on the input properties that you enter in the pipeline configuration. The following Gerrit events are allowed. Table 3 1. Gerrit Input Properties for the Pipeline Configuration Event GERRIT_BRANCH GERRIT_CHANGE_COMMIT_MESSAGE GERRIT_CHANGE_ID GERRIT_CHANGE_NUMBER GERRIT_CHANGE_OWNER GERRIT_CHANGE_OWNER_EMAIL GERRIT_CHANGE_OWNER_NAME GERRIT_CHANGE_SUBJECT Description Branch on which the change was sent. Commit message. Identifies a single review or patch. Created when you commit a change. Number that identifies the change. User name and email of the user who owns the change. Email address for the user who owns the change. Name of the user who owns the change. Subject line of the change sent. 12 VMware, Inc.

Chapter 3 Configure Your Pipeline to View Gerrit Events Table 3 1. Gerrit Input Properties for the Pipeline Configuration (Continued) Event GERRIT_CHANGE_URL GERRIT_EVENT_ACCOUNT GERRIT_EVENT_ACCOUNT_EMAIL GERRIT_EVENT_ACCOUNT_NAME GERRIT_EVENT_TYPE GERRIT_HOST GERRIT_NAME GERRIT_PATCHSET_NUMBER GERRIT_PATCHSET_REVISION GERRIT_PATCHSET_UPLOADER GERRIT_PATCHSET_UPLOADER_EMAIL GERRIT_PATCHSET_UPLOADER_NAME GERRIT_PORT GERRIT_PROJECT GERRIT_REFSPEC GERRIT_SCHEME GERRIT_TOPIC GERRIT_URL GERRIT_VERSION Description URL of the change requested. User responsible for the event. Email address for the user. Name of the user who owns the change. Name of the Gerrit event. Hostname and IP address of the Gerrit server. Name of the Gerrit server. Revision number of the patch submitted. Revision ID of the patch submitted. User who uploaded the patch set. Email address for the user. Name of the user. Port on which the Gerrit server runs SSH. Name of the Gerrit project. Used with git fetch to retrieve the actual change. SSH protocol used to connect to Gerrit. Name of the local branch created. URL of the Gerrit server. Version number of the Gerrit server. VMware, Inc. 13

14 VMware, Inc.

Index C configuration file for Gerrit 8 configuration log files 7 E event expiry 8 name 8 G Gerrit integration 5 Gerrit trigger 5 Gerrit event configuration file 8 Gerrit events in pipeline 11 I input properties, trigger for Gerrit 12 L log files for configuration 7 log rotation 7 P password 8 pipeline input properties 12 private key path 8 S setting up, trigger for Gerrit 7 SSH connection 7 T tasks in pipeline 5 trigger for Gerrit 5 trigger for Gerrit setup 7 V view Gerrit events in pipeline 11 VMware, Inc. 15

16 VMware, Inc.