release update commands pipeline

This commit is contained in:
Eugenio Romano 2019-08-29 12:01:49 +01:00
parent cdfae95c2a
commit 43df299096
12 changed files with 39 additions and 456 deletions

View File

@ -33,10 +33,9 @@ stages:
- name: Check bundle
if: type = push
- name: e2e Test
- name: Deploy PR
- name: Update Rancher PR
if: type = pull_request
addons:
chrome: stable
before_script:
@ -58,6 +57,8 @@ jobs:
- stage: Lint & Build Dist
name: Lint
script: ./scripts/lint.sh || exit 1;
- stage: Unit test
name: Unit test content
script: ./scripts/travis/unit-test/content.sh
@ -67,45 +68,48 @@ jobs:
- stage: Unit test
name: Unit test process process-cloud insights
script: ./scripts/travis/unit-test/process.sh
- stage: Deploy PR
name: Deploy PR
script:
./scripts/travis/deploy/deploy.sh
- stage: Update children projects dependency #Update children projects dependency
name: Update Related Project
if: tag =~ .*beta.*
script: ./scripts/travis/update/update-children.sh
- stage: e2e Test
name: core
script: ./scripts/travis/e2e/core-e2e.sh
- stage: e2e Test
name: content
script:
./scripts/travis/e2e/content-services-e2e.sh
script: ./scripts/travis/e2e/content-services-e2e.sh
- stage: e2e Test
name: search
script:
./scripts/travis/e2e/search-e2e.sh
script: ./scripts/travis/e2e/search-e2e.sh
- stage: e2e Test
name: process
script:
./scripts/travis/e2e/process-services-e2e.sh
script: ./scripts/travis/e2e/process-services-e2e.sh
- stage: e2e Test
name: process Cloud
script:
./scripts/travis/e2e/process-services-cloud-e2e.sh
script: ./scripts/travis/e2e/process-services-cloud-e2e.sh
- stage: Release on npm
script:
./scripts/travis/release/release.sh
script: ./scripts/travis/release/release.sh
- stage: Check bundle
script:
- ADF_VERSION=$(npm view @alfresco/adf-core@${TAG_NPM} version)
- ./scripts/npm-check-bundles.sh -v ${ADF_VERSION}
- stage: Deploy docker
script:
- TAG_VERSION=$(./scripts/travis/deploy/tag-travis-branch.sh)
- echo "Running the docker with tag" $TAG_VERSION
- ./lib/dist/cli/bin/adf-cli docker-publish --loginCheck --loginUsername "$DOCKER_REPOSITORY_USER" --loginPassword "$DOCKER_REPOSITORY_PASSWORD" --loginRepo "$DOCKER_REPOSITORY_DOMAIN" --dockerRepo "$DOCKER_REPOSITORY" --dockerTags "$TAG_VERSION" --pathProject "$(pwd)"
- stage: Update Rancher
script:
- TAG_VERSION=$(./scripts/travis/deploy/tag-travis-branch.sh)
@ -113,6 +117,11 @@ jobs:
- ./scripts/rancher-update.sh --access_key $RANCHER_TOKEN --secret_key $RANCHER_SECRET --url $REPO_RANCHER --environment_name $REPO_RANCHER_ADF_NAME --image docker:$DOCKER_REPOSITORY:$TAG_VERSION
- stage: Update Rancher PR
name: Update Rancher PR
script: ./scripts/travis/deploy/deploy.sh
before_deploy:
# Set up git user name and tag this commit
- git config --local user.name "Alfresco"

View File

@ -1,63 +0,0 @@
# Test against this version of Node.js
branches:
only:
- master
- development
- dev-build-test
environment:
nodejs_version: "8"
matrix:
- COMPONENT_NAME: process-service
- COMPONENT_NAME: content-service
- COMPONENT_NAME: core
- COMPONENT_NAME: insights
# - COMPONENT_NAME: ng2-demo-shell
# Install scripts. (runs after repo cloning)
install:
# Get the latest stable version of Node.js or io.js
- ps: Install-Product node $env:nodejs_version
# install module
- if %COMPONENT_NAME% EQU process-service (
if %APPVEYOR_REPO_BRANCH EQU master
(cd scripts && sh npm-build-all.sh -t "process-services" || exit 1)
else
(cd scripts && sh npm-build-all.sh -t "process-services" -vjsapi alpha|| exit 1)
)
- if %COMPONENT_NAME% EQU content-service (
if %APPVEYOR_REPO_BRANCH EQU master
(cd scripts && sh npm-build-all.sh -t "content-services" || exit 1)
else
(cd scripts && sh npm-build-all.sh -t "content-services" -vjsapi alpha|| exit 1)
)
- if %COMPONENT_NAME% EQU insights (
if %APPVEYOR_REPO_BRANCH EQU master
(cd scripts && sh npm-build-all.sh -t "insights" || exit 1)
else
(cd scripts && sh npm-build-all.sh -t "insights" -vjsapi alpha|| exit 1)
)
- if %COMPONENT_NAME% EQU core (
if %APPVEYOR_REPO_BRANCH EQU master
(cd scripts && sh npm-build-all.sh -t "core" || exit 1)
else
(cd scripts && sh npm-build-all.sh -t "core" -vjsapi alpha|| exit 1)
)
- if %COMPONENT_NAME% EQU process-service-cloud (
if %APPVEYOR_REPO_BRANCH EQU master
(cd scripts && sh npm-build-all.sh -t "process-services-cloud" || exit 1)
else
(cd scripts && sh npm-build-all.sh -t "process-services-cloud" -vjsapi alpha|| exit 1)
)
# - if %COMPONENT_NAME% EQU ng2-demo-shell (
# if %APPVEYOR_REPO_BRANCH EQU master
# (cd scripts && sh start.sh -t -ss || exit 1)
# else
# (cd scripts && sh start.sh -dev -t -ss -vjsapi alpha || exit 1)
# )
# Don't actually build.
build: off
matrix:
fast_finish: true

View File

@ -114,24 +114,3 @@ Run command locally
```bash
adf-cli update-commit-sha --pathProject "$(pwd)" --skipGnu
```
### npm publish
This command allows you to publish your lib on the npm.
```bash
adf-cli npm-publish --pathProject "$(pwd)"
```
You can use the option --npmRegistry "localhost:4873" to chose a different registry and --tokenRegistry "VALID_TOKEN" to pass the token.
```bash
adf-cli update-commit-sha --npmRegistry "localhost:4873" --tokenRegistry "VALID_TOKEN" --pathProject "$(pwd)"
```
In case you want to add a tag you can use the option --tag "alpha|beta|latest" .
```bash
adf-cli update-commit-sha --tag "beta" --pathProject "$(pwd)"
```

View File

@ -18,3 +18,6 @@ if grep "envalfresco" . -R --exclude-dir={node_modules,.history,.idea,scripts,di
echo not permitted word
exit 1
fi
echo "====== License Check ====="
npm run license-checker || exit 1

View File

@ -1,26 +0,0 @@
storage: ./.verdaccio_test_env/test-storage
uplinks:
npmjs:
url: https://registry.npmjs.org/
auth:
auth-memory:
users:
test:
name: test
password: test
logs:
- {type: stdout, format: pretty, level: trace}
packages:
'@*/*':
# scoped packages
access: $all
publish: $anonymous
proxy: npmjs
'**':
access: $all
publish: $anonymous
proxy: npmjs

View File

@ -1,23 +0,0 @@
#!/usr/bin/env bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
npm set registry https://registry.npmjs.org/
echo "====== Install verdaccio ===== "
npm install -g verdaccio
npm install -g concurrently
npm install -g verdaccio-auth-memory
echo "====== Update version ===== "
$DIR/update-version.sh -nextbeta -components
echo "====== Change registry ===== "
npm set registry http://localhost:4873/
echo "====== Run verdaccio ===== "
concurrently "verdaccio --listen 4873 --config $DIR/config/config-verdaccio.yaml" "$DIR/npm-publish.sh --sleep 20 -f"

View File

@ -2,15 +2,8 @@
set -f
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
eval RUN_TEST=false
eval RUN_TESTBROWSER=false
eval EXEC_CLEAN=false
eval EXEC_BUILD=true
eval EXEC_INSTALL=true
eval EXEC_SINGLE_TEST=false
eval EXEC_GIT_NPM_INSTALL_JSAPI=false
eval GIT_ISH=""
eval SINGLE_TEST=""
eval EXEC_VERSION_JSAPI=false
eval JSAPI_VERSION=""
@ -25,45 +18,10 @@ eval projects=( "core"
show_help() {
echo "Usage: npm-build-all.sh"
echo ""
echo "-t or --test <pkg> Build your local components and run their tests, this parameter also accept a wildecard to execute test e.g: -t "core"."
echo "-d or --debug <pkg> Build your local components and run their tests IN THE BROWSER, this parameter also accept a wildecard to execute test e.g: -t "core"."
echo "-c or --clean Clean the node_modules before starting the build."
echo "-si or --skipinstall Skip the install of node_modules before starting the build."
echo "-sb or --skipbuild Skip the build of ng-components."
echo "-gitjsapi <commit-ish> Build all the components against a commit-ish version of the JS-API"
echo "-vjsapi <commit-ish> Install different version from npm of JS-API defined in the package.json"
}
enable_test(){
if [[ ! -z $1 ]]; then
if [[ $1 != "-"* ]]; then
EXEC_SINGLE_TEST=true
SINGLE_TEST=$1
fi
fi
RUN_TEST=true
}
enable_testbrowser(){
if [[ ! -z $1 ]]; then
if [[ $1 != "-"* ]]; then
EXEC_SINGLE_TEST=true
SINGLE_TEST=$1
fi
fi
RUN_TESTBROWSER=true
}
test_project() {
echo "====== test project: $1 ====="
ng test $1 --watch=false || exit 1
}
debug_project() {
echo "====== debug project: $1 ====="
ng test $1 || exit 1
}
enable_js_api_git_link() {
GIT_ISH='git://github.com/Alfresco/alfresco-js-api.git#'$1
EXEC_GIT_NPM_INSTALL_JSAPI=true
@ -81,14 +39,6 @@ version_js_api() {
EXEC_VERSION_JSAPI=true
}
clean() {
EXEC_CLEAN=true
}
exclude_build(){
EXEC_BUILD=false
}
exec_install(){
EXEC_INSTALL=false
}
@ -96,35 +46,14 @@ exec_install(){
while [[ $1 == -* ]]; do
case "$1" in
-h|--help|-\?) show_help; exit 0;;
-t|--test) enable_test $2;
shift;
if $EXEC_SINGLE_TEST == true; then
shift;
fi
;;
-d|--debug) enable_testbrowser $2; shift; if $EXEC_SINGLE_TEST == true; then shift; fi ;;
-gitjsapi) enable_js_api_git_link $2; shift 2;;
-vjsapi) version_js_api $2; shift 2;;
-c|--clean) clean; shift;;
-si|--skipinstall) exec_install; shift;;
-sb|--skipbuild) exclude_build; shift;;
-*) echo "invalid option: $1" 1>&2; show_help; exit 1;;
esac
done
cd "$DIR/../"
if $EXEC_CLEAN == true; then
echo "====== Clean components ====="
npm install rimraf -g
npm run clean
fi
if $EXEC_INSTALL == true; then
echo "====== Install components dependencies ====="
npm install
fi
if $EXEC_GIT_NPM_INSTALL_JSAPI == true; then
echo "====== Use the alfresco JS-API '$GIT_ISH'====="
npm install $GIT_ISH --no-save
@ -138,30 +67,5 @@ if $EXEC_VERSION_JSAPI == true; then
npm install alfresco-js-api@${JSAPI_VERSION} --no-save
fi
if $EXEC_BUILD == true; then
echo "====== Build components ====="
npm run build-lib || exit 1
fi
if $RUN_TEST == true; then
if $EXEC_SINGLE_TEST == true; then
test_project $SINGLE_TEST
else
for PACKAGE in ${projects[@]}
do
test_project $PACKAGE
done
fi
fi
if $RUN_TESTBROWSER == true; then
if $EXEC_SINGLE_TEST == true; then
debug_project $SINGLE_TEST
else
for PACKAGE in ${projects[@]}
do
debug_project $PACKAGE
done
fi
fi
echo "====== Build components ====="
npm run build-lib || exit 1

View File

@ -1,182 +0,0 @@
#!/usr/bin/env bash
set -e
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
eval FORCE_PUBLISH=false
eval EXEC_CHANGE_REGISTRY=false
eval NPM_REGISTRY=false
eval TOKEN_REGISTRY=""
eval OPTIONS=""
eval EXEC_GIT_NPM_INSTALL_JSAPI=false
eval GIT_ISH=""
eval EXEC_SLEEP=false
eval SLEEP_TIME="0"
eval EXEC_VERSION_JSAPI=false
eval JSAPI_VERSION=""
eval EXEC_BUILD=true
eval projects=(
"cli"
"core"
"insights"
"testing"
"content-services"
"process-services"
"process-services-cloud"
"extensions" )
cd "$DIR/../"
show_help() {
echo "Usage: npm-publish.sh"
echo ""
echo "-f or --force publish the package with force"
echo "-r or --registry to publish in an alternative npm registry -registry 'http://npm.local.me:8080/' "
echo "-token auth token for publish in the npm registry"
echo "-t or --tag to add a tag when publish a package"
echo "-sb skip build"
echo "--sleep add a sleep before any publish"
echo "-gitjsapi to build all the components against a commit-ish version of the JS-API"
echo "-vjsapi <commit-ish> Install different version from npm of JS-API defined in the package.json"
}
enable_force(){
OPTIONS="$OPTIONS -force"
}
enable_change_registry(){
NPM_REGISTRY=$1
EXEC_CHANGE_REGISTRY=true
}
set_sleep(){
SLEEP_TIME=$1
EXEC_SLEEP=true
}
skip_build(){
EXEC_BUILD=false
}
get_token_registry(){
TOKEN_REGISTRY=$1
if [[ "${TOKEN_REGISTRY}" == "" ]]
then
echo "token missing -token"
exit 0
fi
}
enable_js_api_git_link() {
GIT_ISH='git://github.com/Alfresco/alfresco-js-api.git#'$1
EXEC_GIT_NPM_INSTALL_JSAPI=true
}
add_tag(){
eval TAG=$1
if [[ "${TAG}" == "" ]]
then
echo "tag missing -t | -tag"
exit 0
fi
echo "====== TAG WILL BE ADDED DURING THE PUBLISH: ${TAG} ====="
OPTIONS="$OPTIONS --tag $1"
}
version_js_api() {
JSAPI_VERSION=$1
if [[ "${JSAPI_VERSION}" == "" ]]
then
echo "JSAPI version required with -vJSApi"
exit 0
fi
EXEC_VERSION_JSAPI=true
}
change_registry(){
if [[ "${NPM_REGISTRY}" == "" ]]
then
echo "NPM registry required WITH OPTION -r | -registry"
exit 0
fi
echo "====== CHANGE REGISTRY: ${NPM_REGISTRY} ====="
touch .npmrc
echo 'strict-ssl=false' >> .npmrc
echo 'registry=http://'${NPM_REGISTRY} >> .npmrc
echo '//'${NPM_REGISTRY}'/:_authToken="'${TOKEN_REGISTRY}'"' >> .npmrc
}
while [[ $1 == -* ]]; do
case "$1" in
-h|--help|-\?) show_help; exit 0;;
-t|--tag) add_tag $2; shift 2;;
-f|--force) enable_force; shift;;
-token) get_token_registry $2; shift 2;;
--sleep) set_sleep $2; shift 2;;
-sb) skip_build; shift;;
-r|--registry) enable_change_registry $2; shift 2;;
-gitjsapi) enable_js_api_git_link $2; shift 2;;
-vjsapi) version_js_api $2; shift 2;;
-*) echo "invalid option: $1" 1>&2; show_help; exit 0;;
esac
done
node ./scripts/pre-publish.js
if $EXEC_BUILD == true; then
echo "====== INSTALL AND CLEAN ${PACKAGE} ===== "
npm install rimraf
npm run clean
npm install
fi
if $EXEC_GIT_NPM_INSTALL_JSAPI == true; then
echo "====== Use the alfresco JS-API '$GIT_ISH'====="
npm install $GIT_ISH
cd "${DESTDIR}/node_modules/alfresco-js-api"
npm install
cd ${DESTDIR}
fi
if $EXEC_VERSION_JSAPI == true; then
echo "====== Use the alfresco JS-API '$JSAPI_VERSION'====="
npm install alfresco-js-api@${JSAPI_VERSION} --no-save
fi
if $EXEC_BUILD == true; then
echo "====== Build ADF ===== "
npm run build-lib
fi
for PACKAGE in ${projects[@]}
do
DESTDIR="$DIR/../lib/dist/${PACKAGE}"
echo "====== MOVE DIR: ${DESTDIR} ===== "
cd ${DESTDIR}
if $EXEC_CHANGE_REGISTRY == true; then
change_registry
fi
echo "====== PUBLISHING: ${DESTDIR} ===== npm publish ${OPTIONS}"
npm publish ${OPTIONS} --access=public || exit 1
if $EXEC_CHANGE_REGISTRY == true; then
rm .npmrc
fi
if $EXEC_SLEEP == true; then
echo "====== SLEEP ${SLEEP_TIME}"
sleep ${SLEEP_TIME}
fi
cd ${DIR}
done

View File

@ -1,9 +0,0 @@
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
echo "====== Removing Alfresco dependencies from package.json ====="
grep -wirn '@alfresco\/adf*' $DIR/../package.json
sed -i 's/"@alfresco\/adf-[^,]*,//' $DIR/../package.json
sed -i '/^[[:space:]]*$/d' $DIR/../package.json
echo "====== Alfresco dependencies removed from package.json ====="

View File

@ -6,26 +6,28 @@ cd $DIR/../../../
rm -rf tmp && mkdir tmp;
./scripts/update-version.sh -gnu -alpha || exit 1;
if [[ $TRAVIS_PULL_REQUEST == "false" ]];
then
if [[ $TRAVIS_BRANCH == "development" ]];
then
./scripts/update-version.sh -gnu -alpha || exit 1;
#TODO remove when we are going to use the new about
./scripts/update-version.sh -gnu -nextalpha || exit 1;
fi
node ./scripts/pre-publish.js
npm install
./scripts/npm-build-all.sh || exit 1;
else
./scripts/update-version.sh -gnu -alpha || exit 1;
npm install @alfresco/adf-cli@alpha
./node_modules/@alfresco/adf-cli/bin/adf-cli update-version --alpha --pathPackage "$(pwd)"
npm install;
./scripts/lint.sh || exit 1;
./scripts/smart-build.sh -b $TRAVIS_BRANCH -gnu || exit 1;
fi;
echo "====== Build Demo shell dist ====="
npm run build:dist || exit 1;
echo "====== License Check ====="
npm run license-checker

View File

@ -4,12 +4,6 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd $DIR/../../../
#if [ "$TRAVIS_PULL_REQUEST" != "false" ];
#then
node ./scripts/travis/deploy/move-dist-folder.js --base-href $TRAVIS_BUILD_NUMBER && (./scripts/travis/deploy/pr-publish.sh -n $TRAVIS_BUILD_NUMBER -r $REPO_DOCKER -u $USERNAME_DOCKER -p $PASSWORD_DOCKER || exit 1);
#fi;
#if [ "$TRAVIS_PULL_REQUEST" != "false" ];
#then
(node --no-deprecation ./scripts/travis/deploy/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);
#fi;

View File

@ -4,9 +4,4 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd $DIR/../../../
if [[ $TRAVIS_BRANCH == "development" ]];
then
./scripts/update-version.sh -gnu -nextalpha || exit 1;
fi
./lib/dist/cli/bin/adf-cli npm-publish --npmRegistry $NPM_REGISTRY_ADDRESS --tokenRegistry $NPM_REGISTRY_TOKEN --tag $TAG_NPM --pathProject "$(pwd)"