mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
21
.travis.yml
21
.travis.yml
@@ -64,27 +64,20 @@ script:
|
||||
|
||||
jobs:
|
||||
include:
|
||||
- stage: Check build demo shell in production mode AND e2e
|
||||
before_install:
|
||||
- "export DISPLAY=:99.0"
|
||||
- "sh -e /etc/init.d/xvfb start"
|
||||
script: travis_wait 30 ./scripts/test-dist.sh
|
||||
- stage: Check 2.0.0 Project Update
|
||||
- stage: Demo shell prod && Demo shell e2e && Check ADF exports
|
||||
script: ./scripts/test-dist.sh -n $TRAVIS_BUILD_NUMBER && (./scripts/pr-publish.sh -n $TRAVIS_BUILD_NUMBER -r $REPO_DOCKER -u $USERNAME_DOCKER -p $PASSWORD_DOCKER || exit 1)
|
||||
- # Test Update version 2.0.0
|
||||
script: ./scripts/test-e2e-bc.sh
|
||||
- stage: Check ADF exports
|
||||
- # Test expors
|
||||
script: npm run test-export
|
||||
- stage: Update Generator
|
||||
- stage: Update Apps dependencies
|
||||
if: tag =~ .*beta.*
|
||||
script: ./scripts/update-project.sh -gnu -t $GITHUB_TOKEN -n generator-ng2-alfresco-app
|
||||
- stage: Update Content app
|
||||
if: tag =~ .*beta.*
|
||||
script: ./scripts/update-project.sh -gnu -t $GITHUB_TOKEN -n alfresco-content-app
|
||||
- stage: Update DW
|
||||
if: tag =~ .*beta.*
|
||||
script: ./scripts/update-project.sh -gnu -t $GITHUB_TOKEN -n adf-app-manager-ui
|
||||
- stage: Update ng2-components
|
||||
if: tag =~ .*beta.*
|
||||
script: ./scripts/update-project.sh -gnu -t $GITHUB_TOKEN -n alfresco-ng2-components
|
||||
- stage: Deploy PR
|
||||
script: node ./scripts/pr-deploy.js -n $TRAVIS_BUILD_NUMBER -u $RANCHER_TOKEN -p $RANCHER_SECRET -s $REPO_RANCHER --image "docker:$REPO_DOCKER/adf/demo-shell:$TRAVIS_BUILD_NUMBER" --env $ENVIRONMENT_NAME -r $ENVIRONMENT_URL || exit 1
|
||||
|
||||
# jobs:
|
||||
# include:
|
||||
|
@@ -21,5 +21,9 @@ http {
|
||||
location / {
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
|
||||
location ~ ^/[a-zA-Z0-9_-]+/ {
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
20742
package-lock.json
generated
Normal file
20742
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
14
package.json
14
package.json
@@ -9,7 +9,6 @@
|
||||
"prepublishOnly": "npm run build-lib",
|
||||
"markdownlint": "markdownlint ./docs",
|
||||
"build-lib": "./scripts/ng-packagr.sh",
|
||||
"ng-packagr": "node ./node_modules/ng-packagr/cli/main.js",
|
||||
"bundlesize-check": "bundlesize",
|
||||
"bundlesize-map": "npm run webpack -- --config ./lib/config/webpack.bundle-check.js --progress --profile --bail",
|
||||
"lint-lib": "./node_modules/.bin/tslint -p ./lib/tsconfig.json -c ./lib/tslint.json",
|
||||
@@ -27,11 +26,12 @@
|
||||
"style:dev": "npm run webpack -- --config ./lib/config/webpack.style.js --progress --profile --bail",
|
||||
"test": "ng test --single-run",
|
||||
"lint": "ng lint",
|
||||
"e2e": "ng e2e --app dist",
|
||||
"e2e": "ng e2e --app dist --deleteOutputPath=false",
|
||||
"server-versions": "rimraf ./demo-shell/src/versions.json && npm list --depth=0 --json=true --prod=true > ./demo-shell/src/versions.json || exit 0",
|
||||
"clean": "rimraf dist ./node_modules typings",
|
||||
"clean-lock": "rimraf package-lock.json",
|
||||
"webpack": "node ./node_modules/webpack/bin/webpack.js"
|
||||
"webpack": "node ./node_modules/webpack/bin/webpack.js",
|
||||
"ng-packagr": "node ./node_modules/ng-packagr/cli/main.js"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@@ -71,12 +71,11 @@
|
||||
"@mat-datetimepicker/moment": "1.0.4",
|
||||
"@ngx-translate/core": "9.1.1",
|
||||
"@nrwl/schematics": "^1.0.3",
|
||||
"alfresco-js-api": "2.4.0-31a7fc6e5d58dc8bf202ef9a80bc993c9f48fe18",
|
||||
"alfresco-js-api": "2.4.0-beta3",
|
||||
"chart.js": "2.5.0",
|
||||
"classlist.js": "1.1.20150312",
|
||||
"core-js": "2.4.1",
|
||||
"custom-event-polyfill": "0.3.0",
|
||||
"graphql-request": "^1.5.1",
|
||||
"hammerjs": "2.0.8",
|
||||
"intl": "1.2.5",
|
||||
"minimatch": "3.0.4",
|
||||
@@ -105,6 +104,7 @@
|
||||
"chalk": "^2.3.2",
|
||||
"codelyzer": "4.3.0",
|
||||
"combyne": "^2.0.0",
|
||||
"commander": "^2.15.1",
|
||||
"concurrently": "^3.5.1",
|
||||
"copy-webpack-plugin": "4.0.1",
|
||||
"css-loader": "0.25.0",
|
||||
@@ -124,11 +124,11 @@
|
||||
"karma": "~2.0.0",
|
||||
"karma-chrome-launcher": "~2.2.0",
|
||||
"karma-cli": "~1.0.1",
|
||||
"karma-coverage": "1.1.1",
|
||||
"karma-coverage-istanbul-reporter": "^1.2.1",
|
||||
"karma-jasmine": "~1.1.0",
|
||||
"karma-jasmine-html-reporter": "^0.2.2",
|
||||
"karma-coverage": "1.1.1",
|
||||
"karma-jasmine-ajax": "0.1.13",
|
||||
"karma-jasmine-html-reporter": "^0.2.2",
|
||||
"karma-mocha-reporter": "2.2.2",
|
||||
"karma-remap-istanbul": "0.6.0",
|
||||
"karma-sourcemap-loader": "0.3.7",
|
||||
|
243
scripts/pr-deploy.js
Normal file
243
scripts/pr-deploy.js
Normal file
@@ -0,0 +1,243 @@
|
||||
var program = require('commander');
|
||||
var request = require('request');
|
||||
|
||||
var stackId = "1st550"
|
||||
|
||||
function asyncRequest(option) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
request(option, function (error, res, body) {
|
||||
if (!error && (res.statusCode == 200 || res.statusCode == 201)) {
|
||||
resolve(body);
|
||||
} else {
|
||||
reject(error + JSON.stringify(body));
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
async function main() {
|
||||
|
||||
program
|
||||
.version('0.1.0')
|
||||
.option('-n, --name [type]', 'Name to give at the service in rancher')
|
||||
.option('-r, --remote [type]', 'Remote environment host adf.lab.com ')
|
||||
.option('-e, --env [type]', 'Name to give at the service in rancher')
|
||||
.option('-i, --image [type]', 'Docker image to load')
|
||||
.option('-s, --server [type]', 'Server RANCHER_SERVER URL')
|
||||
.option('-p, --password [type]', 'password RANCHER')
|
||||
.option('-u, --username [type]', 'username RANCHER')
|
||||
.parse(process.argv);
|
||||
|
||||
auth = 'Basic ' + new Buffer(program.username + ':' + program.password).toString('base64')
|
||||
|
||||
var project = await asyncRequest({
|
||||
url: program.server + `/v1/project?name=${program.env}`,
|
||||
method: 'GET',
|
||||
json: true,
|
||||
headers: {
|
||||
"content-type": "application/json",
|
||||
"accept": "application/json",
|
||||
"Authorization": auth
|
||||
},
|
||||
body: ""
|
||||
}).catch((error) => {
|
||||
console.log(error);
|
||||
});
|
||||
|
||||
var environmentId = project.data[0].id
|
||||
|
||||
console.log("ID environment " + environmentId);
|
||||
console.log("image to Load " + program.image);
|
||||
|
||||
var postData = {
|
||||
"scale": 1,
|
||||
"assignServiceIpAddress": false,
|
||||
"startOnCreate": true,
|
||||
"type": "service",
|
||||
"stackId": stackId,
|
||||
"launchConfig": {
|
||||
"instanceTriggeredStop": "stop",
|
||||
"kind": "container",
|
||||
"networkMode": "managed",
|
||||
"privileged": false,
|
||||
"publishAllPorts": false,
|
||||
"readOnly": false,
|
||||
"runInit": false,
|
||||
"startOnCreate": true,
|
||||
"stdinOpen": true,
|
||||
"tty": true,
|
||||
"vcpu": 1,
|
||||
"drainTimeoutMs": 0,
|
||||
"type": "launchConfig",
|
||||
"labels": {"io.rancher.container.pull_image": "always"},
|
||||
"restartPolicy": {"name": "always"},
|
||||
"secrets": [],
|
||||
"dataVolumes": [],
|
||||
"dataVolumesFrom": [],
|
||||
"dns": [],
|
||||
"dnsSearch": [],
|
||||
"capAdd": [],
|
||||
"capDrop": [],
|
||||
"devices": [],
|
||||
"logConfig": {"driver": "", "config": {}},
|
||||
"dataVolumesFromLaunchConfigs": [],
|
||||
"imageUuid": program.image,
|
||||
"ports": [],
|
||||
"blkioWeight": null,
|
||||
"cgroupParent": null,
|
||||
"count": null,
|
||||
"cpuCount": null,
|
||||
"cpuPercent": null,
|
||||
"cpuPeriod": null,
|
||||
"cpuQuota": null,
|
||||
"cpuRealtimePeriod": null,
|
||||
"cpuRealtimeRuntime": null,
|
||||
"cpuSet": null,
|
||||
"cpuSetMems": null,
|
||||
"cpuShares": null,
|
||||
"createIndex": null,
|
||||
"created": null,
|
||||
"deploymentUnitUuid": null,
|
||||
"description": null,
|
||||
"diskQuota": null,
|
||||
"domainName": null,
|
||||
"externalId": null,
|
||||
"firstRunning": null,
|
||||
"healthInterval": null,
|
||||
"healthRetries": null,
|
||||
"healthState": null,
|
||||
"healthTimeout": null,
|
||||
"hostname": null,
|
||||
"ioMaximumBandwidth": null,
|
||||
"ioMaximumIOps": null,
|
||||
"ip": null,
|
||||
"ip6": null,
|
||||
"ipcMode": null,
|
||||
"isolation": null,
|
||||
"kernelMemory": null,
|
||||
"memory": null,
|
||||
"memoryMb": null,
|
||||
"memoryReservation": null,
|
||||
"memorySwap": null,
|
||||
"memorySwappiness": null,
|
||||
"milliCpuReservation": null,
|
||||
"oomScoreAdj": null,
|
||||
"pidMode": null,
|
||||
"pidsLimit": null,
|
||||
"removed": null,
|
||||
"requestedIpAddress": null,
|
||||
"shmSize": null,
|
||||
"startCount": null,
|
||||
"stopSignal": null,
|
||||
"stopTimeout": null,
|
||||
"user": null,
|
||||
"userdata": null,
|
||||
"usernsMode": null,
|
||||
"uts": null,
|
||||
"uuid": null,
|
||||
"volumeDriver": null,
|
||||
"workingDir": null,
|
||||
"networkLaunchConfig": null
|
||||
},
|
||||
"secondaryLaunchConfigs": [],
|
||||
"name": program.name,
|
||||
"createIndex": null,
|
||||
"created": null,
|
||||
"description": null,
|
||||
"externalId": null,
|
||||
"healthState": null,
|
||||
"kind": null,
|
||||
"removed": null,
|
||||
"selectorContainer": null,
|
||||
"selectorLink": null,
|
||||
"uuid": null,
|
||||
"vip": null,
|
||||
"fqdn": null
|
||||
};
|
||||
|
||||
var createService = await asyncRequest({
|
||||
url: `${program.server}/v2-beta/projects/${environmentId}/service`,
|
||||
method: 'POST',
|
||||
json: true,
|
||||
headers: {
|
||||
"content-type": "application/json",
|
||||
"accept": "application/json",
|
||||
"Authorization": auth
|
||||
},
|
||||
body: postData,
|
||||
}).catch((error) => {
|
||||
console.log(error)
|
||||
});
|
||||
|
||||
if (!createService) {
|
||||
return;
|
||||
}
|
||||
|
||||
console.log("New environment ID " + createService.id);
|
||||
|
||||
var loadBalancer = await asyncRequest({
|
||||
url: `${program.server}/v1/projects/${environmentId}/loadbalancerservices`,
|
||||
method: 'GET',
|
||||
json: true,
|
||||
headers: {
|
||||
"content-type": "application/json",
|
||||
"accept": "application/json",
|
||||
"Authorization": auth
|
||||
},
|
||||
body: postData,
|
||||
}).catch((error) => {
|
||||
console.log(error)
|
||||
});
|
||||
|
||||
if (!loadBalancer) {
|
||||
return;
|
||||
}
|
||||
|
||||
var loadBalancerId = loadBalancer.data[0].id;
|
||||
console.log("Load balancer ID " + loadBalancerId);
|
||||
|
||||
var loadBalancerGet = await asyncRequest({
|
||||
url: `${program.server}/v2-beta/projects/${environmentId}/loadbalancerservices/${loadBalancerId}`,
|
||||
method: 'GET',
|
||||
json: true,
|
||||
headers: {
|
||||
"content-type": "application/json",
|
||||
"accept": "application/json",
|
||||
"Authorization": auth
|
||||
}
|
||||
}).catch((error) => {
|
||||
console.log(error)
|
||||
});
|
||||
|
||||
//console.log("Load balancer ID " + JSON.stringify(loadBalancerGet.lbConfig.portRules));
|
||||
|
||||
var newRule = {
|
||||
"type": "portRule",
|
||||
"hostname": program.remote,
|
||||
"path": `/${program.name}`,
|
||||
"priority": 1,
|
||||
"protocol": "http",
|
||||
"serviceId": createService.id,
|
||||
"sourcePort": 80,
|
||||
"targetPort": 80
|
||||
};
|
||||
|
||||
loadBalancerGet.lbConfig.portRules.push(newRule);
|
||||
|
||||
var loadBalancerUpdate = await asyncRequest({
|
||||
url: `${program.server}/v2-beta/projects/${environmentId}/loadbalancerservices/${loadBalancerId}`,
|
||||
method: 'PUT',
|
||||
json: true,
|
||||
headers: {
|
||||
"content-type": "application/json",
|
||||
"accept": "application/json",
|
||||
"Authorization": auth
|
||||
},
|
||||
body: loadBalancerGet
|
||||
}).catch((error) => {
|
||||
console.log(error)
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
main();
|
51
scripts/pr-publish.sh
Executable file
51
scripts/pr-publish.sh
Executable file
@@ -0,0 +1,51 @@
|
||||
#!/usr/bin/env bash
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
|
||||
show_help() {
|
||||
echo "Usage: pr-publish.sh"
|
||||
echo ""
|
||||
echo "-n or --name pr name"
|
||||
echo "-r or --repo docker repository url"
|
||||
}
|
||||
|
||||
name_pr(){
|
||||
NAME_PR=$1
|
||||
}
|
||||
|
||||
name_docker_repo(){
|
||||
DOCKER_REPO=$1
|
||||
}
|
||||
|
||||
username_docker_repo(){
|
||||
USERNAME_DOCKER=$1
|
||||
}
|
||||
|
||||
password_docker_repo(){
|
||||
PASSWORD_DOCKER=$1
|
||||
}
|
||||
|
||||
while [[ $1 == -* ]]; do
|
||||
case "$1" in
|
||||
-h|--help|-\?) show_help; exit 0;;
|
||||
-n|--name) name_pr $2; shift 2;;
|
||||
-r|--repo) name_docker_repo $2; shift 2;;
|
||||
-u|--username) username_docker_repo $2; shift 2;;
|
||||
-p|--password) password_docker_repo $2; shift 2;;
|
||||
-*) echo "invalid option: $1" 1>&2; show_help; exit 0;;
|
||||
esac
|
||||
done
|
||||
|
||||
cd $DIR/..
|
||||
|
||||
echo "====== PUBLISH DOCKER IMAGE TAG pr $NAME_PR ====="
|
||||
|
||||
docker build -t $DOCKER_REPO/adf/demo-shell:$NAME_PR .
|
||||
|
||||
echo "====== LOGIN ====="
|
||||
docker login http://$DOCKER_REPO -p $PASSWORD_DOCKER -u $USERNAME_DOCKER
|
||||
docker push "$DOCKER_REPO/adf/demo-shell:$NAME_PR"
|
||||
|
||||
|
||||
|
||||
|
0
scripts/pr-undeploy.sh
Normal file
0
scripts/pr-undeploy.sh
Normal file
@@ -2,6 +2,26 @@
|
||||
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
eval NAME=
|
||||
|
||||
show_help() {
|
||||
echo "Usage: test-dist.sh"
|
||||
echo ""
|
||||
echo "-n or --name pr name"
|
||||
}
|
||||
|
||||
name(){
|
||||
NAME="/$1"
|
||||
}
|
||||
|
||||
while [[ $1 == -* ]]; do
|
||||
case "$1" in
|
||||
-h|--help|-\?) show_help; exit 0;;
|
||||
-n|--name) name $2; shift 2;;
|
||||
-*) echo "invalid option: $1" 1>&2; show_help; exit 0;;
|
||||
esac
|
||||
done
|
||||
|
||||
echo "====== Install lib ===== "
|
||||
|
||||
cd $DIR/../
|
||||
@@ -13,7 +33,7 @@ npm install alfresco-js-api@alpha
|
||||
|
||||
echo "====== Build ADF ===== "
|
||||
|
||||
npm run build-lib
|
||||
npm run build-lib || exit 1
|
||||
|
||||
echo "====== COPY new build in node_modules ===== "
|
||||
|
||||
@@ -31,8 +51,9 @@ cp -R $DIR/../lib/dist/insights/* $DIR/../node_modules/@alfresco/adf-insights
|
||||
|
||||
echo "====== Build dist demo shell ===== "
|
||||
|
||||
npm run build:dist
|
||||
npm run server-versions
|
||||
ng build --prod --app dist --base-href=$NAME/ -op demo-shell/dist/$NAME || exit 1
|
||||
|
||||
echo "====== e2e test ===== "
|
||||
|
||||
npm run e2e
|
||||
npm run e2e || exit 1
|
||||
|
61
scripts/update-project.sh
Normal file
61
scripts/update-project.sh
Normal file
@@ -0,0 +1,61 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
eval GNU=false
|
||||
|
||||
set -e
|
||||
TEMP_GENERATOR_DIR=".tmp-generator";
|
||||
VERSION=$(npm view @alfresco/adf-core@beta version)
|
||||
|
||||
show_help() {
|
||||
echo "Usage: update-generator.sh"
|
||||
echo ""
|
||||
echo "-t or --token Github ouath token"
|
||||
echo "-n or --name Github name of the project"
|
||||
echo "-gnu for gnu"
|
||||
}
|
||||
|
||||
gnu_mode() {
|
||||
echo "====== GNU MODE ====="
|
||||
GNU=true
|
||||
}
|
||||
|
||||
token() {
|
||||
TOKEN=$1
|
||||
}
|
||||
|
||||
name_repo() {
|
||||
NAME_REPO=$1
|
||||
}
|
||||
|
||||
while [[ $1 == -* ]]; do
|
||||
case "$1" in
|
||||
-h|--help|-\?) show_help; exit 0;;
|
||||
-n|--name|-\?) name_repo $2; shift 2;;
|
||||
-gnu) gnu_mode; shift;;
|
||||
-t|--token) token $2; shift 2;;
|
||||
-*) echo "invalid option: $1" 1>&2; show_help; exit 1;;
|
||||
esac
|
||||
done
|
||||
|
||||
rm -rf $TEMP_GENERATOR_DIR;
|
||||
|
||||
git clone https://$TOKEN@github.com/Alfresco/$NAME_REPO.git $TEMP_GENERATOR_DIR
|
||||
cd $TEMP_GENERATOR_DIR
|
||||
git checkout development
|
||||
|
||||
BRANCH="generator-update-beta-$VERSION"
|
||||
git checkout -b $BRANCH
|
||||
|
||||
if $GNU; then
|
||||
./scripts/update-version.sh -gnu -v $VERSION
|
||||
else
|
||||
./scripts/update-version.sh -v $VERSION
|
||||
fi
|
||||
|
||||
git add .
|
||||
git commit -m "Update ADF packages version $VERSION"
|
||||
git push -u origin $BRANCH
|
||||
|
||||
curl -H "Authorization: token $TOKEN" -X POST -d '{"body":"Update ADF packages version '$VERSION'","head":"'$BRANCH'","base":"development","title":"Update ADF packages version '$VERSION'"}' https://api.github.com/repos/alfresco/$NAME_REPO/pulls
|
||||
|
||||
rm -rf $TEMP_GENERATOR_DIR;
|
Reference in New Issue
Block a user