mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ADF-4125] simplify extension load in extension module (#4214)
* add extension load in extension module * add viewer extensions * fix license header * fix node passed in the viewer extension * fix node passed in the viewer extension * startup factory extension * startup factory extension * fix script * fix beta tag build * fix build * fix build * refactoring configuration files * extension using map * fix build * fix config * fix test * fix test
This commit is contained in:
@@ -4,11 +4,18 @@ eval BRANCH_NAME=""
|
||||
eval HEAD_SHA_BRANCH=""
|
||||
eval SHA_2="HEAD"
|
||||
eval DIRECTORY="tmp"
|
||||
eval GNU=false
|
||||
|
||||
show_help() {
|
||||
echo "Usage: smart-build.sh"
|
||||
echo "Usage: affected-libs.sh"
|
||||
echo ""
|
||||
echo "-b branch name"
|
||||
echo "-gnu for gnu"
|
||||
}
|
||||
|
||||
gnu_mode() {
|
||||
echo "====== GNU MODE ====="
|
||||
GNU=true
|
||||
}
|
||||
|
||||
branch_name(){
|
||||
@@ -18,10 +25,18 @@ branch_name(){
|
||||
while [[ $1 == -* ]]; do
|
||||
case "$1" in
|
||||
-b) branch_name $2; shift 2;;
|
||||
-gnu) gnu_mode; shift;;
|
||||
-*) echo "invalid option: $1" 1>&2; show_help; exit 0;;
|
||||
esac
|
||||
done
|
||||
|
||||
if $GNU; then
|
||||
sedi='-i'
|
||||
else
|
||||
sedi=('-i' '')
|
||||
fi
|
||||
|
||||
|
||||
if [[ "$BRANCH_NAME" == "" ]]
|
||||
then
|
||||
echo "The branch name is mandatory"
|
||||
@@ -47,10 +62,10 @@ cat $DIRECTORY/deps.txt
|
||||
#echo "extensions" > deps.txt
|
||||
|
||||
#clean file
|
||||
sed -i '/^$/d' ./$DIRECTORY/deps.txt
|
||||
sed -i '/alfresco-components/d' ./$DIRECTORY/deps.txt
|
||||
sed -i '/nx affected:libs/d' ./$DIRECTORY/deps.txt
|
||||
sed -i '/^$/d' ./$DIRECTORY/deps.txt
|
||||
sed "${sedi[@]}" '/^$/d' ./$DIRECTORY/deps.txt
|
||||
sed "${sedi[@]}" '/alfresco-components/d' ./$DIRECTORY/deps.txt
|
||||
sed "${sedi[@]}" '/nx affected:libs/d' ./$DIRECTORY/deps.txt
|
||||
sed "${sedi[@]}" '/^$/d' ./$DIRECTORY/deps.txt
|
||||
|
||||
#read result from file
|
||||
while IFS= read -r var
|
||||
@@ -61,6 +76,14 @@ done < "./$DIRECTORY/deps.txt"
|
||||
#transform string to array
|
||||
libs=(`echo $fileLine | sed 's/^$/\n/g'`)
|
||||
|
||||
#extensions
|
||||
for i in "${libs[@]}"
|
||||
do
|
||||
if [ "$i" == "extensions" ] ; then
|
||||
AFFECTED_LIBS=$AFFECTED_LIBS" extensions$"
|
||||
fi
|
||||
done
|
||||
|
||||
#core
|
||||
for i in "${libs[@]}"
|
||||
do
|
||||
@@ -95,14 +118,6 @@ do
|
||||
fi
|
||||
done
|
||||
|
||||
#extensions
|
||||
for i in "${libs[@]}"
|
||||
do
|
||||
if [ "$i" == "extensions" ] ; then
|
||||
AFFECTED_LIBS=$AFFECTED_LIBS" extensions$"
|
||||
fi
|
||||
done
|
||||
|
||||
#process-services-cloud
|
||||
for i in "${libs[@]}"
|
||||
do
|
||||
@@ -111,4 +126,4 @@ do
|
||||
fi
|
||||
done
|
||||
|
||||
echo "${AFFECTED_LIBS}"
|
||||
echo "AFFECTED LIBS => ${AFFECTED_LIBS}"
|
||||
|
@@ -6,7 +6,7 @@ cd $DIR/..
|
||||
|
||||
echo "====== Extensions ======"
|
||||
echo "====== Build ======"
|
||||
ng build extensions || exit 1
|
||||
npm run ng-packagr -- -p ./lib/extensions/ || exit 1
|
||||
|
||||
echo "====== Move to node_modules ======"
|
||||
rm -rf ./node_modules/@alfresco/adf-extensions/ && \
|
||||
|
@@ -6,7 +6,7 @@ cd $DIR/..
|
||||
|
||||
echo "====== Process Services Cloud ======"
|
||||
echo "====== Build ======"
|
||||
ng build process-services-cloud || exit 1
|
||||
npm run ng-packagr -- -p ./lib/process-services-cloud/ || exit 1
|
||||
|
||||
echo "====== Build style ======"
|
||||
node ./lib/config/bundle-process-services-cloud-scss.js || exit 1
|
||||
|
@@ -3,24 +3,25 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
cd $DIR
|
||||
|
||||
echo "====== run lib ====="
|
||||
|
||||
echo "------ run core -----"
|
||||
./build-core.sh
|
||||
echo "====== Run lib ====="
|
||||
|
||||
echo "------ run content-services -----"
|
||||
./build-content-services.sh
|
||||
|
||||
echo "------ Build process-services -----"
|
||||
./build-process-services.sh
|
||||
|
||||
echo "------ run insights -----"
|
||||
./build-insights.sh
|
||||
|
||||
echo "------ run extensions -----"
|
||||
echo "====== Run extensions ====="
|
||||
./build-extensions.sh
|
||||
|
||||
echo "------ run process-services-cloud -----"
|
||||
echo "====== run core ====="
|
||||
./build-core.sh
|
||||
|
||||
echo "====== Run content-services ====="
|
||||
./build-content-services.sh
|
||||
|
||||
echo "====== Run process-services ====="
|
||||
./build-process-services.sh
|
||||
|
||||
echo "====== Run insights ====="
|
||||
./build-insights.sh
|
||||
|
||||
echo "====== Run process-services-cloud ====="
|
||||
./build-process-services-cloud.sh
|
||||
|
||||
echo "====== Copy schema ====="
|
||||
|
260
scripts/pr-reminder.js
Normal file
260
scripts/pr-reminder.js
Normal file
@@ -0,0 +1,260 @@
|
||||
var program = require('commander');
|
||||
var request = require('request');
|
||||
|
||||
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 {
|
||||
console.log("Error " + JSON.stringify(body));
|
||||
reject(error + JSON.stringify(body));
|
||||
throw "Error";
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
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('Project name error'+ error);
|
||||
});
|
||||
|
||||
var stacks = await asyncRequest({
|
||||
url: `${program.server}/v2-beta/projects/${project.data[0].id}/stacks?limit=-1&sort=name`,
|
||||
method: 'GET',
|
||||
json: true,
|
||||
headers: {
|
||||
"content-type": "application/json",
|
||||
"accept": "application/json",
|
||||
"Authorization": auth
|
||||
},
|
||||
body: ""
|
||||
}).catch((error) => {
|
||||
console.log('Stacks error'+ error);
|
||||
});
|
||||
|
||||
|
||||
var stackId = stacks.data[0].id;
|
||||
var environmentId = project.data[0].id;
|
||||
|
||||
console.log("StackId " + stackId);
|
||||
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 createService'+ 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 loadBalancer'+ 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 get load balancer'+ 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);
|
||||
|
||||
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 Update load balancer'+ error);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
main();
|
@@ -31,6 +31,14 @@ affected="$(./scripts/affected-libs.sh -b "$BRANCH_NAME")"
|
||||
echo $affected
|
||||
libs=(`echo $affected | sed 's/^$/\n/g'`)
|
||||
|
||||
#extensions
|
||||
for i in "${libs[@]}"
|
||||
do
|
||||
if [ "$i" == "extensions$" ] ; then
|
||||
./scripts/build-extensions.sh || exit 1;
|
||||
fi
|
||||
done
|
||||
|
||||
#core
|
||||
for i in "${libs[@]}"
|
||||
do
|
||||
@@ -70,11 +78,3 @@ do
|
||||
./scripts/build-insights.sh || exit 1;
|
||||
fi
|
||||
done
|
||||
|
||||
#extensions
|
||||
for i in "${libs[@]}"
|
||||
do
|
||||
if [ "$i" == "extensions$" ] ; then
|
||||
./scripts/build-extensions.sh || exit 1;
|
||||
fi
|
||||
done
|
||||
|
Reference in New Issue
Block a user