Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 31f3abf

Browse files
authored
Merge pull request #703 from utPLSQL/trigger_subbuilds
Trigger subbuilds
2 parents be15dc6 + a3db2a5 commit 31f3abf

4 files changed

Lines changed: 87 additions & 98 deletions

File tree

.travis.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ jobs:
116116
- pip install mkdocs
117117
before_script: skip
118118
script:
119-
- if [[ ($TRAVIS_BRANCH == develop) && ($TRAVIS_PULL_REQUEST == false) ]]; then bash trigger-travis.sh $TRAVIS_ACCESS_TOKEN; fi
119+
- if [[ ($TRAVIS_BRANCH == develop) && ($TRAVIS_PULL_REQUEST == false) ]]; then bash .travis/trigger_travis.sh $TRAVIS_ACCESS_TOKEN; fi
120120
- if [[ ! $TRAVIS_TAG ]]; then bash .travis/push_release_version.sh; fi
121121
- bash .travis/build_docs.sh
122122
- bash .travis/push_docs_to_gh_pages.sh
@@ -134,5 +134,3 @@ jobs:
134134
on:
135135
repo: ${UTPLSQL_REPO}
136136
tags: true
137-
# when building from a release tag, use only first job "#xxx.1" to publish artifacts
138-
condition: "${TRAVIS_JOB_NUMBER} =~ \\.1$"

.travis/push_docs_to_gh_pages.sh

Lines changed: 74 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -17,87 +17,85 @@ PAGES_TARGET_BRANCH="gh-pages"
1717
LATEST_DOCS_BRANCH="develop"
1818
# TRAVIS_* variables are set by travis directly and only need to be if testing externally
1919

20-
# Since we are running job matrix, only thie first job slave will need to do the work
21-
if [[ "${TRAVIS_JOB_NUMBER}" =~ \.1$ ]]; then
22-
# We don't want a pull request automatically updating the repository
23-
if [ "$TRAVIS_PULL_REQUEST" == "false" ] && { [ "${CURRENT_BRANCH}" == "${LATEST_DOCS_BRANCH}" ] || [ -n "${TRAVIS_TAG}" ]; }; then
20+
# We don't want a pull request automatically updating the repository
21+
if [ "$TRAVIS_PULL_REQUEST" == "false" ] && { [ "${CURRENT_BRANCH}" == "${LATEST_DOCS_BRANCH}" ] || [ -n "${TRAVIS_TAG}" ]; }; then
2422

25-
# ENV Variable checks are to help with configuration troubleshooting, they silently exit with unique message.
26-
# Anyone one of them not set can be used to turn off this functionality.
23+
# ENV Variable checks are to help with configuration troubleshooting, they silently exit with unique message.
24+
# Anyone one of them not set can be used to turn off this functionality.
2725

28-
# If a version of the project is not defined
29-
[[ -n "${UTPLSQL_VERSION}" ]] || { echo "variable UTPLSQL_VERSION is not defines or missing value"; exit 0; }
30-
# Fail if the markdown documentation is not present.
31-
[[ -f ./docs/index.md ]] || { echo "file docs/index.md not found"; exit 1; }
26+
# If a version of the project is not defined
27+
[[ -n "${UTPLSQL_VERSION}" ]] || { echo "variable UTPLSQL_VERSION is not defines or missing value"; exit 0; }
28+
# Fail if the markdown documentation is not present.
29+
[[ -f ./docs/index.md ]] || { echo "file docs/index.md not found"; exit 1; }
3230

33-
# Save some useful information
34-
SHA=`git rev-parse --verify HEAD`
31+
# Save some useful information
32+
SHA=`git rev-parse --verify HEAD`
3533

36-
# clone the repository and switch to PAGES_TARGET_BRANCH branch
37-
mkdir pages
38-
cd pages
39-
git clone https://${github_api_token}@github.com/${UTPLSQL_REPO} .
34+
# clone the repository and switch to PAGES_TARGET_BRANCH branch
35+
mkdir pages
36+
cd pages
37+
git clone https://${github_api_token}@github.com/${UTPLSQL_REPO} .
4038

41-
PAGES_BRANCH_EXISTS=$(git ls-remote --heads origin ${PAGES_TARGET_BRANCH})
39+
PAGES_BRANCH_EXISTS=$(git ls-remote --heads origin ${PAGES_TARGET_BRANCH})
4240

43-
if [ -n "$PAGES_BRANCH_EXISTS" ] ; then
44-
echo "Pages Branch Found"
45-
git checkout ${PAGES_TARGET_BRANCH}
46-
else
47-
echo "Creating Pages Branch"
48-
git checkout --orphan ${PAGES_TARGET_BRANCH}
49-
git rm -rf .
50-
fi
51-
#clear out develop documentation directory and copy docs contents to it.
52-
echo "updating 'develop' directory"
53-
mkdir -p develop
54-
rm -rf develop/**./* || exit 0
55-
cp -a ../docs/. ./develop
56-
# If a Tagged Build then copy to it's own directory as well and to the 'latest' release directory
57-
if [ -n "$TRAVIS_TAG" ]; then
58-
echo "Creating ${UTPLSQL_VERSION}"
59-
mkdir -p ${UTPLSQL_VERSION}
60-
rm -rf ${UTPLSQL_VERSION}/**./* || exit 0
61-
cp -a ../docs/. ${UTPLSQL_VERSION}
62-
echo "Populating 'latest' directory"
63-
mkdir -p latest
64-
rm -rf latest/**./* || exit 0
65-
cp -a ../docs/. latest
66-
fi
67-
# Stage changes for commit
68-
git add .
69-
#Check if there are doc changes, if none exit the script
70-
if [[ -z `git diff HEAD --exit-code` ]] && [ -n "${PAGES_BRANCH_EXISTS}" ] ; then
71-
echo "No changes to docs detected."
72-
exit 0
73-
fi
74-
#Changes where detected, so we need to update the version log.
75-
now=$(date +"%d %b %Y - %r")
76-
if [ ! -f index.md ]; then
77-
echo "---" >>index.md
78-
echo "layout: default" >>index.md
79-
echo "---" >>index.md
80-
echo "<!-- Auto generated from .travis/push_docs_to_gh_pages.sh -->" >>index.md
81-
echo "# Documentation versions" >>index.md
82-
echo "" >>index.md
83-
echo "" >>index.md #- 7th line - placeholder for latest release doc
84-
echo "" >>index.md #- 8th line - placeholder for develop branch doc
85-
echo "" >>index.md
86-
echo "## Released Version Doc History" >>index.md
87-
echo "" >>index.md
88-
fi
89-
#If build running on a TAG - it's a new release - need to add it to documentation
90-
if [ -n "${TRAVIS_TAG}" ]; then
91-
sed -i '7s@.*@'" - [Latest ${TRAVIS_TAG} documentation](latest/) - Created $now"'@' index.md
92-
#add entry to the top of version history (line end of file - ## Released Version Doc History
93-
sed -i '12i'" - [${TRAVIS_TAG} documentation](${UTPLSQL_VERSION}/) - Created $now" index.md
94-
fi
95-
#replace 4th line in log
96-
sed -i '8s@.*@'" - [Latest development version](develop/) - Created $now"'@' index.md
97-
#Add and Commit the changes back to pages repo.
98-
git add .
99-
git commit -m "Deploy to gh-pages branch: base commit ${SHA}"
100-
# Now that we're all set up, we can push.
101-
git push --quiet origin HEAD:${PAGES_TARGET_BRANCH}
41+
if [ -n "$PAGES_BRANCH_EXISTS" ] ; then
42+
echo "Pages Branch Found"
43+
git checkout ${PAGES_TARGET_BRANCH}
44+
else
45+
echo "Creating Pages Branch"
46+
git checkout --orphan ${PAGES_TARGET_BRANCH}
47+
git rm -rf .
10248
fi
49+
#clear out develop documentation directory and copy docs contents to it.
50+
echo "updating 'develop' directory"
51+
mkdir -p develop
52+
rm -rf develop/**./* || exit 0
53+
cp -a ../docs/. ./develop
54+
# If a Tagged Build then copy to it's own directory as well and to the 'latest' release directory
55+
if [ -n "$TRAVIS_TAG" ]; then
56+
echo "Creating ${UTPLSQL_VERSION}"
57+
mkdir -p ${UTPLSQL_VERSION}
58+
rm -rf ${UTPLSQL_VERSION}/**./* || exit 0
59+
cp -a ../docs/. ${UTPLSQL_VERSION}
60+
echo "Populating 'latest' directory"
61+
mkdir -p latest
62+
rm -rf latest/**./* || exit 0
63+
cp -a ../docs/. latest
64+
fi
65+
# Stage changes for commit
66+
git add .
67+
#Check if there are doc changes, if none exit the script
68+
if [[ -z `git diff HEAD --exit-code` ]] && [ -n "${PAGES_BRANCH_EXISTS}" ] ; then
69+
echo "No changes to docs detected."
70+
exit 0
71+
fi
72+
#Changes where detected, so we need to update the version log.
73+
now=$(date +"%d %b %Y - %r")
74+
if [ ! -f index.md ]; then
75+
echo "---" >>index.md
76+
echo "layout: default" >>index.md
77+
echo "---" >>index.md
78+
echo "<!-- Auto generated from .travis/push_docs_to_gh_pages.sh -->" >>index.md
79+
echo "# Documentation versions" >>index.md
80+
echo "" >>index.md
81+
echo "" >>index.md #- 7th line - placeholder for latest release doc
82+
echo "" >>index.md #- 8th line - placeholder for develop branch doc
83+
echo "" >>index.md
84+
echo "## Released Version Doc History" >>index.md
85+
echo "" >>index.md
86+
fi
87+
#If build running on a TAG - it's a new release - need to add it to documentation
88+
if [ -n "${TRAVIS_TAG}" ]; then
89+
sed -i '7s@.*@'" - [Latest ${TRAVIS_TAG} documentation](latest/) - Created $now"'@' index.md
90+
#add entry to the top of version history (line end of file - ## Released Version Doc History
91+
sed -i '12i'" - [${TRAVIS_TAG} documentation](${UTPLSQL_VERSION}/) - Created $now" index.md
92+
fi
93+
#replace 4th line in log
94+
sed -i '8s@.*@'" - [Latest development version](develop/) - Created $now"'@' index.md
95+
#Add and Commit the changes back to pages repo.
96+
git add .
97+
git commit -m "Deploy to gh-pages branch: base commit ${SHA}"
98+
# Now that we're all set up, we can push.
99+
git push --quiet origin HEAD:${PAGES_TARGET_BRANCH}
103100
fi
101+

.travis/push_release_version.sh

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,13 @@
55
# - branch name is = develop or branch name is like release/vX.X.X...
66
if [ "${TRAVIS_REPO_SLUG}" = "${UTPLSQL_REPO}" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ] && [[ "${CURRENT_BRANCH}" =~ ^(release/v[0-9]+\.[0-9]+\.[0-9]+.*|develop)$ ]]; then
77
echo Current branch is "${CURRENT_BRANCH}"
8-
echo Current job number is "${TRAVIS_JOB_NUMBER}"
9-
#The publishing is done only once (for first job on a build matrix)
10-
if [[ "${TRAVIS_JOB_NUMBER}" =~ \.1$ ]]; then
11-
echo "Committing version & buildNo into branch (${CURRENT_BRANCH})"
12-
git add sonar-project.properties
13-
git add VERSION
14-
git add source/*
15-
git commit -m 'Updated project version after build [skip ci]'
16-
echo "Pushing to origin"
17-
git push --quiet origin HEAD:${CURRENT_BRANCH}
18-
else
19-
echo "Publishing of version skipped for job No.: ${TRAVIS_JOB_NUMBER}"
20-
fi
8+
echo "Committing version & buildNo into branch (${CURRENT_BRANCH})"
9+
git add sonar-project.properties
10+
git add VERSION
11+
git add source/*
12+
git commit -m 'Updated project version after build [skip ci]'
13+
echo "Pushing to origin"
14+
git push --quiet origin HEAD:${CURRENT_BRANCH}
2115
else
2216
echo "Publishing of version skipped for branch ${CURRENT_BRANCH}, pull request ${TRAVIS_PULL_REQUEST}"
2317
fi

.travis/trigger_travis.sh

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ TRAVIS_URL=travis-ci.org
1919
BRANCH=develop
2020
USER="utPLSQL"
2121
RESULT=1
22-
declare -a REPO_MATRIX=("utPLSQL-java-api" "utPLSQL-v2-v3-migration" "utPLSQL-cli")
22+
declare -a REPO_MATRIX=("utPLSQL-java-api" "utPLSQL-v2-v3-migration" "utPLSQL-cli" "utPLSQL-maven-plugin" "utPLSQL-demo-project")
2323

2424
TOKEN=$1
2525

@@ -29,9 +29,8 @@ else
2929
MESSAGE=",\"message\": \"Triggered manually from shell\""
3030
fi
3131

32-
## For debugging:
33-
# echo "TOKEN=$TOKEN"
34-
# echo "MESSAGE=$MESSAGE"
32+
# For debugging:
33+
#echo "MESSAGE=$MESSAGE"
3534

3635
body="{
3736
\"request\": {
@@ -53,13 +52,13 @@ for DOWNSTREAM_BUILD in "${REPO_MATRIX[@]}"; do
5352
if grep -q '"@type": "error"' ${DOWNSTREAM_BUILD}-output.txt; then
5453
RESULT=0
5554
echoerr ""
56-
echoerr "Failed to start ${DOWNSTREAM_BUILD}"
55+
echoerr "ERROR: Failed to start ${DOWNSTREAM_BUILD}"
5756
echoerr ""
5857
fi
5958
if grep -q 'access denied' ${DOWNSTREAM_BUILD}-output.txt; then
6059
RESULT=0
6160
echoerr ""
62-
echoerr "Failed to start ${DOWNSTREAM_BUILD}"
61+
echoerr "ERROR: Failed to start ${DOWNSTREAM_BUILD} - access denied"
6362
echoerr ""
6463
fi
6564

0 commit comments

Comments
 (0)