Add AMPS env var to alias to optionally build AMPs

Removed trigger of downstream project on feature branch to save agents
This commit is contained in:
alandavis
2021-04-27 17:31:23 +01:00
parent 5ca3179cc8
commit f6c87dddbe
6 changed files with 25 additions and 68 deletions

View File

@@ -37,8 +37,6 @@ stages:
if: commit_message !~ /\[no release\]/ AND (branch = master OR branch =~ /release\/.*/) AND type != pull_request AND fork = false
- name: update_downstream
if: commit_message !~ /\[no downstream\]/ AND (branch = master OR branch =~ /release\/.*/) AND type != pull_request AND fork = false
- name: trigger_downstream
if: commit_message !~ /\[no downstream\]/ AND (branch != master AND branch !~ /release\/.*/) AND type != pull_request AND fork = false
before_install: travis_retry bash scripts/travis/init.sh
install: travis_retry travis_wait 40 bash scripts/travis/build.sh
@@ -281,11 +279,11 @@ jobs:
- name: "AGS Unit & Integration Tests (PostgreSQL)"
if: branch =~ /(release\/.*$|master)/ OR commit_message =~ /\[ags\]/
script: travis_retry travis_wait 80 mvn -B verify -Dmaven.javadoc.skip=true -Dmaven.source.skip=true -Pstart-postgres -f amps/ags/pom.xml ${LOG_WARN}
script: travis_retry travis_wait 80 mvn -B verify -Dmaven.javadoc.skip=true -Dmaven.source.skip=true -Pags -Pstart-postgres -f amps/ags/pom.xml ${LOG_WARN}
- name: "AGS Unit & Integration Tests (MySQL) "
if: branch =~ /(release\/.*$|master)/ OR commit_message =~ /\[ags on MySQL\]/
script: travis_retry travis_wait 80 mvn -B verify -Dmaven.javadoc.skip=true -Dmaven.source.skip=true -Pstart-mysql -f amps/ags/pom.xml ${LOG_WARN}
script: travis_retry travis_wait 80 mvn -B verify -Dmaven.javadoc.skip=true -Dmaven.source.skip=true -Pags -Pstart-mysql -f amps/ags/pom.xml ${LOG_WARN}
- name: "AGS Community Rest API Tests"
if: branch =~ /(release\/.*$|master)/ OR commit_message =~ /\[ags\]/
@@ -299,7 +297,7 @@ jobs:
before_script:
- ${TAS_SCRIPTS}/start-compose.sh ./amps/ags/rm-community/rm-community-repo/docker-compose.yml
- ${TAS_SCRIPTS}/wait-for-alfresco-start.sh "http://localhost:8080/alfresco"
script: travis_wait 40 mvn -B test -pl :alfresco-governance-services-automation-community-rest-api -Dskip.automationtests=false
script: travis_wait 40 mvn -B test -pl :alfresco-governance-services-automation-community-rest-api -Dskip.automationtests=false -Pags
after_script: bash amps/ags/travis/scripts/getLogs.sh
- name: "Push to Nexus"
@@ -312,9 +310,3 @@ jobs:
install: skip
script: bash scripts/travis/update_downstream.sh
- name: "Trigger alfresco-enterprise-repo build"
stage: trigger_downstream
before_install: skip
install: skip
script: bash scripts/travis/trigger_travis.sh "Alfresco" "alfresco-enterprise-repo" "${TRAVIS_BRANCH}"

View File

@@ -12,6 +12,17 @@
<modules>
<module>share-services</module>
<module>ags</module>
</modules>
<!-- When adding a new AMP, create a profile for it here to add the module. The AMPS environment variable may
then be used in aliases to optionally build it. The profile will however need to be added to the Travis
build scripts. The share-services AMP is build by default as it is very fast. -->
<profiles>
<profile>
<id>ags</id>
<modules>
<module>ags</module>
</modules>
</profile>
</profiles>
</project>

View File

@@ -14,7 +14,8 @@ else
PROFILES="-PcommunityDocker"
fi
mvn -B -V install -DskipTests -Dmaven.javadoc.skip=true "${PROFILES}"
# Build the current project
mvn -B -V install -DskipTests -Dmaven.javadoc.skip=true "${PROFILES}" -Pags
popd

View File

@@ -122,7 +122,7 @@ function buildUpstreamTag() {
cd "$(basename "${UPSTREAM_REPO%.git}")"
mvn -B -V clean package -DskipTests -Dmaven.javadoc.skip=true "-Dimage.tag=${TAG}" ${EXTRA_BUILD_ARGUMENTS}
mvn -B -V clean package -DskipTests -Dmaven.javadoc.skip=true "-Dimage.tag=${TAG}" -Pags ${EXTRA_BUILD_ARGUMENTS}
popd
}
@@ -135,8 +135,8 @@ function buildSameBranchOnUpstream() {
cd "$(basename "${UPSTREAM_REPO%.git}")"
mvn -B -V -q clean install -DskipTests -Dmaven.javadoc.skip=true ${EXTRA_BUILD_ARGUMENTS}
mvn -B -V -q install -DskipTests -f packaging/tests/pom.xml
mvn -B -V -q clean install -DskipTests -Dmaven.javadoc.skip=true -Pags ${EXTRA_BUILD_ARGUMENTS}
mvn -B -V -q install -DskipTests -Pags -f packaging/tests/pom.xml
popd
}
@@ -152,7 +152,7 @@ function pullUpstreamTagAndBuildDockerImage() {
cd "$(basename "${UPSTREAM_REPO%.git}")"
mvn -B -V clean package -DskipTests -Dmaven.javadoc.skip=true "-Dimage.tag=${TAG}" ${EXTRA_BUILD_ARGUMENTS}
mvn -B -V clean package -DskipTests -Dmaven.javadoc.skip=true "-Dimage.tag=${TAG}" -Pags ${EXTRA_BUILD_ARGUMENTS}
popd
}
@@ -169,8 +169,8 @@ function pullAndBuildSameBranchOnUpstream() {
cd "$(basename "${UPSTREAM_REPO%.git}")"
mvn -B -V -q clean install -DskipTests -Dmaven.javadoc.skip=true ${EXTRA_BUILD_ARGUMENTS}
mvn -B -V -q install -DskipTests -f packaging/tests/pom.xml
mvn -B -V -q clean install -DskipTests -Dmaven.javadoc.skip=true -Pags ${EXTRA_BUILD_ARGUMENTS}
mvn -B -V -q install -DskipTests -Pags -f packaging/tests/pom.xml
popd
}

View File

@@ -13,7 +13,8 @@ git config user.email "${GIT_EMAIL}"
# Run the release plugin - with "[skip ci]" in the release commit message
mvn -B \
-PfullBuild,all-tas-tests \
"-Darguments=-Prelease,fullBuild,all-tas-tests -DskipTests -Dbuild-number=${TRAVIS_BUILD_NUMBER}" \
-Pags \
"-Darguments=-Prelease,fullBuild,all-tas-tests -Pags -DskipTests -Dbuild-number=${TRAVIS_BUILD_NUMBER}" \
release:clean release:prepare release:perform \
-DscmCommentPrefix="[maven-release-plugin][skip ci] " \
-Dusername="${GIT_USERNAME}" \

View File

@@ -1,48 +0,0 @@
#!/usr/bin/env bash
set -ev
USER=${1}
REPO=${2}
BRANCH=${3}
if [ "${TRAVIS_PULL_REQUEST}" != "false" ]; then
echo "Downstream projects shouldn't be triggered from PR builds"
exit 1
fi
if ! git ls-remote --exit-code --heads "https://${GIT_USERNAME}:${GIT_PASSWORD}@github.com/${USER}/${REPO}.git" "${BRANCH}" ; then
echo "Branch \"${BRANCH}\" not found on the downstream repository ${USER}/${REPO}. Exiting..."
exit 0
fi
URL="https://api.travis-ci.com/repo/${USER}%2F${REPO}/requests"
BODY="{
\"request\": {
\"branch\":\"${BRANCH}\"
}}"
printf "Travis API call:\n URL: %s\n Body: %s\n\n" "${URL}" "${BODY}"
curl -s -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Travis-API-Version: 3" \
-H "Authorization: token ${TRAVIS_ACCESS_TOKEN}" \
-d "${BODY}" \
"${URL}" \
| tee /tmp/travis-request-output.txt
cat /tmp/travis-request-output.txt
if grep -q '"@type": "error"' /tmp/travis-request-output.txt; then
echo "Error when triggering build..."
exit 2
fi
if grep -q 'access denied' /tmp/travis-request-output.txt; then
echo "Access denied when triggering build..."
exit 3
fi
exit 0