This repository has been archived by the owner on Jan 4, 2023. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
More ATH shenanigans + a Jenkinsfile (#44)
* Added a simple Jenkinsfile * Use docker-selenium images * Use official images in the local start selenium scripts * More tweaking of the Jenkinsfile * And more tweaking of the Jenkinsfile again * what's the pwd * what's the pwd * what's the pwd * Map in a volume for ~/.m2 * Map in a volume for ~/.m2 * No clue what I'm doing * revert BS tests * please show me something * dir doesn't work as you'd expect, it seems * come on * come on * come on * come on * come on * come on * come on * come on * come on * Ok ... needed plugins update and also see JENKINS-33510 .... ffs * Trying to get it to build ... rest-impl tests hanging * Changes to blueocean-ath-firefox * Changes to blueocean-ath-builder * Build BO and ATH on the executor * Try get it working on executor * Try get it working on executor * Nope .... must build inside a docker container so as to get node etc * Try and expose a port range * Back to not building in a container * Run the ATH * Back to not running selenium * printip * printip * printip * printip * printip * printip * printip * printip * Allow control of the http port used by the ATH Jenkins instance * Can I see variables inside the docker image ... * Allow spec of the blueocean host * Start selenium in the Jenkinsfile and try connecting * temp move build outside docker build container * More jiggery pokery * More jiggery pokery * More jiggery pokery * More jiggery pokery * removed dead comment * omg * Fixed build of bo * maven repo * maven repo - more * maven repo - more * maven repo - more * maven repo - more * maven repo - more * use a local nexus repo * use a local nexus repo * use a local nexus repo * use a local nexus repo * use a local nexus repo * use a local nexus repo * use a local nexus repo * use a local nexus repo * use a local nexus repo * use a local nexus repo * local repo binding * local repo binding * getting closer the secret .... run on linux * print out the env * What is setting the env grrr * Fix jenkins_url file * bind the port for the jenskins server * Switch off selenium on the run script * Switch off selenium on the run script * Better messages on the start stop scripts * Updated the local docker file * Remove local .m2 binding * Build the docker image for building * See if it will work without an image name * Nope ... didn't work * Add docker label on node * use mvn tool * Can't run that node scrpit on a slave that already has an old node * export the selenium server container IP address * Connect using the docker bridge network * sudo source * Can't execute the script as source ... write IP to file * Trim process.env.BLUEO_SELENIUM_SERVER_ADDR * Try it on the CI Server * Cleaned up messages from selenium-docker start scripts * Use maven exit code for run script exit * removed echo of exception as it was causing an NPE * Trying to get the classic Jenkins pages working better * Make the target dir if not already there * Make moveClassicBottomStickyButtons complete more deterministic * Fix moveClassicBottomStickyButtons to complete if used on a non-classic Jenkins page * Remove the page head completely for classic Jenkins pages * Fix activity page object "Open" toast selector * Logging * Cleanup move sticky buttons complete * More cleanup of classic Jenkins page_object tweaks * Get an env * try checkout of branch by the same name * try checkout of branch by the same name * try checkout of branch by the same name * try checkout of branch by the same name * try checkout of branch by the same name * try checkout of branch by the same name * try checkout of branch by the same name * try checkout of branch by the same name * try checkout of branch by the same name * try checkout of branch by the same name * parameterise the branch name * parameterise the branch name - some comments in the Jenkinsfile * Output a message if we find a branch by that name * Fix comment in Jenkinsfile
- Loading branch information
Showing
24 changed files
with
549 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
var netaddr = require('network-address'); | ||
console.log(netaddr()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,61 @@ | ||
FROM cloudbees/java-build-tools | ||
FROM ubuntu:16.04 | ||
|
||
ENV MAVEN_VERSION 3.3.3 | ||
ENV NODE_VERSION 6.4.0 | ||
|
||
USER root | ||
|
||
RUN apt-get update | ||
RUN apt-get install -y libxml2-utils libssl-dev | ||
|
||
# ENTRYPOINT bash | ||
#======================== | ||
# Miscellaneous packages | ||
#======================== | ||
RUN apt-get update -qqy \ | ||
&& apt-get -qqy --no-install-recommends install \ | ||
sudo \ | ||
openjdk-8-jdk \ | ||
tar \ | ||
zip xz-utils \ | ||
curl wget \ | ||
git \ | ||
build-essential \ | ||
python \ | ||
iputils-ping \ | ||
&& rm -rf /var/lib/apt/lists/* \ | ||
&& sed -i 's/securerandom\.source=file:\/dev\/random/securerandom\.source=file:\/dev\/urandom/' ./usr/lib/jvm/java-8-openjdk-amd64/jre/lib/security/java.security | ||
|
||
#========== | ||
# Maven | ||
#========== | ||
RUN curl -fsSL http://archive.apache.org/dist/maven/maven-3/$MAVEN_VERSION/binaries/apache-maven-$MAVEN_VERSION-bin.tar.gz | tar xzf - -C /usr/share \ | ||
&& mv /usr/share/apache-maven-$MAVEN_VERSION /usr/share/maven \ | ||
&& ln -s /usr/share/maven/bin/mvn /usr/bin/mvn | ||
ENV MAVEN_HOME /usr/share/maven | ||
|
||
|
||
#=============== | ||
# Node and NPM | ||
#=============== | ||
RUN wget --no-verbose https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-x64.tar.xz -O /opt/nodejs.tar.xz | ||
RUN tar -C /usr/local --strip-components 1 -xJf /opt/nodejs.tar.xz | ||
RUN mkdir /.npm && chmod 777 /.npm | ||
|
||
#============================================= | ||
# Misc packages needed by the ATH | ||
#============================================= | ||
RUN apt-get update -qqy \ | ||
&& apt-get -qqy --no-install-recommends install \ | ||
libxml2-utils \ | ||
libssl-dev \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
#======================================== | ||
# Add normal user with passwordless sudo | ||
#======================================== | ||
RUN sudo useradd bouser --shell /bin/bash --create-home \ | ||
&& sudo usermod -a -G sudo bouser \ | ||
&& echo 'ALL ALL = (ALL) NOPASSWD: ALL' >> /etc/sudoers \ | ||
&& echo 'bouser:secret' | chpasswd | ||
|
||
USER bouser | ||
WORKDIR /home/bouser |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
#!groovy | ||
|
||
node ('docker') { | ||
|
||
// Allow the pipeline to be built with parameters, defaulting the | ||
// Blue Ocean branch name to be that of the ATH branch name. If no such branch | ||
// of Blue Ocean exists, then the ATH will just run against the master branch of | ||
// Blue Ocean. | ||
properties([parameters([string(defaultValue: "${env.BRANCH_NAME}", description: 'Blue Ocean branch name against which the tests on this ATH branch will run', name: 'BLUEOCEAN_BRANCH_NAME')]), pipelineTriggers([])]) | ||
|
||
stage 'init' | ||
//deleteDir() | ||
checkout scm | ||
|
||
// Run selenium in a docker container of its own on the host. | ||
// It will output the selenium server address to ./target/.selenium_ip | ||
sh "./start-selenium.sh" | ||
def seleniumIP = readFile './target/.selenium_ip' | ||
|
||
try { | ||
// Build an image from the the local Dockerfile | ||
def athImg = docker.build('blueocean-ath-builder') | ||
|
||
// Expose the port on which the ATH Jenkins instance runs (12345), allowing the | ||
// Firefox browser (running in the selenium container) to make requests back | ||
// in etc. | ||
// | ||
// To bind in the local ~/.m2 when running in dev mode, simply add the following | ||
// volume binding to the "inside" container run settings (change username from "tfennelly"): | ||
// -v /home/tfennelly/.m2:/home/bouser/.m2 | ||
// | ||
athImg.inside("--expose=12345 -p 12345:12345") { | ||
withEnv(["BLUEO_SELENIUM_SERVER_ADDR=${seleniumIP}"]) { | ||
try { | ||
sh "echo 'Starting build stage'" | ||
// Build blueocean and the ATH | ||
stage 'build' | ||
dir('blueocean-plugin') { | ||
// Try checking out the Blue Ocean branch having the name supplied by build parameter. If that fails | ||
// (i.e. doesn't exist ), just use the default/master branch and run the ATH tests against that. | ||
try { | ||
git (url: 'https://github.com/jenkinsci/blueocean-plugin.git', branch: "${BLUEOCEAN_BRANCH_NAME}") | ||
echo "Found a Blue Ocean branch named '${BLUEOCEAN_BRANCH_NAME}'. Running ATH against that branch." | ||
} catch (Exception e) { | ||
echo "No Blue Ocean branch named '${BLUEOCEAN_BRANCH_NAME}'. Running ATH against 'master' instead." | ||
} | ||
// Need test-compile because the rest-impl has a test-jar that we | ||
// need to make sure gets compiled and installed for other modules. | ||
// Must cd into blueocean-plugin before running build | ||
// see https://issues.jenkins-ci.org/browse/JENKINS-33510 | ||
sh "cd blueocean-plugin && mvn -B clean test-compile install -DskipTests" | ||
} | ||
sh "mvn -B clean install -DskipTests" | ||
|
||
// Run the ATH. Tell the run script to not try starting selenium. Selenium is | ||
// already running in a docker container of it's on in the host. See call to | ||
// ./start-selenium.sh (above) and ./stop-selenium.sh (below). | ||
stage 'run' | ||
sh "./run.sh -a=./blueocean-plugin/blueocean/ --host=\"`node .printip.js`\" --port=12345 --no-selenium" | ||
} catch (err) { | ||
currentBuild.result = "FAILURE" | ||
} finally { | ||
//deleteDir() | ||
} | ||
} | ||
} | ||
} finally { | ||
sh "./stop-selenium.sh" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.