Add AMPS env var to alias to optionally build AMPs

Removed trigger of downstream project on feature branch to save agents

(cherry picked from commit f6c87dddbe)

# Conflicts:
#	scripts/travis/maven_release.sh
This commit is contained in:
alandavis
2021-05-05 21:17:00 +01:00
parent 4bdbfc2de0
commit 1f9e4fb4f6
6 changed files with 25 additions and 60 deletions

View File

@@ -279,11 +279,11 @@ jobs:
- name: "AGS Unit & Integration Tests (PostgreSQL)" - name: "AGS Unit & Integration Tests (PostgreSQL)"
if: branch =~ /(release\/.*$|master)/ OR commit_message =~ /\[ags\]/ 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) " - name: "AGS Unit & Integration Tests (MySQL) "
if: branch =~ /(release\/.*$|master)/ OR commit_message =~ /\[ags on 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" - name: "AGS Community Rest API Tests"
if: branch =~ /(release\/.*$|master)/ OR commit_message =~ /\[ags\]/ if: branch =~ /(release\/.*$|master)/ OR commit_message =~ /\[ags\]/
@@ -297,7 +297,7 @@ jobs:
before_script: before_script:
- ${TAS_SCRIPTS}/start-compose.sh ./amps/ags/rm-community/rm-community-repo/docker-compose.yml - ${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" - ${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 after_script: bash amps/ags/travis/scripts/getLogs.sh
- name: "Push to Nexus" - name: "Push to Nexus"

View File

@@ -12,6 +12,17 @@
<modules> <modules>
<module>share-services</module> <module>share-services</module>
<module>ags</module>
</modules> </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> </project>

View File

@@ -14,7 +14,8 @@ else
PROFILES="-Pbuild-docker-images" PROFILES="-Pbuild-docker-images"
fi 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 popd

View File

@@ -122,7 +122,7 @@ function buildUpstreamTag() {
cd "$(basename "${UPSTREAM_REPO%.git}")" 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 popd
} }
@@ -135,8 +135,8 @@ function buildSameBranchOnUpstream() {
cd "$(basename "${UPSTREAM_REPO%.git}")" cd "$(basename "${UPSTREAM_REPO%.git}")"
mvn -B -V -q clean install -DskipTests -Dmaven.javadoc.skip=true ${EXTRA_BUILD_ARGUMENTS} mvn -B -V -q clean install -DskipTests -Dmaven.javadoc.skip=true -Pags ${EXTRA_BUILD_ARGUMENTS}
mvn -B -V -q install -DskipTests -f packaging/tests/pom.xml mvn -B -V -q install -DskipTests -Pags -f packaging/tests/pom.xml
popd popd
} }
@@ -152,7 +152,7 @@ function pullUpstreamTagAndBuildDockerImage() {
cd "$(basename "${UPSTREAM_REPO%.git}")" 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 popd
} }
@@ -169,8 +169,8 @@ function pullAndBuildSameBranchOnUpstream() {
cd "$(basename "${UPSTREAM_REPO%.git}")" cd "$(basename "${UPSTREAM_REPO%.git}")"
mvn -B -V -q clean install -DskipTests -Dmaven.javadoc.skip=true ${EXTRA_BUILD_ARGUMENTS} mvn -B -V -q clean install -DskipTests -Dmaven.javadoc.skip=true -Pags ${EXTRA_BUILD_ARGUMENTS}
mvn -B -V -q install -DskipTests -f packaging/tests/pom.xml mvn -B -V -q install -DskipTests -Pags -f packaging/tests/pom.xml
popd 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 # Run the release plugin - with "[skip ci]" in the release commit message
mvn -B \ mvn -B \
-Pall-tas-tests \ -Pall-tas-tests \
"-Darguments=-Prelease,all-tas-tests -DskipTests -Dbuild-number=${TRAVIS_BUILD_NUMBER}" \ -Pags \
"-Darguments=-Prelease,all-tas-tests -Pags -DskipTests -Dbuild-number=${TRAVIS_BUILD_NUMBER}" \
release:clean release:prepare release:perform \ release:clean release:prepare release:perform \
-DscmCommentPrefix="[maven-release-plugin][skip ci] " \ -DscmCommentPrefix="[maven-release-plugin][skip ci] " \
-Dusername="${GIT_USERNAME}" \ -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