Skip to content

Commit

Permalink
initial toolchain
Browse files Browse the repository at this point in the history
  • Loading branch information
jakepeyser committed Jun 7, 2016
0 parents commit 4a823a8
Show file tree
Hide file tree
Showing 14 changed files with 898 additions and 0 deletions.
181 changes: 181 additions & 0 deletions .bluemix/catalog-api.pipeline.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,181 @@
---
stages:
- name: BUILD
inputs:
- type: git
branch: master
service: ${CATALOG_API_REPO}
triggers:
- type: commit
jobs:
- name: Build
type: builder
- name: Unit Tests
type: tester
extension_id: ibm.devops.services.pipeline.dra_upload_results
APPLICATION_NAME: Catalog-API
FORMAT_SELECT: mocha
LIFE_CYCLE_STAGE_SELECT: unittest
ADDITIONAL_FORMAT_SELECT: istanbul
ADDITIONAL_LIFE_CYCLE_STAGE_SELECT: code
ADDITIONAL_LOG_FILE: tests/server/coverage/reports/coverage-summary.json
LOG_FILE: tests/server/mochatest.json
ENVIRONMENT: DEV
COMMAND: |
#!/bin/bash
GRUNTFILE="tests/Gruntfile.js"
if [ -f $GRUNTFILE ]; then
npm install -g [email protected] ### work around default npm 2.1.1 instability
npm install
grunt dev-test-cov --no-color -f --gruntfile $GRUNTFILE --base .
else
echo "$GRUNTFILE not found."
fi
- name: DEV Gate
type: tester
extension_id: ibm.devops.services.pipeline.dra_devops_gate
CRITERIA: Unit Test coverage
APPLICATION_NAME: Catalog-API
ENVIRONMENT: DEV
- name: DEV
inputs:
- type: job
stage: BUILD
job: Build
triggers:
- type: stage
properties:
- name: CF_APP_NAME
value: undefined
type: text
- name: APP_URL
value: undefined
type: text
jobs:
- name: Deploy
type: deployer
target:
region_id: ${DEV_REGION_ID}
organization: ${DEV_ORG_NAME}
space: ${DEV_SPACE_NAME}
application: ${CF_APP_NAME}
script: |
#!/bin/bash
cf create-service cloudantNoSQLDB Shared myMicroservicesCloudant
# Push app
export CF_APP_NAME="dev-$CF_APP"
cf push "${CF_APP_NAME}"
export APP_URL=http://$(cf app $CF_APP_NAME | grep urls: | awk '{print $2}')
# View logs
#cf logs "${CF_APP_NAME}" --recent
- name: Functional Tests
type: tester
script: |-
#!/bin/bash
export CATALOG_API_TEST_SERVER=$APP_URL
GRUNTFILE="tests/Gruntfile.js"
if [ -f $GRUNTFILE ]; then
npm install -g [email protected] ### work around default npm 2.1.1 instability
npm install
grunt dev-fvt --no-color -f --gruntfile $GRUNTFILE --base .
else
echo "$GRUNTFILE not found."
fi
- name: TEST
inputs:
- type: job
stage: BUILD
job: Build
triggers:
- type: stage
properties:
- name: CF_APP_NAME
value: undefined
type: text
- name: APP_URL
value: undefined
type: text
jobs:
- name: Deploy
type: deployer
target:
region_id: ${QA_REGION_ID}
organization: ${QA_ORG_NAME}
space: ${QA_SPACE_NAME}
application: ${CF_APP_NAME}
script: |
#!/bin/bash
cf create-service cloudantNoSQLDB Shared myMicroservicesCloudant
# Push app
export CF_APP_NAME="test-$CF_APP"
cf push "${CF_APP_NAME}"
# View logs
#cf logs "${CF_APP_NAME}" --recent
- name: Sauce Labs Tests
type: tester
extension_id: ibm.devops.services.pipeline.saucelabs
services:
- ${SAUCE_LABS}
target:
region_id: ${QA_REGION_ID}
organization: ${QA_ORG_NAME}
space: ${QA_SPACE_NAME}
DL_ASSETS: 'false'
SELECT_CMD: custom
COMMAND: |-
#!/bin/bash
GRUNTFILE="tests/Gruntfile.js"
if [ -f $GRUNTFILE ]; then
npm install
echo $APP_URL | grep "stage1"
if [ $? -eq 0 ]; then
grunt test_fake --gruntfile $GRUNTFILE --base .
else
grunt test_real --gruntfile $GRUNTFILE --base .
fi
else
echo "$GRUNTFILE not found."
fi
enable_tests: true
test_file_pattern: '*.xml'
- name: PROD
inputs:
- type: job
stage: BUILD
job: Build
triggers:
- type: stage
properties:
- name: CF_APP_NAME
value: undefined
type: text
jobs:
- name: Blue/Green Deploy
type: deployer
target:
region_id: ${PROD_REGION_ID}
organization: ${PROD_ORG_NAME}
space: ${PROD_SPACE_NAME}
application: ${CF_APP_NAME}
script: |-
#!/bin/bash
cf create-service cloudantNoSQLDB Shared myMicroservicesCloudant
if ! cf app $CF_APP; then
cf push $CF_APP
else
OLD_CF_APP=${CF_APP}-OLD-$(date +"%s")
rollback() {
set +e
if cf app $OLD_CF_APP; then
cf logs $CF_APP --recent
cf delete $CF_APP -f
cf rename $OLD_CF_APP $CF_APP
fi
exit 1
}
set -e
trap rollback ERR
cf rename $CF_APP $OLD_CF_APP
cf push $CF_APP
cf delete $OLD_CF_APP -f
fi
Binary file added .bluemix/create_toolchain_button.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
156 changes: 156 additions & 0 deletions .bluemix/deploy.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "MicroServices Deploy Stage",
"description": "Feb Demo Microservices Stage Schema",
"longDescription": "The Delivery Pipeline for Devops Services allows you to automate your continuous deployment setup.",
"type": "object",
"properties": {
"dev-region": {
"description": "The bluemix region",
"type": "string"
},
"dev-organization": {
"description": "The bluemix org",
"type": "string"
},
"dev-space": {
"description": "The bluemix space",
"type": "string"
},
"qa-region": {
"description": "The bluemix region",
"type": "string"
},
"qa-organization": {
"description": "The bluemix org",
"type": "string"
},
"qa-space": {
"description": "The bluemix space",
"type": "string"
},
"prod-region": {
"description": "The bluemix region",
"type": "string"
},
"prod-organization": {
"description": "The bluemix org",
"type": "string"
},
"prod-space": {
"description": "The bluemix space",
"type": "string"
},
"orders-app-name": {
"description": "orders app name",
"type": "string"
},
"catalog-app-name": {
"description": "catalog app name",
"type": "string"
},
"ui-app-name": {
"description": "ui app name",
"type": "string"
}
},
"required": ["dev-region", "dev-organization", "dev-space", "qa-region", "qa-organization", "qa-space", "prod-region", "prod-organization", "prod-space", "orders-app-name", "catalog-app-name", "ui-app-name"],
"form": [
{
"type": "validator",
"url": "/devops/setup/bm-helper/helper.html"
},
{
"type": "text",
"readonly": false,
"title": "Orders App Name",
"key": "orders-app-name"
},
{
"type": "text",
"readonly": false,
"title": "Catalog App Name",
"key": "catalog-app-name"
},
{
"type": "text",
"readonly": false,
"title": "UI App Name",
"key": "ui-app-name"
},
{
"type": "table",
"columnCount": 4,
"widths": ["15%", "28%", "28%", "28%"],
"items": [
{
"type": "label",
"title": ""
},
{
"type": "label",
"title": "Region"
},
{
"type": "label",
"title": "Organization"
},
{
"type": "label",
"title": "Space"
},
{
"type": "label",
"title": "Dev Stage"
},
{
"type": "select",
"key": "dev-region"
},
{
"type": "select",
"key": "dev-organization"
},
{
"type": "select",
"key": "dev-space",
"readonly": false
},
{
"type": "label",
"title": "Test Stage"
},
{
"type": "select",
"key": "qa-region"
},
{
"type": "select",
"key": "qa-organization"
},
{
"type": "select",
"key": "qa-space",
"readonly": false
},
{
"type": "label",
"title": "Prod Stage"
},
{
"type": "select",
"key": "prod-region"
},
{
"type": "select",
"key": "prod-organization"
},
{
"type": "select",
"key": "prod-space",
"readonly": false
}
]
}
]
}
Binary file added .bluemix/dra-toolchain2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions .bluemix/dra.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
parameters:
- criteria_name: "Unit Test coverage"
results_file_format: "Istambul"
min_coverage: 0.75
monitor_regression: true
Loading

0 comments on commit 4a823a8

Please sign in to comment.