### Get configuration description via curl Source: https://wiki.pmease.com/display/QB16/Interact+with+Configurations Example command to fetch the description for configuration ID 2 using basic authentication. ```bash curl -u admin:admin http://localhost:8810/rest/configurations/2/description ``` -------------------------------- ### GitHub README badge example Source: https://wiki.pmease.com/display/QB16/Badge+for+build+status An example of how to embed a QuickBuild status badge into a GitHub README using markdown. ```markdown [![Build status](http://demo.pmease.com/rest/badge/build/25.latest/status.svg)](http://demo.pmease.com) ``` -------------------------------- ### Workspace Directory Structure Example Source: https://wiki.pmease.com/display/QB16/File+Pattern+Reference The initial directory structure of the configuration workspace used for file pattern examples. ```text file0.zip file0.doc dir1/ file1.zip file1.doc dir2/ file2.zip file2.doc dir3/ file3.zip file3.doc ``` -------------------------------- ### Implement configuration-level plugin setting with MyPlugin, MyPluginSetting, and MyAnotherStep Source: https://wiki.pmease.com/display/QB16/Working+with+Plugin+Settings These three Java classes together implement configuration-level plugin settings for the myplugin example. Modify MyPlugin to return MyPluginSetting from getConfigurationSettingClass(), annotate MyPluginSetting with @Editable to provide a description, and use PluginSettingHelper.findConfigurationSetting() in MyAnotherStep to retrieve the setting and log the prefixed message. After saving and starting QuickBuild, the root configuration's advanced settings will include the contributed section, and child configurations inherit the setting unless overridden. ```java ... // omitted for brevity public class MyPlugin extends AbstractPlugin { @Override public Object[] getExtensions() { ... // omitted for brevity } /* @Override public Class getSettingClass() { return MyPluginSetting.class; } */ @Override public Class getConfigurationSettingClass() { return MyPluginSetting.class; } } ``` ```java ... // omitted for brevity @Editable(description="Specify plugin setting for myplugin.") public class MyPluginSetting implements Serializable { ... // omitted for brevity } ``` ```java import com.pmease.quickbuild.pluginsupport.PluginSettingHelper; ... // omitted for brevity public class MyAnotherStep extends Step { ... // omitted for brevity @Override public void run() { MyPluginSetting pluginSetting = (MyPluginSetting) PluginSettingHelper.findConfigurationSetting(MyPlugin.class, Context.getConfiguration(), true); Context.getLogger().info(pluginSetting.getPrefix() + ": " + getMessage()); } } ``` -------------------------------- ### GET $baseURI/version Source: https://wiki.pmease.com/display/QB16/Interact+with+Reports Gets the current data version of a report category. For example, /rest/junit/version returns the data version in text/plain format. ```APIDOC ## GET $baseURI/version ### Description Gets the current data version of a report category. ### Method GET ### Endpoint $baseURI/version ### Parameters None ### Request Example http://quickbuild:8810/rest/junit/version ### Response #### Success Response (200) - **Content-Type**: text/plain - **Body**: The data version, e.g., 2.1 #### Response Example 2.1 ``` -------------------------------- ### Start user agent for proof build testing Source: https://wiki.pmease.com/display/QB16/Working+with+Accurev Commands to start the user agent in the foreground for testing proof builds on different operating systems. ```batch agent.bat ``` ```bash agent.sh console ``` -------------------------------- ### Demo: Get build request id with curl Source: https://wiki.pmease.com/display/QB16/Interact+with+Builds Example curl command to get the request ID of build with ID 14 using BASIC authentication. ```bash curl -u admin:admin http://localhost:8810/rest/builds/14/request_id ``` -------------------------------- ### Generate keystore with keytool Source: https://wiki.pmease.com/display/QB16/Protect+QuickBuild+using+SSL Run this keytool command to generate a keystore for QuickBuild. You will be prompted for keystore and private key passwords; when prompted for name, use the QB server hostname so the CN field matches and passes hostname validation. ```bash /path/to/jdk/bin/keytool -keystore /path/to/keystore -alias QuickBuild -genkey -keyalg RSA -validity 365 ``` -------------------------------- ### Get configuration schedule via curl Source: https://wiki.pmease.com/display/QB16/Interact+with+Configurations Example curl command to retrieve the schedule for a configuration with ID 2. ```bash curl http://localhost:8810/rest/configurations/2/schedule ``` -------------------------------- ### Configure Windows service account in wrapper.conf Source: https://wiki.pmease.com/display/QB16/Install+As+System+Service Configure the service account for the QuickBuild server or agent on Windows. If these properties are not specified, the service runs under the local system account. Edit the file /conf/wrapper.conf. ```properties wrapper.ntservice.account= wrapper.ntservice.password= ``` -------------------------------- ### Get parent configuration demo Source: https://wiki.pmease.com/display/QB16/Interact+with+Configurations A curl command example to retrieve the parent configuration ID for configuration ID 2. ```bash curl http://localhost:8810/rest/configurations/2/parent ``` -------------------------------- ### Get configuration run mode via curl Source: https://wiki.pmease.com/display/QB16/Interact+with+Configurations Example curl command to retrieve the run mode for a configuration with ID 2. ```bash curl http://localhost:8810/rest/configurations/2/run_mode ``` -------------------------------- ### Create a Wicket panel for QuickBuild build overview Source: https://wiki.pmease.com/display/QB16/Working+with+Plugin+UI These three files together create a Wicket panel that displays 'hello' to the current user on the build overview screen. MyPanel.java defines the panel and uses Context.getUser() to get the user name, defaulting to 'guest'. MyPanel.html provides the markup with a wicket:id='message' div. MyPlugin.java registers the panel via the BuildOverviewContribution extension point, also including two StepProvider entries for MyStep and MyAnotherStep. ```java package com.example.myplugin; import org.apache.wicket.markup.html.basic.Label; import org.apache.wicket.markup.html.panel.Panel; import com.pmease.quickbuild.Context; public class MyPanel extends Panel { private static final long serialVersionUID = 1L; public MyPanel(String id) { super(id); String userName; if (Context.getUser() != null) userName = Context.getUser().getName(); else userName = "guest"; add(new Label("message", "hello " + userName)); } } ``` ```html
``` ```java package com.example.myplugin; import java.util.ArrayList; import java.util.List; import org.apache.wicket.markup.html.panel.Panel; import com.pmease.quickbuild.extensionpoint.BuildOverviewContribution; import com.pmease.quickbuild.extensionpoint.StepProvider; import com.pmease.quickbuild.extensionpoint.support.PanelCreator; import com.pmease.quickbuild.pluginsupport.AbstractPlugin; import com.pmease.quickbuild.stepsupport.Step; public class MyPlugin extends AbstractPlugin { @Override public Object[] getExtensions() { return new Object[] { new StepProvider() { @Override public Class getStepClass() { return MyStep.class; } }, new StepProvider() { @Override public Class getStepClass() { return MyAnotherStep.class; } }, new BuildOverviewContribution() { public List getPanelCreators() { List creators = new ArrayList(); creators.add(new PanelCreator() { public Panel getPanel(String id) { return new MyPanel(id); } }); return creators; } public int getOrder() { return 500; } } }; } } ``` -------------------------------- ### Recommend Build Demo Source: https://wiki.pmease.com/display/QB16/Interact+with+Builds Example curl command to recommend a build with ID 14 using basic authentication. ```bash curl -u admin:admin http://localhost:8810/rest/builds/14/recommend ``` -------------------------------- ### Demo: Get group memberships with curl Source: https://wiki.pmease.com/display/QB16/Interact+with+Group+Memberships Example command to retrieve memberships for group ID 1 using basic authentication. ```bash curl -u admin:admin http://localhost:8810/rest/memberships?group_id=1 ``` -------------------------------- ### Troubleshoot macOS app permissions Source: https://wiki.pmease.com/display/QB16/Tray+Monitor Run these commands in the /Applications directory to allow the unsigned QuickBuild Tray Monitor app to start on macOS. ```bash cd /Applications xattr -rd com.apple.provenance QuickBuild\ Tray\ Monitor.app xattr -rd com.apple.quarantine QuickBuild\ Tray\ Monitor.app ``` -------------------------------- ### Define and use a global plugin setting in QuickBuild (MyPluginSetting, MyPlugin, MyAnotherStep) Source: https://wiki.pmease.com/display/QB16/Working+with+Plugin+Settings These three Java files together implement a global plugin setting in QuickBuild. First, MyPluginSetting defines a serializable setting class with a prefix field annotated with @Editable and @NotEmpty. Then MyPlugin overrides getSettingClass() to return MyPluginSetting.class. Finally, MyAnotherStep retrieves the setting via PluginSettingHelper.getSetting() and prefixes its log message with the configured prefix. ```java package com.example.myplugin; import org.hibernate.validator.NotEmpty; import com.pmease.quickbuild.annotation.Editable; // Plugin setting class must contains a default constructor and implement Serializable interface public class MyPluginSetting implements Serializable { private String prefix; @Editable(description="Specify a message prefix here.") @NotEmpty public String getPrefix() { return prefix; } public void setPrefix(String prefix) { this.prefix = prefix; } } ``` ```java ... // omitted for brevity public class MyPlugin extends AbstractPlugin { @Override public Object[] getExtensions() { ... // omitted for brevity } @Override public Class getSettingClass() { return MyPluginSetting.class; } } ``` ```java import com.pmease.quickbuild.pluginsupport.PluginSettingHelper; ... // omitted for brevity public class MyAnotherStep extends Step { ... // omitted for brevity @Override public void run() { MyPluginSetting pluginSetting = (MyPluginSetting) PluginSettingHelper.getSetting(MyPlugin.class, true); Context.getLogger().info(pluginSetting.getPrefix() + ": " + getMessage()); } } ``` -------------------------------- ### GET $baseURI/reports Source: https://wiki.pmease.com/display/QB16/Interact+with+Reports Lists all reports stored in a report category. For example, /rest/junit/reports returns a list of report names in XML format. ```APIDOC ## GET $baseURI/reports ### Description Lists all reports stored in a report category. ### Method GET ### Endpoint $baseURI/reports ### Parameters None ### Request Example http://quickbuild:8810/rest/junit/reports ### Response #### Success Response (200) - **Content-Type**: text/xml - **Body**: XML list of report names #### Response Example unprocessed tests testsuites packages stats agg_overview agg_stats tests_trends ``` -------------------------------- ### Sample build request XML Source: https://wiki.pmease.com/display/QB16/Interact+with+Build+Requests Sample XML for a build request object. It includes configurationId, respectBuildCondition, priority, variables, fileContents, and an optional promotionSource with server, buildId, promotionName, and deliveries. The fileContents element attaches base64-encoded file content to a variable, and the promotionSource can reference another QuickBuild server. ```xml 10 false 10 var_name1 var_value1 var_name2 var_value2 var_name1 base64 encoding of file content http://another-qb-server:8810 admin admin 697 Release artifacts/dir1 **/*.jar artifacts/dir2 **/*.war ``` -------------------------------- ### Get configuration name via curl Source: https://wiki.pmease.com/display/QB16/Interact+with+Configurations Example command to retrieve the name of the configuration with ID 2 using HTTP BASIC authentication. ```bash curl -u admin:admin http://localhost:8810/rest/configurations/2/name ``` -------------------------------- ### Install and Configure Kerberos Client Source: https://wiki.pmease.com/display/QB16/Single+Sign-On+with+Windows+Domain+Account++Trusted+Http+Header+ Install the Kerberos client package and update the configuration file with realm and domain information. ```bash sudo apt-get install krb5-user ``` ```ini EXAMPLE.COM = { kdc = dc.example.com default_domain = example.com } ``` ```ini .example.com = EXAMPLE.COM example.com = EXAMPLE.COM ``` -------------------------------- ### Get all descendant configurations via curl Source: https://wiki.pmease.com/display/QB16/Interact+with+Configurations Example command to retrieve all descendant configurations for the configuration with ID 1 using basic authentication. ```bash curl -u admin:admin "http://localhost:8810/rest/configurations?parent_id=1&recursive=true" ``` -------------------------------- ### Get child configurations via curl Source: https://wiki.pmease.com/display/QB16/Interact+with+Configurations Example command to retrieve child configurations for the configuration with ID 1 using basic authentication. ```bash curl -u admin:admin http://localhost:8810/rest/configurations?parent_id=1 ``` -------------------------------- ### Configuration hierarchy example Source: https://wiki.pmease.com/display/QB16/Configuration+Settings Shows a sample configuration hierarchy with root, project1, and qa levels. Used to illustrate how inheritable configuration settings, such as schedules, propagate down the hierarchy unless overridden at a lower level. ```text root project1 qa ``` -------------------------------- ### TAP test stream example Source: https://wiki.pmease.com/display/QB16/Publish+TAP+Report A sample TAP test stream copied from the TAP website. Use this format to generate TAP reports that QuickBuild can publish as test reports. The stream declares a plan (1..4) and lists test results with ok/not ok statuses. ```text 1..4 ok 1 - Input file opened not ok 2 - First line of the input valid ok 3 - Read the rest of the file not ok 4 - Summarized correctly # TODO Not written yet ``` -------------------------------- ### GET $baseURI/help Source: https://wiki.pmease.com/display/QB16/Interact+with+Reports Lists all supported RESTful functions for a report category. For example, visiting /rest/junit/help shows all available RESTful functions for JUnit. ```APIDOC ## GET $baseURI/help ### Description Lists all supported RESTful functions for a report category. ### Method GET ### Endpoint $baseURI/help ### Parameters None ### Request Example http://quickbuild:8810/rest/junit/help ### Response #### Success Response (200) - **Content-Type**: application/html #### Response Example (HTML content listing available functions) ``` -------------------------------- ### Get available resource count via curl Source: https://wiki.pmease.com/display/QB16/Interact+with+Resources Example using curl with basic authentication to retrieve the available count for a resource with ID 2. ```bash curl -u admin:admin http://localhost:8810/rest/resources/2/available ``` -------------------------------- ### Permanent link to a set of artifact files - example Source: https://wiki.pmease.com/display/QB16/Working+with+Artifacts Example permanent link to all .txt files in build 42 on build_server:8810. ```text http://build_server:8810/batch_download?build_id=42&src_path=artifacts&file_patterns=*.txt ``` -------------------------------- ### Get build success rate demo Source: https://wiki.pmease.com/display/QB16/Interact+with+Configurations A curl command example to retrieve the success rate for configuration ID 2 using basic authentication. ```bash curl -u admin:admin http://localhost:8810/rest/configurations/2/success_rate ``` -------------------------------- ### Add wrapper.java.additional.4=-XX:MaxPermSize=256m to wrapper.conf Source: https://wiki.pmease.com/display/QB16/Backup+and+Restore+Data Add this entry to /conf/wrapper.conf when running with Sun JDK or OpenJDK to avoid using up permgen space. ```properties wrapper.java.additional.4=-XX:MaxPermSize=256m ``` -------------------------------- ### Resume QuickBuild with curl Source: https://wiki.pmease.com/display/QB16/Resume+System Uses curl with HTTP BASIC authentication (admin:admin) to resume the system. Requires administrator login. ```bash curl -u admin:admin http://localhost:8810/rest/resume ``` -------------------------------- ### Get configuration error message via curl Source: https://wiki.pmease.com/display/QB16/Interact+with+Configurations Example command to fetch the error message for configuration ID 2 using basic authentication. ```bash curl -u admin:admin http://localhost:8810/rest/configurations/2/error_message ``` -------------------------------- ### Get issue count in a build range Source: https://wiki.pmease.com/display/QB16/Interact+with+Issues Example URL to retrieve the count of issues in a build range using from_build and to_build query parameters. ```text http://quickbuild:8810/rest/jira/size/19?from_build=100&to_build=200 ``` -------------------------------- ### Recommend Build Syntax Source: https://wiki.pmease.com/display/QB16/Interact+with+Builds The endpoint for recommending a build using the HTTP GET method. ```text http://localhost:8810/rest/builds//recommend ``` -------------------------------- ### Get configuration path via curl Source: https://wiki.pmease.com/display/QB16/Interact+with+Configurations Example command to retrieve the path name of the configuration with ID 2. This service is accessible to all users, including anonymous. ```bash curl http://localhost:8810/rest/configurations/2/path ``` -------------------------------- ### Get configuration XML via curl Source: https://wiki.pmease.com/display/QB16/Interact+with+Configurations Example command to retrieve the XML representation of the root configuration (ID 1) using HTTP BASIC authentication. ```bash curl -u admin:admin http://localhost:8810/rest/configurations/1 ``` -------------------------------- ### Create Membership Demo Source: https://wiki.pmease.com/display/QB16/Interact+with+Group+Memberships Steps to create a membership using a temporary XML file and curl. ```xml 2 3 ``` ```bash curl -X POST -u admin:admin -d@tempfile.xml http://localhost:8810/rest/memberships ``` -------------------------------- ### Get latest builds for all child configurations via curl Source: https://wiki.pmease.com/display/QB16/Interact+with+Latest+Builds A curl command example to retrieve the latest builds for all child configurations of the root configuration non-recursively. ```bash curl -u admin:admin http://localhost:8810/rest/latest_builds?parent_configuration_id=1&recursive=false ``` -------------------------------- ### Get Grid Node User Attributes via cURL Source: https://wiki.pmease.com/display/QB16/Get+and+Set+User+Attributes+of+Grid+Node Example command to retrieve user attributes for a grid node using cURL with basic authentication. ```bash curl -u admin:admin http://:8810/rest/user_attributes/agent1:8811 ``` -------------------------------- ### Configure Apache HTTP Server Source: https://wiki.pmease.com/display/QB16/Single+Sign-On+with+Windows+Domain+Account++Trusted+Http+Header+ Install the Apache server and Kerberos module, enable necessary modules, and set permissions for the keytab file. ```bash sudo apt-get install apache2 ``` ```bash sudo apt-get install libapache2-mod-auth-kerb ``` ```bash $ sudo a2enmod proxy_http rewrite headers ``` ```bash $ sudo chown www-data apache.keytab $ sudo chgrp www-data apache.keytab $ sudo chmod 600 apache.keytab ``` -------------------------------- ### Get average build duration via curl Source: https://wiki.pmease.com/display/QB16/Interact+with+Configurations Example curl command to retrieve the average build duration for a configuration with ID 2 using basic authentication. ```bash curl -u admin:admin http://localhost:8810/rest/configurations/2/average_duration ``` -------------------------------- ### Set Grid Node User Attributes Example File Source: https://wiki.pmease.com/display/QB16/Get+and+Set+User+Attributes+of+Grid+Node Example content for an attributes.xml file used to define user attributes. ```xml attribute1 value1 attribute2 value2 ``` -------------------------------- ### Get interpolated hierarchy variables via curl Source: https://wiki.pmease.com/display/QB16/Interact+with+Configurations Example curl command to retrieve interpolated hierarchy variables for a configuration with ID 2 using basic authentication. ```bash curl -u admin:admin http://localhost:8810/rest/configurations/2/interpolatedVariablesInHierarchy ``` -------------------------------- ### Get configuration hierarchy variables via curl Source: https://wiki.pmease.com/display/QB16/Interact+with+Configurations Example curl command using HTTP BASIC authentication to retrieve hierarchy variables for a configuration with ID 2. ```bash curl -u admin:admin http://localhost:8810/rest/configurations/2/variablesInHierarchy ``` -------------------------------- ### Permanent link to single artifact file - example Source: https://wiki.pmease.com/display/QB16/Working+with+Artifacts Example permanent link to the file productA-1.0.3.jar in build 42 on build_server:8810. ```text http://build_server:8810/download/42/artifacts/distribute/productA-1.0.3.jar ```