mirror of
https://github.com/sartography/cr-connect-bpmn.git
synced 2025-02-21 04:38:22 +00:00
Merge branch 'rrt/staging' into rrt/production
This commit is contained in:
commit
537ad55d3b
@ -7,9 +7,6 @@ language: node_js
|
|||||||
node_js:
|
node_js:
|
||||||
- 12
|
- 12
|
||||||
|
|
||||||
python:
|
|
||||||
- "3.7"
|
|
||||||
|
|
||||||
services:
|
services:
|
||||||
- docker
|
- docker
|
||||||
- xvfb
|
- xvfb
|
||||||
@ -33,6 +30,7 @@ env:
|
|||||||
global:
|
global:
|
||||||
- API_URL=http://localhost:5000/v1.0
|
- API_URL=http://localhost:5000/v1.0
|
||||||
- BASE_HREF=/
|
- BASE_HREF=/
|
||||||
|
- DEPLOY_URL=/
|
||||||
- HOME_ROUTE=home
|
- HOME_ROUTE=home
|
||||||
- IRB_URL=http://localhost:5001/
|
- IRB_URL=http://localhost:5001/
|
||||||
- PORT0=4200
|
- PORT0=4200
|
||||||
@ -42,7 +40,7 @@ script:
|
|||||||
|
|
||||||
deploy:
|
deploy:
|
||||||
provider: script
|
provider: script
|
||||||
script: bash ./deploy.sh
|
script: bash ./deploy.sh sartography/cr-connect-bpmn
|
||||||
on:
|
on:
|
||||||
all_branches: true
|
all_branches: true
|
||||||
condition: $TRAVIS_BRANCH =~ ^(dev|testing|demo|training|staging|master|rrt\/.*)$
|
condition: $TRAVIS_BRANCH =~ ^(dev|testing|demo|training|staging|master|rrt\/.*)$
|
||||||
|
14
Dockerfile
14
Dockerfile
@ -1,13 +1,7 @@
|
|||||||
### STAGE 1: Build ###
|
### STAGE 1: Build ###
|
||||||
FROM node AS builder
|
FROM sartography/cr-connect-angular-base AS builder
|
||||||
|
|
||||||
RUN mkdir /crc-bpmn
|
COPY . /app/
|
||||||
WORKDIR /crc-bpmn
|
|
||||||
|
|
||||||
ADD package.json /crc-bpmn/
|
|
||||||
ADD package-lock.json /crc-bpmn/
|
|
||||||
|
|
||||||
COPY . /crc-bpmn/
|
|
||||||
|
|
||||||
ARG build_config=prod
|
ARG build_config=prod
|
||||||
RUN npm install && \
|
RUN npm install && \
|
||||||
@ -17,8 +11,8 @@ RUN npm install && \
|
|||||||
FROM nginx:alpine
|
FROM nginx:alpine
|
||||||
RUN set -x && apk add --update --no-cache bash libintl gettext curl
|
RUN set -x && apk add --update --no-cache bash libintl gettext curl
|
||||||
|
|
||||||
COPY --from=builder /crc-bpmn/dist/* /etc/nginx/html/
|
COPY --from=builder /app/dist/* /etc/nginx/html/
|
||||||
COPY --from=builder /crc-bpmn/nginx.conf /etc/nginx/conf.d/default.conf
|
COPY --from=builder /app/nginx.conf /etc/nginx/conf.d/default.conf
|
||||||
|
|
||||||
# Script for substituting environment variables
|
# Script for substituting environment variables
|
||||||
COPY ./docker/substitute-env-variables.sh ./entrypoint.sh
|
COPY ./docker/substitute-env-variables.sh ./entrypoint.sh
|
||||||
|
51
deploy.sh
51
deploy.sh
@ -1,48 +1,45 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Install AWS CLI
|
#########################################################################
|
||||||
pip install --user awscli;
|
# Builds the Docker image for the current git branch on Travis CI and
|
||||||
export PATH=$PATH:$HOME/.local/bin;
|
# publishes it to Docker Hub.
|
||||||
|
#
|
||||||
|
# Parameters:
|
||||||
|
# $1: Docker Hub repository to publish to
|
||||||
|
#
|
||||||
|
# Required environment variables (place in Settings menu on Travis CI):
|
||||||
|
# $DOCKER_USERNAME: Docker Hub username
|
||||||
|
# $DOCKER_TOKEN: Docker Hub access token
|
||||||
|
#########################################################################
|
||||||
|
|
||||||
|
echo 'Building Docker image...'
|
||||||
|
DOCKER_REPO="$1"
|
||||||
|
|
||||||
function branch_to_tag () {
|
function branch_to_tag () {
|
||||||
if [ "$1" == "latest" ]; then echo "production"; else echo "$1" ; fi
|
if [ "$1" == "master" ]; then echo "latest"; else echo "$1" ; fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function branch_to_deploy_group() {
|
function branch_to_deploy_group() {
|
||||||
if [[ $1 =~ ^(rrt\/.*)$ ]]; then echo "rrt"; else echo "crconnect" ; fi
|
if [[ $1 =~ ^(rrt\/.*)$ ]]; then echo "rrt"; else echo "crconnect" ; fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function branch_to_deploy_stage () {
|
DOCKER_TAG=$(branch_to_tag "$TRAVIS_BRANCH")
|
||||||
if [ "$1" == "master" ]; then echo "production"; else echo "$1" ; fi
|
|
||||||
}
|
|
||||||
|
|
||||||
REPO="sartography/cr-connect-bpmn"
|
|
||||||
TAG=$(branch_to_tag "$TRAVIS_BRANCH")
|
|
||||||
|
|
||||||
DEPLOY_APP="bpmn"
|
|
||||||
DEPLOY_GROUP=$(branch_to_deploy_group "$TRAVIS_BRANCH")
|
DEPLOY_GROUP=$(branch_to_deploy_group "$TRAVIS_BRANCH")
|
||||||
DEPLOY_STAGE=$(branch_to_deploy_stage "$TRAVIS_BRANCH")
|
|
||||||
|
|
||||||
if [ "$DEPLOY_GROUP" == "rrt" ]; then
|
if [ "$DEPLOY_GROUP" == "rrt" ]; then
|
||||||
IFS='/' read -ra ARR <<< "$TRAVIS_BRANCH" # Split branch on '/' character
|
IFS='/' read -ra ARR <<< "$TRAVIS_BRANCH" # Split branch on '/' character
|
||||||
TAG=$(branch_to_tag "rrt_${ARR[1]}")
|
DOCKER_TAG=$(branch_to_tag "rrt_${ARR[1]}")
|
||||||
DEPLOY_STAGE=$(branch_to_deploy_stage "${ARR[1]}")
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
DEPLOY_PATH="$DEPLOY_GROUP/$DEPLOY_STAGE/$DEPLOY_APP"
|
echo "DOCKER_REPO = $DOCKER_REPO"
|
||||||
echo "REPO = $REPO"
|
echo "DOCKER_TAG = $DOCKER_TAG"
|
||||||
echo "TAG = $TAG"
|
|
||||||
echo "DEPLOY_PATH = $DEPLOY_PATH"
|
|
||||||
|
|
||||||
# Build and push Docker image to Docker Hub
|
|
||||||
echo "$DOCKER_TOKEN" | docker login -u "$DOCKER_USERNAME" --password-stdin || exit 1
|
echo "$DOCKER_TOKEN" | docker login -u "$DOCKER_USERNAME" --password-stdin || exit 1
|
||||||
docker build -f Dockerfile -t "$REPO:$TAG" . || exit 1
|
docker build -f Dockerfile -t "$DOCKER_REPO:$DOCKER_TAG" . || exit 1
|
||||||
docker push "$REPO" || exit 1
|
|
||||||
|
|
||||||
# Wait for Docker Hub
|
|
||||||
|
# Push Docker image to Docker Hub
|
||||||
echo "Publishing to Docker Hub..."
|
echo "Publishing to Docker Hub..."
|
||||||
sleep 30
|
docker push "$DOCKER_REPO" || exit 1
|
||||||
|
echo "Done."
|
||||||
# Notify UVA DCOS that Docker image has been updated
|
|
||||||
echo "Refreshing DC/OS..."
|
|
||||||
aws sqs send-message --region "$AWS_DEFAULT_REGION" --queue-url "$AWS_SQS_URL" --message-body "$DEPLOY_PATH" || exit 1
|
|
||||||
|
@ -1,11 +1,5 @@
|
|||||||
version: "3.3"
|
version: "3.3"
|
||||||
services:
|
services:
|
||||||
ldap:
|
|
||||||
container_name: ldap
|
|
||||||
image: tuxmonteiro/ldap-mock
|
|
||||||
ports:
|
|
||||||
- "3890:3890"
|
|
||||||
|
|
||||||
db:
|
db:
|
||||||
container_name: db
|
container_name: db
|
||||||
image: sartography/cr-connect-db:$E2E_TAG
|
image: sartography/cr-connect-db:$E2E_TAG
|
||||||
@ -17,33 +11,10 @@ services:
|
|||||||
- POSTGRES_MULTIPLE_DATABASES=crc_test,pb_test
|
- POSTGRES_MULTIPLE_DATABASES=crc_test,pb_test
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD", "pg_isready"]
|
test: ["CMD", "pg_isready"]
|
||||||
timeout: 20s
|
interval: 10s
|
||||||
|
timeout: 5s
|
||||||
retries: 10
|
retries: 10
|
||||||
|
|
||||||
backend:
|
|
||||||
container_name: backend
|
|
||||||
depends_on:
|
|
||||||
- db
|
|
||||||
image: sartography/cr-connect-workflow:$E2E_TAG
|
|
||||||
environment:
|
|
||||||
- APPLICATION_ROOT=/
|
|
||||||
- CORS_ALLOW_ORIGINS=localhost:5002,bpmn:5002,localhost:4200,frontend:4200
|
|
||||||
- DB_HOST=db
|
|
||||||
- DB_NAME=crc_test
|
|
||||||
- DB_PASSWORD=crc_pass
|
|
||||||
- DB_PORT=5432
|
|
||||||
- DB_USER=crc_user
|
|
||||||
- LDAP_URL=ldap
|
|
||||||
- PB_ENABLED=true
|
|
||||||
- PB_BASE_URL=http://pb:5001/v2.0/
|
|
||||||
- PORT0=5000
|
|
||||||
- RESET_DB=true
|
|
||||||
- UPGRADE_DB=true
|
|
||||||
- TESTING=true
|
|
||||||
ports:
|
|
||||||
- "5000:5000"
|
|
||||||
command: ./wait-for-it.sh db:5432 -t 0 -- ./docker_run.sh
|
|
||||||
|
|
||||||
pb:
|
pb:
|
||||||
container_name: pb
|
container_name: pb
|
||||||
depends_on:
|
depends_on:
|
||||||
@ -63,6 +34,34 @@ services:
|
|||||||
- "5001:5001"
|
- "5001:5001"
|
||||||
command: ./wait-for-it.sh db:5432 -t 0 -- ./docker_run.sh
|
command: ./wait-for-it.sh db:5432 -t 0 -- ./docker_run.sh
|
||||||
|
|
||||||
|
backend:
|
||||||
|
container_name: backend
|
||||||
|
depends_on:
|
||||||
|
- db
|
||||||
|
- pb
|
||||||
|
image: sartography/cr-connect-workflow:$E2E_TAG
|
||||||
|
environment:
|
||||||
|
- APPLICATION_ROOT=/
|
||||||
|
- CORS_ALLOW_ORIGINS=localhost:5002,bpmn:5002,localhost:4200,frontend:4200
|
||||||
|
- DB_HOST=db
|
||||||
|
- DB_NAME=crc_test
|
||||||
|
- DB_PASSWORD=crc_pass
|
||||||
|
- DB_PORT=5432
|
||||||
|
- DB_USER=crc_user
|
||||||
|
- DEVELOPMENT=true
|
||||||
|
- LDAP_URL=mock
|
||||||
|
- PB_BASE_URL=http://pb:5001/v2.0/
|
||||||
|
- PB_ENABLED=true
|
||||||
|
- PORT0=5000
|
||||||
|
- PRODUCTION=false
|
||||||
|
- RESET_DB=true
|
||||||
|
- TESTING=false
|
||||||
|
- UPGRADE_DB=true
|
||||||
|
ports:
|
||||||
|
- "5000:5000"
|
||||||
|
command: ./wait-for-it.sh pb:5001 -t 0 -- ./docker_run.sh
|
||||||
|
|
||||||
|
|
||||||
# bpmn:
|
# bpmn:
|
||||||
# container_name: bpmn
|
# container_name: bpmn
|
||||||
# depends_on:
|
# depends_on:
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
const { SpecReporter } = require('jasmine-spec-reporter');
|
const { SpecReporter } = require('jasmine-spec-reporter');
|
||||||
|
|
||||||
exports.config = {
|
exports.config = {
|
||||||
allScriptsTimeout: 11000,
|
allScriptsTimeout: 60000,
|
||||||
specs: [
|
specs: [
|
||||||
'./src/**/*.e2e-spec.ts'
|
'./src/**/*.e2e-spec.ts'
|
||||||
],
|
],
|
||||||
@ -21,7 +21,7 @@ exports.config = {
|
|||||||
framework: 'jasmine',
|
framework: 'jasmine',
|
||||||
jasmineNodeOpts: {
|
jasmineNodeOpts: {
|
||||||
showColors: true,
|
showColors: true,
|
||||||
defaultTimeoutInterval: 30000,
|
defaultTimeoutInterval: 60000,
|
||||||
print: function() {}
|
print: function() {}
|
||||||
},
|
},
|
||||||
onPrepare() {
|
onPrepare() {
|
||||||
|
@ -7,13 +7,10 @@ describe('workspace-project App', () => {
|
|||||||
page = new AppPage();
|
page = new AppPage();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should display fake sign-in screen', () => {
|
it('should display home screen', () => {
|
||||||
page.navigateTo();
|
page.navigateTo();
|
||||||
expect(page.getText('h1')).toEqual('FAKE UVA NETBADGE SIGN IN (FOR TESTING ONLY)');
|
expect(page.getText('h1')).toEqual('Workflow Specifications');
|
||||||
});
|
expect(page.getRoute()).toEqual('/home');
|
||||||
|
|
||||||
it('should click sign-in and navigate to home screen', () => {
|
|
||||||
page.clickAndExpectRoute('#sign_in', '/home');
|
|
||||||
expect(page.getElements('app-workflow-spec-list').count()).toBeGreaterThan(0);
|
expect(page.getElements('app-workflow-spec-list').count()).toBeGreaterThan(0);
|
||||||
expect(page.getElements('app-file-list').count()).toBeGreaterThan(0);
|
expect(page.getElements('app-file-list').count()).toBeGreaterThan(0);
|
||||||
});
|
});
|
||||||
|
12
package.json
12
package.json
@ -12,13 +12,13 @@
|
|||||||
"test:coverage": "ng test --codeCoverage=true --watch=false --browsers=ChromeHeadless",
|
"test:coverage": "ng test --codeCoverage=true --watch=false --browsers=ChromeHeadless",
|
||||||
"lint": "ng lint",
|
"lint": "ng lint",
|
||||||
"e2e": "./node_modules/protractor/bin/webdriver-manager update && ng e2e",
|
"e2e": "./node_modules/protractor/bin/webdriver-manager update && ng e2e",
|
||||||
"e2e:with-wf": "npm run e2e-wf && ng e2e && npm run e2e-wf:stop",
|
"e2e:with-backend": "npm run backend && ng e2e && npm run backend:stop",
|
||||||
"e2e-wf:stop": "cd docker && docker-compose down && cd ..",
|
"backend:stop": "cd docker && docker-compose down && cd ..",
|
||||||
"e2e-wf:build": "cd docker && docker-compose pull && docker-compose build && cd ..",
|
"backend:build": "cd docker && docker-compose pull && docker-compose build && cd ..",
|
||||||
"e2e-wf:start": "cd docker && docker-compose up -d --force-recreate && cd ..",
|
"backend:start": "cd docker && docker-compose up -d --force-recreate && cd ..",
|
||||||
"e2e-wf": "npm run e2e-wf:stop && npm run e2e-wf:build && npm run e2e-wf:start",
|
"backend": "npm run backend:stop && npm run backend:build && npm run backend:start",
|
||||||
"env": "chmod +x ./docker/substitute-env-variables.sh && ./docker/substitute-env-variables.sh src/index.html PRODUCTION,API_URL,IRB_URL,HOME_ROUTE,BASE_HREF,DEPLOY_URL,PORT0,GOOGLE_ANALYTICS_KEY,SENTRY_KEY,TITLE",
|
"env": "chmod +x ./docker/substitute-env-variables.sh && ./docker/substitute-env-variables.sh src/index.html PRODUCTION,API_URL,IRB_URL,HOME_ROUTE,BASE_HREF,DEPLOY_URL,PORT0,GOOGLE_ANALYTICS_KEY,SENTRY_KEY,TITLE",
|
||||||
"ci": "npm run lint && npm run test:coverage && sonar-scanner"
|
"ci": "npm run lint && npm run test:coverage && sonar-scanner && npm run env && npm run backend && npm run e2e"
|
||||||
},
|
},
|
||||||
"private": true,
|
"private": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user