Skip to content

Commit

Permalink
Merge pull request #614 from kbase/develop
Browse files Browse the repository at this point in the history
Develop -> Master (1.6.5)
  • Loading branch information
eapearson committed Mar 9, 2018
2 parents 062c414 + 52c9134 commit 0fe12da
Show file tree
Hide file tree
Showing 205 changed files with 3,797 additions and 11,246 deletions.
18 changes: 10 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
bower_components
node_modules

# General purpose temp directory
/temp

# Any trash directories
_trash

Expand All @@ -16,24 +13,22 @@ nbproject
/build/dist
/build/build
/build/build-test-coverage
/build/test
/mutations/mutantfiles

# Developer artifacts
/dev/*
!/dev/README.md
_attic

/install/temp
/errorShots
/target
_attic

# package caches wherever they may be installed
bower_components
node_modules
package-lock.json

# General purpose temp directory
/temp
/temp/files

# Any trash directories
_trash
Expand All @@ -60,3 +55,10 @@ nbproject
.DS_Store
.vscode
.idea

# Docker run artifacts
# todo divert files elsewhere
kbase-ui.stdout
kbase-ui.stderr
proxier.stdout
proxier.stderr
10 changes: 7 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ services:
# node_js support. E.g. at the moment the docs say 4.2 is the latest on the 4.X
# branch, but it is actually 4.4
node_js:
- "6.9"
- "6"

# These are travis encrypted var for the DOCKER_USER and DOCKER_PASS creds
# used in the build/push2dockerhub.sh script
Expand All @@ -17,6 +17,10 @@ env:
- secure: "rEkz6iLJq6W9Cp9EgWkmxE4eL7vUsBgG1bmSN42yy8SDjgot1VUYLrO0ZVonxCqdgGvXgfZaDVu/ohtG1D03smzpIvA+yCj/81UnewzBtzqejrAbCB05qGhWd+2VUIF7b0VpMtqmpT4TK6uuTswhYTrXoivduCI8GtqI8s7Yd4WTGUUEa8y6MaEP9qa3/NfPaXTo9OgG+1Obys5fLCdcWgtM58P9H4wFNeHeUBAzLFd96BKzTnctt4shqaUA7Kbh5xriAAC/5Zplna37FqY+wBOfXo7gesQmJs2GBBMinNvq1JDoyPF6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# apt:
# packages:
Expand Down Expand Up @@ -48,5 +52,5 @@ script: make test-travis
# after_script:
# - tools/travis/stop-nginx.sh
after_success:
- make ci-image
- IMAGE_NAME=kbase/kbase-ui ./deployment/ci/tools/push2dockerhub.sh
- make docker_image
- IMAGE_NAME=kbase/kbase-ui ./deployment/tools/push2dockerhub.sh
29 changes: 21 additions & 8 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
/**
* Gruntfile for kbase-ui
*/
var require =

module.exports = function (grunt) {
'use strict';
Expand Down Expand Up @@ -66,27 +65,34 @@ module.exports = function (grunt) {
},
test: {
src: [
'build/build-test-coverage'
'build/build-test-coverage',
'build/test'
]
},
temp: {
src: [
'build/temp'
'temp/files'
]
},
deps: {
src: [
'node_modules', 'bower_components'
]
}
},
},

webdriver: {
test: {
configFile: './test/wdio.conf.js'
},
local: {
configFile: './test/wdio.conf.local.js'
configFile: './test/wdio.conf.local.js',
baseUrl: 'https://' + grunt.option('host') + '.kbase.us'
},
// note should be called with a base of build/tests/integration-tests
integration: {
configFile: './test/wdio.conf.integration.js',
baseUrl: 'https://' + grunt.option('host') + '.kbase.us'
},
sauce: {
configFile: './test/wdio.conf.sauce.js'
Expand All @@ -101,11 +107,18 @@ module.exports = function (grunt) {
'clean:build', 'clean:dist', 'clean:test', 'clean:deps', 'clean:temp'
]);

grunt.registerTask('clean-build', [
'clean:build', 'clean:dist', 'clean:test', 'clean:temp'
]);

// Does a single, local, unit test run.
// TODO: more work on the webdriver tests, don't work now.
grunt.registerTask('test', [
'karma:unit',
'webdriver:local'
grunt.registerTask('unit-test', [
'karma:unit'
]);

grunt.registerTask('integration-tests', [
'webdriver:integration'
]);

// Does a single unit test run, then sends
Expand Down
177 changes: 66 additions & 111 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,32 @@ DEPLOY_CFG = deploy-$(TARGET).cfg
KB_TOP = /kb
GRUNT = ./node_modules/.bin/grunt
KARMA = ./node_modules/.bin/karma
config = dev
directory = build

# The config used to control the build (build task)
# dev, prod
# Defaults to prod
config = prod

# The kbase-ui build folder to use for the docker image.
# values: build, dist
# Defaults to dist
# For local development, one would use the build, since is much faster
# to create. A debug build may be available in the future.
build = dist

# The deploy environment; used by dev-time image runners
# dev, ci, next, appdev, prod
# Defaults to dev, since it is only useful for local dev; dev is really ci.
# Causes run-image.sh to use the file in deployment/conf/$(env).env for
# "filling out" the nginx and ui config templates.
# TODO: hook into the real configs out of KBase's gitlab
env = dev


DEV_DOCKER_CONTEXT = $(TOPDIR)/deployment/dev/docker/context
CI_DOCKER_CONTEXT = $(TOPDIR)/deployment/ci/docker/context
PROD_DOCKER_CONTEXT = $(TOPDIR)/deployment/prod/docker/context
PROXIER_DOCKER_CONTEXT = $(TOPDIR)/deployment/proxier/docker/context
PROXIER_DOCKER_CONTEXT = $(TOPDIR)/tools/proxier/docker/context

# Standard 'all' target = just do the standard build
all:
Expand Down Expand Up @@ -59,159 +79,91 @@ preconditions:
# bower install is not part of the build process, since the bower
# config is not known until the parts are assembled...

install_tools:
setup-dirs:
@echo "> Setting up directories."
mkdir -p temp/files

install-tools:
@echo "> Installing build and test tools."
npm install

init: preconditions install_tools
init: preconditions setup-dirs install-tools


# Perform the build. Build scnearios are supported through the config option
# which is passed in like "make build config=ci"
build:
build: clean-build
@echo "> Building."
cd mutations; node build $(config)

build-ci:
@echo "> Building for CI."
cd mutations; node build ci

build-prod:
@echo "> Building for prod."
cd mutations; node build prod

# Build the docker image, assumes that make init and make build have been done already

dev-image:
@echo "> Building development docker image."
@echo "> Cleaning out old contents"
rm -rf $(DEV_DOCKER_CONTEXT)/contents
@echo "> Copying current build of kbase-ui into contents..."
mkdir -p $(DEV_DOCKER_CONTEXT)/contents/services/kbase-ui
# Note that we copy the "build" build, not the dist build.
cp -pr build/build/client/* $(DEV_DOCKER_CONTEXT)/contents/services/kbase-ui
@echo "> Copying kb/deployment templates..."
cp -pr $(DEV_DOCKER_CONTEXT)/../kb-deployment/* $(DEV_DOCKER_CONTEXT)/contents
@echo "> Beginning docker build..."
cd $(DEV_DOCKER_CONTEXT)/../..; bash tools/build_docker_image.sh
image: build-docker-image

dev-dist-image:
@echo "> Building development docker image."
@echo "> Cleaning out old contents"
rm -rf $(DEV_DOCKER_CONTEXT)/contents
@echo "> Copying current build of kbase-ui into contents..."
mkdir -p $(DEV_DOCKER_CONTEXT)/contents/services/kbase-ui
# Note that we copy the "build" build, not the dist build.
cp -pr build/dist/client/* $(DEV_DOCKER_CONTEXT)/contents/services/kbase-ui
@echo "> Copying kb/deployment entrypoint and config templates..."
cp -pr $(DEV_DOCKER_CONTEXT)/../kb-deployment/* $(DEV_DOCKER_CONTEXT)/contents
chmod u+x $(DEV_DOCKER_CONTEXT)/contents/bin/entrypoint.sh
@echo "> Beginning docker build..."
cd $(DEV_DOCKER_CONTEXT)/../..; bash tools/build_docker_image.sh
docker_image: build-docker-image

ci-image:
@echo "> Building CI docker image."
build-docker-image:
@echo "> Building docker image for this branch."
@echo "> Cleaning out old contents"
rm -rf $(CI_DOCKER_CONTEXT)/contents
@echo "> Copying current dist build of kbase-ui into contents..."
@echo "> Copying dist build of kbase-ui into contents..."
mkdir -p $(CI_DOCKER_CONTEXT)/contents/services/kbase-ui
# Note that we copy the dist build for CI
cp -pr build/dist/client/* $(CI_DOCKER_CONTEXT)/contents/services/kbase-ui
@echo "> Copying kb/deployment config templates..."
cp -pr build/$(build)/client/* $(CI_DOCKER_CONTEXT)/contents/services/kbase-ui
@echo "> Copying kb/deployment templates..."
cp -pr $(CI_DOCKER_CONTEXT)/../kb-deployment/* $(CI_DOCKER_CONTEXT)/contents
@echo "> Beginning docker build..."
cd $(CI_DOCKER_CONTEXT)/../..; bash tools/build_docker_image.sh

prod-image:
@echo "> Building docker image."
@echo "> Cleaning out old contents"
rm -rf $(PROD_DOCKER_CONTEXT)/contents
@echo "> Copying current dist build of kbase-ui into contents..."
mkdir -p $(PROD_DOCKER_CONTEXT)/contents/services/kbase-ui
# And of course we use the dist build for prod.
cp -pr build/dist/client/* $(PROD_DOCKER_CONTEXT)/contents/services/kbase-ui
@echo "> Copying kb/deployment config templates..."
cp -pr $(PROD_DOCKER_CONTEXT)/../kb-deployment/* $(PROD_DOCKER_CONTEXT)/contents
@echo "> Beginning docker build..."
cd $(PROD_DOCKER_CONTEXT)/../..; bash tools/build_docker_image.sh
cd $(TOPDIR)/deployment/; bash tools/build_docker_image.sh

proxier-image:
@echo "> Building docker image."
@echo "> Cleaning out old contents"
rm -rf $(PROXIER_DOCKER_CONTEXT)/contents
mkdir -p $(PROXIER_DOCKER_CONTEXT)/contents
@echo "> Copying kb/deployment config templates..."
cp -pr $(PROXIER_DOCKER_CONTEXT)/../src/* $(PROXIER_DOCKER_CONTEXT)/contents
@echo "> Beginning docker build..."
cd $(PROXIER_DOCKER_CONTEXT)/../..; bash tools/build_docker_image.sh

# run-dev-image:
# @echo "> Running dev image."
# # @echo "> You will need to inspect the docker container for the ip address "
# # @echo "> set your /etc/hosts for ci.kbase.us accordingly."
# @echo "> To map host directories into the container, you will need to run "
# @echo "> deploymnet/dev/tools/run-image.sh with appropriate options."
# $(eval cmd = $(TOPDIR)/deployment/dev/tools/run-image.sh $(env))
# @echo "> Issuing: $(cmd)"
# bash $(cmd)

run-ci-image:
$(eval cmd = $(TOPDIR)/deployment/ci/tools/run-image.sh $(env))
@echo "> Issuing: $(cmd)"
bash $(cmd)

run-prod-image:
$(eval cmd = $(TOPDIR)/deployment/prod/tools/run-image.sh $(env))
@echo "> Issuing: $(cmd)"
bash $(cmd)

run-proxier-image:
$(eval cmd = $(TOPDIR)/deployment/proxier/tools/run-image.sh $(env))
@echo "> Issuing: $(cmd)"
bash $(cmd)

run-dev-image:
@echo "> Running image."
# The dev version of run-image also supports cli options for mapping plugins, libraries,
# and parts of ui into the image for (more) rapdi development workflow
run-image:
@echo "> Running kbase-ui image."
# @echo "> You will need to inspect the docker container for the ip address "
# @echo "> set your /etc/hosts for ci.kbase.us accordingly."
@echo "> With options:"
@echo "> plugins $(plugins)"
@echo "> internal $(internal)"
@echo "> libraries $(libraries)"
@echo "> To map host directories into the container, you will need to run "
@echo "> deploymnet/dev/tools/run-image.sh with appropriate options."
$(eval cmd = $(TOPDIR)/deployment/dev/tools/run-image.sh $(env) $(foreach p,$(plugins),-p $(p)) $(foreach i,$(internal),-i $i) $(foreach l,$(libraries),-l $l) $(foreach s,$(services),-s $s))
@echo "> tools/run-image.sh with appropriate options."
$(eval cmd = $(TOPDIR)/tools/run-image.sh $(env) $(foreach p,$(plugins),-p $(p)) $(foreach i,$(internal),-i $i) $(foreach l,$(libraries),-l $l) $(foreach s,$(services),-s $s))
@echo "> Issuing: $(cmd)"
bash $(cmd)

start:
@echo "> Starting preview server."
@echo "> (make stop to kill it)"
cd tools/server; node server start $(config) $(directory)&
# The proxier, for local dev support

pause:
@echo "> Pausing to let the server start up."
sleep 5

stop:
@echo "> Stopping the preview server."
cd tools/server; node server stop $(config)

# Run the server, and open a browser pointing to it.
preview:
@echo "> Launching default browser for preview"
cd tools/server; node server preview $(config)
proxier-image:
@echo "> Building docker image."
@echo "> Cleaning out old contents"
rm -rf $(PROXIER_DOCKER_CONTEXT)/contents
mkdir -p $(PROXIER_DOCKER_CONTEXT)/contents
@echo "> Copying proxier config templates..."
cp -pr $(PROXIER_DOCKER_CONTEXT)/../src/* $(PROXIER_DOCKER_CONTEXT)/contents
@echo "> Beginning docker build..."
cd $(PROXIER_DOCKER_CONTEXT)/../..; bash tools/build_docker_image.sh

run-proxier-image:
$(eval cmd = $(TOPDIR)/tools/proxier/tools/run-image.sh $(env))
@echo "> Running proxier image"
@echo "> with env $(env)"
@echo "> Issuing: $(cmd)"
bash $(cmd)

# Tests are managed by grunt, but this also mimics the workflow.
#init build
unit-tests:
$(KARMA) start test/unit-tests/karma.conf.js

integration-tests:
$(GRUNT) integration-tests --host=$(host)

travis-tests:
$(GRUNT) test-travis


test: unit-tests

test-travis: unit-tests travis-tests
Expand All @@ -224,6 +176,9 @@ clean:
clean-temp:
$(GRUNT) clean:temp

clean-build:
$(GRUNT) clean-build

# If you need more clean refinement, please see Gruntfile.js, in which you will
# find clean tasks for each major build artifact.

Expand Down
Loading

0 comments on commit 0fe12da

Please sign in to comment.