Skip to content

Commit

Permalink
Merge pull request #255 from esune/em-786
Browse files Browse the repository at this point in the history
EM-786: Updates to BDDStack configuration in Jenkinsfile
  • Loading branch information
NickPhura authored May 2, 2018
2 parents 277c544 + 76db1d9 commit af3eed4
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ local.properties
# Cloud9 IDE
# =========
.c9/
data/
./data/
mongod

# Visual Studio
Expand Down
21 changes: 13 additions & 8 deletions Jenkinsfile.dev
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ node('master'){
}
}

// TODO: activate and verify once the new bddstack jenkins slave image is available
// TODO: enable tests when OpenShift BDDStack image is stable
// podTemplate(label: 'bddstack', name: 'bddstack', serviceAccount: 'jenkins', cloud: 'openshift', containers: [
// containerTemplate(
// name: 'jnlp',
Expand All @@ -179,8 +179,12 @@ node('master'){
// resourceLimitMemory: '4Gi',
// workingDir: '/home/jenkins',
// command: '',
// args: '${computer.jnlpmac} ${computer.name}'
// // TODO: set environment variables for MONGODB service and port
// args: '${computer.jnlpmac} ${computer.name}',
// envVars: [
// secretEnvVar(key: 'MONGODB_USER', secretName: 'bddstack-mongodb', secretKey: 'database-user'),
// secretEnvVar(key: 'MONGODB_PASSWORD', secretName: 'bddstack-mongodb', secretKey: 'database-password'),
// secretEnvVar(key: 'MONGODB_FUNC_DATABASE', secretName: 'bddstack-mongodb', secretKey: 'database-name')
// ]
// )
// ])
// {
Expand All @@ -191,23 +195,24 @@ node('master'){
// echo "Build: ${BUILD_ID}"
// checkout scm
// try {
// sh 'yarn install && npm run e2e'
// // enable node for the current shell, then build the code and run the flow tests
// sh ". /opt/rh/rh-nodejs6/enable; npm install yarn; ./node_modules/yarn/bin/yarn install; npm run e2e -- --MONGODB_FUNC_HOST=bddstack-mongodb --MONGODB_USER=${MONGODB_USER} --MONGODB_PASSWORD=${MONGODB_PASSWORD} --MONGODB_FUNC_DATABASE=${MONGODB_FUNC_DATABASE} --NO_DB_DROP=true"
// } finally {
// archiveArtifacts allowEmptyArchive: true, artifacts: 'build/reports/geb/**/*'
// junit 'build/test-results/**/*.xml'
// archiveArtifacts allowEmptyArchive: true, artifacts: 'functional-tests/build/reports/geb/**/*'
// junit 'functional-tests/build/test-results/**/*.xml'
// publishHTML (target: [
// allowMissing: false,
// alwaysLinkToLastBuild: false,
// keepAll: true,
// reportDir: 'build/reports/spock',
// reportDir: 'functional-tests/build/reports/spock',
// reportFiles: 'index.html',
// reportName: "BDD Spock Report"
// ])
// publishHTML (target: [
// allowMissing: false,
// alwaysLinkToLastBuild: false,
// keepAll: true,
// reportDir: 'build/reports/tests/chromeHeadlessTest',
// reportDir: 'functional-tests/build/reports/test-results/chromeHeadlessTest',
// reportFiles: 'index.html',
// reportName: "Full Test Report"
// ])
Expand Down
10 changes: 5 additions & 5 deletions config/env/functional.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ var defaultEnvConfig = require('./default');

module.exports = {
db: {
uri: process.env.MONGOHQ_URL || process.env.MONGOLAB_URI || 'mongodb://' + (process.env.DB_1_PORT_27017_TCP_ADDR || 'localhost') + '/' + (process.env.MONGODB_FUNC_DATABASE || 'mem-dev-func'),
acluri: process.env.MONGOHQ_URL || process.env.MONGOLAB_URI || 'mongodb://' + (process.env.DB_1_PORT_27017_TCP_ADDR || 'localhost') + '/esm-acl-test',
name: process.env.MONGODB_FUNC_DATABASE || 'mem-dev-func',
uri: 'mongodb://' + (process.env.MONGODB_FUNC_HOST || 'localhost') + '/' + (process.env.MONGODB_FUNC_DATABASE || 'esm-dev-func'),
acluri: 'mongodb://' + (process.env.MONGODB_FUNC_HOST || 'localhost') + '/esm-acl-test',
name: process.env.MONGODB_FUNC_DATABASE || 'esm-dev-func',
options: {
user: '',
pass: ''
user: process.env.MONGODB_USER || '',
pass: process.env.MONGODB_PASSWORD || ''
},
// Enable mongoose debug mode
debug: process.env.MONGODB_DEBUG || false
Expand Down
22 changes: 19 additions & 3 deletions gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,13 @@ module.exports = function(grunt) {
grunt.task.registerTask('start_e2e_server', 'Starting server...', function() {
server_proc_done = this.async();

// pass command line parameters through to the e2e task, by appending to what is in process.env
for(var param in grunt.cli.options){
if( param !== 'tasks' && param !== 'npm' ){
process.env[param] = grunt.cli.options[param];
}
}

server_proc = childProcess.spawn('node', ['server.js'], {
env: process.env,
detached: true,
Expand Down Expand Up @@ -252,10 +259,19 @@ module.exports = function(grunt) {
function() {
drop_database_task_done = this.async();

// pass command line parameters through to the e2e task, by appending to what is in process.env
for(var param in grunt.cli.options){
if( param !== 'tasks' && param !== 'npm' ){
process.env[param] = grunt.cli.options[param];
}
}

var mongoose = require('./config/lib/mongoose.js');
mongoose.dropDatabase(function() {
drop_database_task_done();
});
if(!process.env.NO_DB_DROP){
mongoose.dropDatabase(function() {
drop_database_task_done();
});
}
}
);

Expand Down

0 comments on commit af3eed4

Please sign in to comment.