Skip to content

Commit

Permalink
Fixed build script and made it build with latest Jenkins
Browse files Browse the repository at this point in the history
  • Loading branch information
Phong Nguyen Le committed Jan 22, 2015
1 parent 177f046 commit 8b9d60d
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 10 deletions.
21 changes: 12 additions & 9 deletions build.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
#/bin/bash

set -e

USAGE="Usage : build.sh -a ELASTICBOX_ADDRESS [-j JENKINS_VERSION,JENKINS_VERSION...]
Example:
Expand All @@ -11,6 +14,7 @@ Options:
-t ElasticBox access token
-w ElasticBox workspace
-c Fork count
-g GitHub access token
-? Display this message
"

Expand All @@ -28,7 +32,7 @@ function help() {
}

# Handle options
while getopts ":a:j:p:t:w:c:h" ARGUMENT
while getopts ":a:j:p:t:w:c:g:h" ARGUMENT
do
case ${ARGUMENT} in

Expand All @@ -38,6 +42,7 @@ do
t ) EBX_TOKEN=$OPTARG;;
w ) EBX_WORKSPACE=$OPTARG;;
c ) FORK_COUNT=$OPTARG;;
g ) GITHUB_TOKEN=$OPTARG;;
h ) help; exit 0;;
: ) help "Missing option argument for -$OPTARG"; exit 1;;
? ) help "Option does not exist: $OPTARG"; exit 1;;
Expand All @@ -56,15 +61,14 @@ then
JENKINS_VERSIONS="$(echo ${JENKINS_VERSIONS} | sed -e s/,/\ /g)"
fi

OLDEST_SUPPORTED_JENKINS_VERSION='1.532.1'
JENKINS_VERSION_COMMENT='version of Jenkins this plugin is built against'

function set_jenkins_version() {
# work-around by disabling forking for version 1.532.1 for now until a way to fix error 'Failed to initialize exploded war'
JENKINS_VERSION=${1}
if [[ -z "${FORK_COUNT}" ]]
then
if [[ ${JENKINS_VERSION} == ${OLDEST_SUPPORTED_JENKINS_VERSION} ]]
if [[ ${JENKINS_VERSION} == ${SAVED_JENKINS_VERSION} ]]
then
FORK_COUNT=0
else
Expand Down Expand Up @@ -100,6 +104,11 @@ function build_with_jenkins_version() {
BUILD_OPTIONS="${BUILD_OPTIONS} -Delasticbox.jenkins.test.workspace=${EBX_WORKSPACE}"
fi

if [[ -n ${GITHUB_TOKEN} ]]
then
BUILD_OPTIONS="${BUILD_OPTIONS} -Dcom.elasticbox.jenkins.test.GitHubAccessToken=${GITHUB_TOKEN}"
fi

cd ${REPOSITORY_FOLDER}
mvn ${BUILD_OPTIONS} clean install

Expand Down Expand Up @@ -129,12 +138,6 @@ do
build_with_jenkins_version ${VERSION}
done

if [[ -z $(echo ${JENKINS_VERSIONS} | grep "${OLDEST_SUPPORTED_JENKINS_VERSION}") ]]
then
build_with_jenkins_version ${OLDEST_SUPPORTED_JENKINS_VERSION}
JENKINS_VERSIONS="${JENKINS_VERSIONS} ${OLDEST_SUPPORTED_JENKINS_VERSION}"
fi

if [[ -z $(echo ${JENKINS_VERSIONS} | grep "${SAVED_JENKINS_VERSION}") ]]
then
build_with_jenkins_version ${SAVED_JENKINS_VERSION}
Expand Down
6 changes: 6 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,12 @@
<version>2.25</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jenkins-ci.main</groupId>
<artifactId>remoting</artifactId>
<version>2.48</version>
<type>jar</type>
</dependency>
</dependencies>

<properties>
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/com/elasticbox/jenkins/ElasticBoxComputer.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
import java.util.logging.Logger;
import jenkins.model.Jenkins;
import org.apache.commons.httpclient.HttpStatus;
import org.jenkinsci.remoting.RoleChecker;

/**
*
Expand Down Expand Up @@ -241,6 +242,9 @@ public List<Inet4Address> call() throws IOException {
return inetAddresses;
}

public void checkRoles(RoleChecker rc) throws SecurityException {
}

This comment has been minimized.

Copy link
@jglick

jglick Aug 3, 2015

Member

Probably wrong. See jenkinsci/remoting#56.

}

@Extension
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/com/elasticbox/jenkins/tests/TestUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public class TestUtils {
static final String TEST_TAG = System.getProperty("elasticbox.jenkins.test.tag", "jenkins-plugin-test");
static final String NAME_PREFIX = TEST_TAG + '-';
static final String LINUX_COMPUTE = "Linux Compute";
static final String GITHUB_USER = System.getProperty("com.elasticbox.jenkins.test.GitHubUser");
static final String GITHUB_USER = System.getProperty("com.elasticbox.jenkins.test.GitHubUser", "tphongio");
static final String GITHUB_ACCESS_TOKEN = System.getProperty("com.elasticbox.jenkins.test.GitHubAccessToken");


Expand Down

0 comments on commit 8b9d60d

Please sign in to comment.