Skip to content

Commit

Permalink
Cwe 150569 ispw git integration pipeline build (#25)
Browse files Browse the repository at this point in the history
ISPW Git Integration - Pipeline build
https://agile.compuware.com/browse/CWE-150569
  • Loading branch information
zhouqr2000 authored and katieeluskie committed Jul 24, 2019
1 parent b7569f7 commit 016e8d4
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 12 deletions.
52 changes: 48 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
# Compuware ISPW Operations Plugin

This plugin sends an ISPW rest API request to a CES rest endpoint.
This plugin
* sends an ISPW rest API request to a CES rest endpoint.
* integrates GIT with ISPW.

## Features
## ISPW Rest API Features

The following features are available in both Pipeline and traditional
project types:

* ISPW Actions: CreateAssignment, GetAssignmentInfo, GetAssignmentTaskList, GenerateTasksInAssignment, PromoteAssignment, DeployAssignment,RegressAssignment, GetReleaseInfo, GetReleaseTaskList, CreateRelease, GenerateTasksInRelease, GetReleaseTaskGenerateListing, GetReleaseTaskInfo, PromoteRelease, DeployRelease, RegressRelease, GetSetInfoAction, GetSetTaskLlist

### Basic plugin features
### Basic build

The following features are only present in the non-pipeline version of
the plugin. For the Pipeline version, these features are available
Expand All @@ -20,7 +22,7 @@ programmatically.
* You can chose to wait for end of action by polling style (freestyle and pipeline)
* You can chose to wait for end of action by webhook callback (pipeline only)

### Pipeline features
### Pipeline build

Suppose you want to generate all DEV2 tasks in assignment PLAY000313,
you can create the rest API request to CES server programmatically like so:
Expand Down Expand Up @@ -49,3 +51,45 @@ echo "...waiting ISPW webhook callback - ${hook.getURL()}"
data = ispwWaitForWebhook hook
echo "...ISPW Webhook called back with message - ${data}"
```

## GIT to ISPW Integration Features

![GIT to ISPW design](https://github.com/jenkinsci/compuware-ispw-operations-plugin/blob/CWE-150569-ISPW-Git-Integration---Pipeline-build/ispw%20git%20integration.png)

### Pipeline build example

```
pipeline {
agent any
triggers {
GenericTrigger(
genericVariables: [
[key: 'ref', value: '$.changes[0].ref.displayId', expressionType: 'JSONPath', regexpFilter: '^(refs/heads/\\|refs/remotes/origin/)'],
[key: 'hash', value: '$.changes[0].toHash', expressionType: 'JSONPath', regexpFilter: '^(refs/heads/\\|refs/remotes/origin/)'],
[key: 'refId', value: '$.changes[0].ref.id', expressionType: 'JSONPath', regexpFilter: '^(refs/heads/\\|refs/remotes/origin/)'],
],
causeString: 'Triggered on $ref',
token: 'mytokenPipeline',
printContributedVariables: true,
printPostContent: true,
silentResponse: false
)
}
stages {
stage("git to ispw") {
steps {
gitToIspwIntegration app: 'PLAY', branchMapping: '''**/dev1 => DEV1, per-commit
**/dev2 => DEV2, per-branch
**/dev3 => DEV3, custom, description
''', connectionId: '94d914d9-ea8d-472c-90e4-4b5c007c64d4', credentialsId: '702482ac-de07-4e55-92b3-fcfecbd4fcd7', gitCredentialsId: '6d38ac8e-2d78-446d-9c84-f6072d896013', gitRepoUrl: 'http://10.211.55.3:7990/bitbucket/scm/proj/gitrepo2.git', runtimeConfig: 'TPZP', stream: 'PLAY'
}
}
}
}
```
Binary file added ispw git integration.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 6 additions & 8 deletions src/main/java/com/compuware/ispw/git/GitToIspwPublishStep.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
/**
*
*/
package com.compuware.ispw.git;

import java.io.PrintStream;
Expand Down Expand Up @@ -40,7 +37,7 @@
import jenkins.model.Jenkins;

/**
* GIT to ISPW integration pipeline build
* GIT to ISPW integration pipeline
*
* @author Sam Zhou
*
Expand Down Expand Up @@ -68,6 +65,7 @@ public GitToIspwPublishStep()

public static final class Execution extends AbstractSynchronousNonBlockingStepExecution<Integer>
{
private static final long serialVersionUID = 1L;

@Inject
private transient GitToIspwPublishStep step;
Expand Down Expand Up @@ -117,7 +115,7 @@ protected Integer run() throws Exception
}

String ispwLevel = refMap.getIspwLevel();
String containerPref = refMap.getContainerPref();
String containerPref = refMap.getContainerPref(); // will be used in future to pass to CLI

if (RestApiUtils.isIspwDebugMode())
{
Expand Down Expand Up @@ -260,8 +258,8 @@ public static final class DescriptorImpl extends AbstractStepDescriptorImpl

// Branch mapping
public static final String branchMapping = "#The following comments show how to use the 'Branch Mapping' field.\n"
+ "#Click on the help button to the right of the screen for more details on how to populate this field\n" + "#\n"
+ "#*/dev1/ => DEV1, per-commit\n" + "#*/dev2/ => DEV2, per-branch\n"
+ "#Click on the help button to the right of the screen for more details on how to populate this field\n"
+ "#\n" + "#*/dev1/ => DEV1, per-commit\n" + "#*/dev2/ => DEV2, per-branch\n"
+ "#*/dev3/ => DEV3, custom, a description\n";
public static final String containerDesc = StringUtils.EMPTY;
public static final String containerPref = StringUtils.EMPTY;
Expand All @@ -280,7 +278,7 @@ public String getDisplayName()
@Override
public String getFunctionName()
{
return "gitToIspwItegration";
return "gitToIspwIntegration";
}

// GIT
Expand Down

0 comments on commit 016e8d4

Please sign in to comment.