Skip to content

Commit

Permalink
Merge pull request #302 from electric-cloud/release
Browse files Browse the repository at this point in the history
Merging release to master
  • Loading branch information
imago-storm authored Apr 21, 2021
2 parents dbf7c7e + 8c10cd1 commit a26d18c
Show file tree
Hide file tree
Showing 646 changed files with 31,593 additions and 7,436 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
EC-WebSphere
============

The ElectricFlow WebSphere integration
The CloudBees CD WebSphere integration

## Compile ##

Expand All @@ -20,6 +20,6 @@ Create an ecplugin.properties at the root of this repository with the following
These represent secrets that **should not** be checked in.

#### Running tests ####
Run the `test` task to run the system tests. You may want to specify the ElectricFlow Server to test against by way of the COMMANDER_SERVER environment variable.
Run the `test` task to run the system tests. You may want to specify the CloudBees CD Server to test against by way of the COMMANDER_SERVER environment variable.

`COMMANDER_SERVER=<ElectricFlow Server FQDN or IP> ./gradlew test`
`COMMANDER_SERVER=<CloudBees CD Server FQDN or IP> ./gradlew test`
57 changes: 30 additions & 27 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,50 +3,53 @@
//
// Gradle build script for EC-WebSphere plugin.
//
// Copyright (c) 2016 Electric Cloud, Inc.
// Copyright (c) 2016 CloudBees, Inc.
// All rights reserved

buildscript {
repositories {
maven { url 'http://dl.bintray.com/ecpluginsdev/maven' }

jcenter()
mavenCentral()
maven { url 'https://repo.cloudbees.com/content/repositories/dev-connect' }
}
dependencies {
classpath group: 'com.electriccloud.plugins', name: 'flow-gradle-plugin', version: '2.+'
classpath group: 'com.electriccloud.plugins', name: 'flow-gradle-plugin', version: '2.4'
}
}

repositories {
mavenCentral()
maven { url 'https://repo.cloudbees.com/content/repositories/dev-connect' }
maven {
url 'https://nexus-internal.cloudbees.com/content/groups/mirror'
credentials {
username = nexusUsername
password = nexusPassword
}
}
}

configurations.all {
resolutionStrategy {
force group: 'com.electriccloud', name: 'ec-test', version: '10.1.0'
force group: 'com.electriccloud', name: 'commander-client', version: '10.1.0'
force group: 'com.electriccloud', name: 'commander-sdk', version: '6.1.2.1'
force group: 'com.electriccloud', name: 'ec_internal', version: '6.1.2.1'
force group: 'com.google.gwt', name: 'gwt-user', version: '2.5.0-ec3'
force group: 'com.google.gwt', name: 'gwt-dev', version: '2.5.0-ec1'

cacheChangingModulesFor 0, 'seconds'
}
}

group = 'com.electriccloud'
description = 'Plugins : EC-WebSphere'
version = '2.7.0'
version = '2.9.0'

apply plugin: 'flow-gradle-plugin'
apply plugin: 'license'

license {
header = file ('shortHeader.txt')
exclude "**/project.xml"
}

dependencies {
testCompile 'junit:junit:[4,)'
testCompile 'org.mockito:mockito-core:1.9.5'
}

test {
Properties props = new Properties()

systemProperties['COMMANDER_SERVER'] = "$commanderServer"
systemProperties['PLUGIN_VERSION'] = version
//TODO: load properties for WebSphere


testLogging {
// Show that tests are run in the command-line output
events 'started', 'passed'
exceptionFormat = 'full'
}
}

task wrapper(type: Wrapper) { gradleVersion = '2.14' }
91 changes: 49 additions & 42 deletions cgi-bin/websphereMonitor.cgi
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ use constant {
ERROR => 1,
};


my $gTimeout = 20;

################################
Expand All @@ -38,133 +37,141 @@ my $gTimeout = 20;
sub main {

# Get CGI args
my $cgi = new CGI;
my $cgi = CGI->new();
my $cgiArgs = $cgi->Vars;

# Check for required args
my $jobId = $cgiArgs->{jobId};
if (!defined $jobId || "$jobId" eq "") {
reportError($cgi, "jobId is a required parameter");
}

# Wait for job
my $ec = new ElectricCommander({abortOnError => 0});
my $ec = ElectricCommander->new({abortOnError => 0});
$ec->abortOnError(0);
my $xpath = $ec->waitForJob($jobId, $gTimeout);
my $errors = $ec->checkAllErrors($xpath);

if ("$errors" ne "") {
reportError($cgi, $errors);
}

my $status = $xpath->findvalue("//status");
if ("$status" ne "completed") {

# Abort job and report failure
abortJobAndReportError($cgi, $ec, $jobId);
}

my $outcome = $xpath->findvalue("//outcome");
if ("$outcome" ne "success") {

# Report job errors
reportJobErrors($cgi, $ec, $jobId);
}

# If the job was successful and the debug flag is not set, delete it
my $debug = $cgiArgs->{debug};
if (!defined $debug || "$debug" ne "1") {
$ec->deleteJob($jobId);
}


# <!-- This behaviour was copied from the ServiceNowMonitor.cgi but commented out due to the FLOWPLUGIN-7918 -->
# # If the job was successful and the debug flag is not set, delete it
# my $debug = $cgiArgs->{debug};
# if (!defined $debug || "$debug" ne "1") {
# $ec->deleteJob($jobId);
# }

# Report the job's success
reportSuccess($cgi);
}
} ## end sub main

################################
# abortJobAndReportError - Abort the job and report the timeout error.
#
# Arguments:
# cgi
# cgi
# ec - ElectricCommander instance
# jobId - int identifier for the job
# jobId - int identifier for the job
#
# Returns:
# -
#
################################
sub abortJobAndReportError($$$) {
my ($cgi, $ec, $jobId) = @_;

my $errMsg = "Aborting job after reaching timeout";

# Try to abort the job
my $xpath = $ec->abortJob($jobId);
my $xpath = $ec->abortJob($jobId);
my $errors = $ec->checkAllErrors($xpath);
if ("$errors" ne "") {
if ("$errors" ne '') {
reportError($cgi, $errMsg . "\n" . $errors);
}

# Wait for the job to finish aborting
$xpath = $ec->waitForJob($jobId, $gTimeout);
$errors = $ec->checkAllErrors($xpath);
if ("$errors" ne "") {
reportError($cgi, $errMsg . "\n" . $errors);
}

# Check to see if the job actually aborted
my $status = $xpath->findvalue("//status");
if ("$status" ne "completed") {
reportError($cgi, $errMsg . "\nJob still running after abort");
}

reportError($cgi, $errMsg . "\nJob successfully aborted");
}
} ## end sub abortJobAndReportError($$$)

################################
# reportJobErrors - Look for errors in the job to report.
#
# Arguments:
# cgi
# cgi
# ec - ElectricCommander instance
# jobId - int identifier for the job
# jobId - int identifier for the job
#
# Returns:
# -
#
################################
sub reportJobErrors($$$) {
my ($cgi, $ec, $jobId) = @_;

# Get job details
my $xpath = $ec->getJobDetails($jobId);
my $errors = $ec->checkAllErrors($xpath);
my $xpath = $ec->getJobDetails($jobId);
my $procedureName = eval {$xpath->findvalue('//job/procedureName')->string_value();};
my $errors = $ec->checkAllErrors($xpath);
if ("$errors" ne "") {
reportError($cgi, $errors);
}

# Look for configError first
my $configError = $xpath->findvalue("//job/propertySheet/property[propertyName='configError']/value");
if (defined $configError && "$configError" ne "") {
reportError($cgi, $configError)
}

# Find the first error message and report it
my @errorMessages = $xpath->findnodes("//errorMessage");
if (@errorMessages > 0) {
my $firstMessage = $errorMessages[0]->string_value();
reportError($cgi, $firstMessage);
}

# Report a generic error message if we couldn't find a specific one on the
# job
reportError($cgi, "Configuration creation failed");
}
if ($procedureName && ($procedureName eq 'EditConfiguration')) {
reportError($cgi, "Edit configuration failed");
}
else {
reportError($cgi, "Configuration creation failed");
}
} ## end sub reportJobErrors($$$)

################################
# reportError - Print the error message and exit.
#
# Arguments:
# cgi
# cgi
# error - string to print
#
# Returns:
Expand All @@ -174,7 +181,7 @@ sub reportJobErrors($$$) {
################################
sub reportError($$) {
my ($cgi, $error) = @_;

print $cgi->header("text/html");
print $error;
exit ERROR;
Expand All @@ -184,15 +191,15 @@ sub reportError($$) {
# reportSuccess - Report success.
#
# Arguments:
# cgi
# cgi
#
# Returns:
# -
#
################################
sub reportSuccess($) {
my ($cgi) = @_;

print $cgi->header("text/html");
print "Success";
}
Expand Down
6 changes: 3 additions & 3 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Thu Jul 14 01:00:21 EEST 2016
#Thu Jul 16 16:57:44 EEST 2020
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14-all.zip
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14-bin.zip
zipStoreBase=GRADLE_USER_HOME
Loading

0 comments on commit a26d18c

Please sign in to comment.