diff --git a/.travis.yml b/.travis.yml index 4a6e03fa8..e9d632e70 100644 --- a/.travis.yml +++ b/.travis.yml @@ -116,7 +116,7 @@ jobs: - pip install mkdocs before_script: skip script: - - if [[ ($TRAVIS_BRANCH == develop) && ($TRAVIS_PULL_REQUEST == false) ]]; then bash trigger-travis.sh $TRAVIS_ACCESS_TOKEN; fi + - if [[ ($TRAVIS_BRANCH == develop) && ($TRAVIS_PULL_REQUEST == false) ]]; then bash .travis/trigger_travis.sh $TRAVIS_ACCESS_TOKEN; fi - if [[ ! $TRAVIS_TAG ]]; then bash .travis/push_release_version.sh; fi - bash .travis/build_docs.sh - bash .travis/push_docs_to_gh_pages.sh @@ -134,5 +134,3 @@ jobs: on: repo: ${UTPLSQL_REPO} tags: true - # when building from a release tag, use only first job "#xxx.1" to publish artifacts - condition: "${TRAVIS_JOB_NUMBER} =~ \\.1$" diff --git a/.travis/push_docs_to_gh_pages.sh b/.travis/push_docs_to_gh_pages.sh index 86ee00310..d2c5a685c 100644 --- a/.travis/push_docs_to_gh_pages.sh +++ b/.travis/push_docs_to_gh_pages.sh @@ -17,87 +17,85 @@ PAGES_TARGET_BRANCH="gh-pages" LATEST_DOCS_BRANCH="develop" # TRAVIS_* variables are set by travis directly and only need to be if testing externally -# Since we are running job matrix, only thie first job slave will need to do the work -if [[ "${TRAVIS_JOB_NUMBER}" =~ \.1$ ]]; then - # We don't want a pull request automatically updating the repository - if [ "$TRAVIS_PULL_REQUEST" == "false" ] && { [ "${CURRENT_BRANCH}" == "${LATEST_DOCS_BRANCH}" ] || [ -n "${TRAVIS_TAG}" ]; }; then +# We don't want a pull request automatically updating the repository +if [ "$TRAVIS_PULL_REQUEST" == "false" ] && { [ "${CURRENT_BRANCH}" == "${LATEST_DOCS_BRANCH}" ] || [ -n "${TRAVIS_TAG}" ]; }; then - # ENV Variable checks are to help with configuration troubleshooting, they silently exit with unique message. - # Anyone one of them not set can be used to turn off this functionality. + # ENV Variable checks are to help with configuration troubleshooting, they silently exit with unique message. + # Anyone one of them not set can be used to turn off this functionality. - # If a version of the project is not defined - [[ -n "${UTPLSQL_VERSION}" ]] || { echo "variable UTPLSQL_VERSION is not defines or missing value"; exit 0; } - # Fail if the markdown documentation is not present. - [[ -f ./docs/index.md ]] || { echo "file docs/index.md not found"; exit 1; } + # If a version of the project is not defined + [[ -n "${UTPLSQL_VERSION}" ]] || { echo "variable UTPLSQL_VERSION is not defines or missing value"; exit 0; } + # Fail if the markdown documentation is not present. + [[ -f ./docs/index.md ]] || { echo "file docs/index.md not found"; exit 1; } - # Save some useful information - SHA=`git rev-parse --verify HEAD` + # Save some useful information + SHA=`git rev-parse --verify HEAD` - # clone the repository and switch to PAGES_TARGET_BRANCH branch - mkdir pages - cd pages - git clone https://${github_api_token}@github.com/${UTPLSQL_REPO} . + # clone the repository and switch to PAGES_TARGET_BRANCH branch + mkdir pages + cd pages + git clone https://${github_api_token}@github.com/${UTPLSQL_REPO} . - PAGES_BRANCH_EXISTS=$(git ls-remote --heads origin ${PAGES_TARGET_BRANCH}) + PAGES_BRANCH_EXISTS=$(git ls-remote --heads origin ${PAGES_TARGET_BRANCH}) - if [ -n "$PAGES_BRANCH_EXISTS" ] ; then - echo "Pages Branch Found" - git checkout ${PAGES_TARGET_BRANCH} - else - echo "Creating Pages Branch" - git checkout --orphan ${PAGES_TARGET_BRANCH} - git rm -rf . - fi - #clear out develop documentation directory and copy docs contents to it. - echo "updating 'develop' directory" - mkdir -p develop - rm -rf develop/**./* || exit 0 - cp -a ../docs/. ./develop - # If a Tagged Build then copy to it's own directory as well and to the 'latest' release directory - if [ -n "$TRAVIS_TAG" ]; then - echo "Creating ${UTPLSQL_VERSION}" - mkdir -p ${UTPLSQL_VERSION} - rm -rf ${UTPLSQL_VERSION}/**./* || exit 0 - cp -a ../docs/. ${UTPLSQL_VERSION} - echo "Populating 'latest' directory" - mkdir -p latest - rm -rf latest/**./* || exit 0 - cp -a ../docs/. latest - fi - # Stage changes for commit - git add . - #Check if there are doc changes, if none exit the script - if [[ -z `git diff HEAD --exit-code` ]] && [ -n "${PAGES_BRANCH_EXISTS}" ] ; then - echo "No changes to docs detected." - exit 0 - fi - #Changes where detected, so we need to update the version log. - now=$(date +"%d %b %Y - %r") - if [ ! -f index.md ]; then - echo "---" >>index.md - echo "layout: default" >>index.md - echo "---" >>index.md - echo "" >>index.md - echo "# Documentation versions" >>index.md - echo "" >>index.md - echo "" >>index.md #- 7th line - placeholder for latest release doc - echo "" >>index.md #- 8th line - placeholder for develop branch doc - echo "" >>index.md - echo "## Released Version Doc History" >>index.md - echo "" >>index.md - fi - #If build running on a TAG - it's a new release - need to add it to documentation - if [ -n "${TRAVIS_TAG}" ]; then - sed -i '7s@.*@'" - [Latest ${TRAVIS_TAG} documentation](latest/) - Created $now"'@' index.md - #add entry to the top of version history (line end of file - ## Released Version Doc History - sed -i '12i'" - [${TRAVIS_TAG} documentation](${UTPLSQL_VERSION}/) - Created $now" index.md - fi - #replace 4th line in log - sed -i '8s@.*@'" - [Latest development version](develop/) - Created $now"'@' index.md - #Add and Commit the changes back to pages repo. - git add . - git commit -m "Deploy to gh-pages branch: base commit ${SHA}" - # Now that we're all set up, we can push. - git push --quiet origin HEAD:${PAGES_TARGET_BRANCH} + if [ -n "$PAGES_BRANCH_EXISTS" ] ; then + echo "Pages Branch Found" + git checkout ${PAGES_TARGET_BRANCH} + else + echo "Creating Pages Branch" + git checkout --orphan ${PAGES_TARGET_BRANCH} + git rm -rf . fi + #clear out develop documentation directory and copy docs contents to it. + echo "updating 'develop' directory" + mkdir -p develop + rm -rf develop/**./* || exit 0 + cp -a ../docs/. ./develop + # If a Tagged Build then copy to it's own directory as well and to the 'latest' release directory + if [ -n "$TRAVIS_TAG" ]; then + echo "Creating ${UTPLSQL_VERSION}" + mkdir -p ${UTPLSQL_VERSION} + rm -rf ${UTPLSQL_VERSION}/**./* || exit 0 + cp -a ../docs/. ${UTPLSQL_VERSION} + echo "Populating 'latest' directory" + mkdir -p latest + rm -rf latest/**./* || exit 0 + cp -a ../docs/. latest + fi + # Stage changes for commit + git add . + #Check if there are doc changes, if none exit the script + if [[ -z `git diff HEAD --exit-code` ]] && [ -n "${PAGES_BRANCH_EXISTS}" ] ; then + echo "No changes to docs detected." + exit 0 + fi + #Changes where detected, so we need to update the version log. + now=$(date +"%d %b %Y - %r") + if [ ! -f index.md ]; then + echo "---" >>index.md + echo "layout: default" >>index.md + echo "---" >>index.md + echo "" >>index.md + echo "# Documentation versions" >>index.md + echo "" >>index.md + echo "" >>index.md #- 7th line - placeholder for latest release doc + echo "" >>index.md #- 8th line - placeholder for develop branch doc + echo "" >>index.md + echo "## Released Version Doc History" >>index.md + echo "" >>index.md + fi + #If build running on a TAG - it's a new release - need to add it to documentation + if [ -n "${TRAVIS_TAG}" ]; then + sed -i '7s@.*@'" - [Latest ${TRAVIS_TAG} documentation](latest/) - Created $now"'@' index.md + #add entry to the top of version history (line end of file - ## Released Version Doc History + sed -i '12i'" - [${TRAVIS_TAG} documentation](${UTPLSQL_VERSION}/) - Created $now" index.md + fi + #replace 4th line in log + sed -i '8s@.*@'" - [Latest development version](develop/) - Created $now"'@' index.md + #Add and Commit the changes back to pages repo. + git add . + git commit -m "Deploy to gh-pages branch: base commit ${SHA}" + # Now that we're all set up, we can push. + git push --quiet origin HEAD:${PAGES_TARGET_BRANCH} fi + diff --git a/.travis/push_release_version.sh b/.travis/push_release_version.sh index d0288f418..43ca773d8 100644 --- a/.travis/push_release_version.sh +++ b/.travis/push_release_version.sh @@ -5,19 +5,13 @@ # - branch name is = develop or branch name is like release/vX.X.X... if [ "${TRAVIS_REPO_SLUG}" = "${UTPLSQL_REPO}" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ] && [[ "${CURRENT_BRANCH}" =~ ^(release/v[0-9]+\.[0-9]+\.[0-9]+.*|develop)$ ]]; then echo Current branch is "${CURRENT_BRANCH}" - echo Current job number is "${TRAVIS_JOB_NUMBER}" - #The publishing is done only once (for first job on a build matrix) - if [[ "${TRAVIS_JOB_NUMBER}" =~ \.1$ ]]; then - echo "Committing version & buildNo into branch (${CURRENT_BRANCH})" - git add sonar-project.properties - git add VERSION - git add source/* - git commit -m 'Updated project version after build [skip ci]' - echo "Pushing to origin" - git push --quiet origin HEAD:${CURRENT_BRANCH} - else - echo "Publishing of version skipped for job No.: ${TRAVIS_JOB_NUMBER}" - fi + echo "Committing version & buildNo into branch (${CURRENT_BRANCH})" + git add sonar-project.properties + git add VERSION + git add source/* + git commit -m 'Updated project version after build [skip ci]' + echo "Pushing to origin" + git push --quiet origin HEAD:${CURRENT_BRANCH} else echo "Publishing of version skipped for branch ${CURRENT_BRANCH}, pull request ${TRAVIS_PULL_REQUEST}" fi diff --git a/.travis/trigger_travis.sh b/.travis/trigger_travis.sh index c7b9a7071..039b00bbb 100644 --- a/.travis/trigger_travis.sh +++ b/.travis/trigger_travis.sh @@ -19,7 +19,7 @@ TRAVIS_URL=travis-ci.org BRANCH=develop USER="utPLSQL" RESULT=1 -declare -a REPO_MATRIX=("utPLSQL-java-api" "utPLSQL-v2-v3-migration" "utPLSQL-cli") +declare -a REPO_MATRIX=("utPLSQL-java-api" "utPLSQL-v2-v3-migration" "utPLSQL-cli" "utPLSQL-maven-plugin" "utPLSQL-demo-project") TOKEN=$1 @@ -29,9 +29,8 @@ else MESSAGE=",\"message\": \"Triggered manually from shell\"" fi -## For debugging: -# echo "TOKEN=$TOKEN" -# echo "MESSAGE=$MESSAGE" +# For debugging: +#echo "MESSAGE=$MESSAGE" body="{ \"request\": { @@ -53,13 +52,13 @@ for DOWNSTREAM_BUILD in "${REPO_MATRIX[@]}"; do if grep -q '"@type": "error"' ${DOWNSTREAM_BUILD}-output.txt; then RESULT=0 echoerr "" - echoerr "Failed to start ${DOWNSTREAM_BUILD}" + echoerr "ERROR: Failed to start ${DOWNSTREAM_BUILD}" echoerr "" fi if grep -q 'access denied' ${DOWNSTREAM_BUILD}-output.txt; then RESULT=0 echoerr "" - echoerr "Failed to start ${DOWNSTREAM_BUILD}" + echoerr "ERROR: Failed to start ${DOWNSTREAM_BUILD} - access denied" echoerr "" fi