From 585c00585a3dff47f0eb31985fc91c921b1e3e4d Mon Sep 17 00:00:00 2001 From: Will Abson Date: Wed, 11 Nov 2020 20:20:30 +0000 Subject: [PATCH 1/6] Add .travis.yml Refs SFDCENG-852 --- .travis.yml | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..3c57f00 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,58 @@ +# Auto-generated .travis.yml file +# Generated 2020-11-11 20:20:56 from Bamboo build plan INTEGRATIONS-SSS + +language: java + +jdk: + - openjdk11 + +dist: xenial + +addons: + artifacts: true + +stages: + - name: Default Stage + - name: Scan + - name: Release + if: fork = false AND (branch = master OR branch =~ /support\/.*/) AND type != pull_request AND commit_message !~ /\[no-release\]/ + +jobs: + include: + - stage: "Default Stage" + name: "Default Job" + script: + # Build + Deploy + - AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID} AWS_SECRET_KEY=${AWS_SECRET_KEY} mvn --batch-mode clean source:jar source:test-jar deploy -DaltDeploymentRepository=alfresco-internal::default::https://artifacts.alfresco.com/nexus/content/repositories/snapshots/ + # Sonar + - mvn --batch-mode clean compile sonar:sonar -P !check-license-headers + - stage: "Scan" + name: "Whitesource Scan" + script: + # Build + - mvn clean install -DskipTests + # Run the Whitesource scan + - release-scripts/whitesource-scan.sh Testing + before_script: + # Release Scripts Checkout + - git clone git@git.alfresco.com:Build/release-scripts.git release-scripts + after_script: + - artifacts upload target/site/whitesource/*.* + - stage: "Release" + name: "Release" + script: + # Check Branch + - | + sh -c "$(cat <<'EOF' + #!/bin/sh + set -o errexit + + if [ "$2" != "$1" ]; then + echo "Releases can only be run from branch $1" 1>&2 + exit 1 + fi + exit 0 + EOF + )" script.sh ${RELEASE_BRANCH} ${TRAVIS_BRANCH} + # Release + - GIT_AUTHOR_NAME=alfresco-build GIT_AUTHOR_EMAIL=build@alfresco.com GIT_COMMITTER_NAME=alfresco-build GIT_COMMITTER_EMAIL=build@alfresco.com AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID} AWS_SECRET_KEY=${AWS_SECRET_KEY} mvn --batch-mode -Darguments=-Dmaven.javadoc.skip=true release:clean release:prepare release:perform -Dmaven.javadoc.skip=true -DuseReleaseProfile=false -Dmaven.javadoc.failOnError=false -Dusername=alfresco-build -Dpassword=${GITHUB_PASSWORD} From a626cd4cba151c1aed939e1bc58e8561a36cd158 Mon Sep 17 00:00:00 2001 From: Andreea Nechifor Date: Wed, 25 Nov 2020 08:57:15 +0200 Subject: [PATCH 2/6] Added base build --- .travis.yml | 69 +++++++++++----------------------------- _ci/.travis.settings.xml | 50 +++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+), 51 deletions(-) create mode 100644 _ci/.travis.settings.xml diff --git a/.travis.yml b/.travis.yml index 3c57f00..8e6552c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,58 +1,25 @@ -# Auto-generated .travis.yml file -# Generated 2020-11-11 20:20:56 from Bamboo build plan INTEGRATIONS-SSS - +dist: xenial +sudo: required language: java - jdk: - openjdk11 -dist: xenial +cache: + directories: + - $HOME/.m2 -addons: - artifacts: true +branches: + only: + - develop + - APPS* + - /support\/.*/ + +before_install: + - "cp _ci/.travis.settings.xml $HOME/.m2/settings.xml" -stages: - - name: Default Stage - - name: Scan - - name: Release - if: fork = false AND (branch = master OR branch =~ /support\/.*/) AND type != pull_request AND commit_message !~ /\[no-release\]/ +install: travis_retry mvn install -DskipTests=true -B -V -jobs: - include: - - stage: "Default Stage" - name: "Default Job" - script: - # Build + Deploy - - AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID} AWS_SECRET_KEY=${AWS_SECRET_KEY} mvn --batch-mode clean source:jar source:test-jar deploy -DaltDeploymentRepository=alfresco-internal::default::https://artifacts.alfresco.com/nexus/content/repositories/snapshots/ - # Sonar - - mvn --batch-mode clean compile sonar:sonar -P !check-license-headers - - stage: "Scan" - name: "Whitesource Scan" - script: - # Build - - mvn clean install -DskipTests - # Run the Whitesource scan - - release-scripts/whitesource-scan.sh Testing - before_script: - # Release Scripts Checkout - - git clone git@git.alfresco.com:Build/release-scripts.git release-scripts - after_script: - - artifacts upload target/site/whitesource/*.* - - stage: "Release" - name: "Release" - script: - # Check Branch - - | - sh -c "$(cat <<'EOF' - #!/bin/sh - set -o errexit - - if [ "$2" != "$1" ]; then - echo "Releases can only be run from branch $1" 1>&2 - exit 1 - fi - exit 0 - EOF - )" script.sh ${RELEASE_BRANCH} ${TRAVIS_BRANCH} - # Release - - GIT_AUTHOR_NAME=alfresco-build GIT_AUTHOR_EMAIL=build@alfresco.com GIT_COMMITTER_NAME=alfresco-build GIT_COMMITTER_EMAIL=build@alfresco.com AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID} AWS_SECRET_KEY=${AWS_SECRET_KEY} mvn --batch-mode -Darguments=-Dmaven.javadoc.skip=true release:clean release:prepare release:perform -Dmaven.javadoc.skip=true -DuseReleaseProfile=false -Dmaven.javadoc.failOnError=false -Dusername=alfresco-build -Dpassword=${GITHUB_PASSWORD} +stages: + - build + - test + - release \ No newline at end of file diff --git a/_ci/.travis.settings.xml b/_ci/.travis.settings.xml new file mode 100644 index 0000000..38c440b --- /dev/null +++ b/_ci/.travis.settings.xml @@ -0,0 +1,50 @@ + + + + alfresco-internal + + true + + + + alfresco-internal + + true + + + true + + Alfresco Internal Repository + https://artifacts.alfresco.com/nexus/content/groups/internal + + + + + alfresco-internal + Alfresco Internal Repository + https://artifacts.alfresco.com/nexus/content/groups/public + + + + + + + + + docker.io + ${env.DOCKERHUB_USERNAME} + ${env.DOCKERHUB_PASSWORD} + + + quay.io + ${env.QUAY_USERNAME} + ${env.QUAY_PASSWORD} + + + alfresco-internal + ${env.MAVEN_USERNAME} + ${env.MAVEN_PASSWORD} + + + + From 1118e55da2935745fa45e7a893bd79d7a82caae5 Mon Sep 17 00:00:00 2001 From: Andreea Nechifor Date: Wed, 25 Nov 2020 17:27:24 +0200 Subject: [PATCH 3/6] added branches --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8e6552c..cbd4b13 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,8 +11,8 @@ cache: branches: only: - develop - - APPS* - - /support\/.*/ + - master + - dev-travis-migration before_install: - "cp _ci/.travis.settings.xml $HOME/.m2/settings.xml" From 4d4beeede13a5a615894367e8da239586dbed426 Mon Sep 17 00:00:00 2001 From: Andreea Nechifor Date: Thu, 26 Nov 2020 09:44:32 +0200 Subject: [PATCH 4/6] change spring-social --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index f23ec09..e42c162 100644 --- a/pom.xml +++ b/pom.xml @@ -17,7 +17,7 @@ 1.7.7 0.9.29 5.0.4.RELEASE - 2.0.0.M4 + 1.1.6.RELEASE 2.9.5 0.9.4 4.10 From b5bbef6bda38de88b1e22ae0e096abd7dabce1b4 Mon Sep 17 00:00:00 2001 From: Andreea Nechifor Date: Thu, 26 Nov 2020 10:21:59 +0200 Subject: [PATCH 5/6] added veracode-scan. --- .travis.yml | 16 ++++++++++++++-- _ci/source_clear.sh | 22 ++++++++++++++++++++++ 2 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 _ci/source_clear.sh diff --git a/.travis.yml b/.travis.yml index cbd4b13..d031443 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,5 +21,17 @@ install: travis_retry mvn install -DskipTests=true -B -V stages: - build - - test - - release \ No newline at end of file + - release + +jobs: + include: + - name: "Build" + stage: build + + - name: "Source Clear Scan (SCA)" + stage: build + # only on SP branches or master and if it is not a PR + if: type != pull_request + # Run Veracode + install: skip + script: travis_wait 30 bash _ci/source_clear.sh \ No newline at end of file diff --git a/_ci/source_clear.sh b/_ci/source_clear.sh new file mode 100644 index 0000000..5ad4a37 --- /dev/null +++ b/_ci/source_clear.sh @@ -0,0 +1,22 @@ +#!/usr/bin/env bash + +echo "=========================== Starting SourceClear Script ===========================" +PS4="\[\e[35m\]+ \[\e[m\]" +set +e -v -x +pushd "$(dirname "${BASH_SOURCE[0]}")/../" + +mvn -B -q clean install \ + -DskipTests \ + -Dmaven.javadoc.skip=true \ + com.srcclr:srcclr-maven-plugin:scan \ + -Dcom.srcclr.apiToken=$SRCCLR_API_TOKEN > scan.log + +SUCCESS=$? # this will read exit code of the previous command + +cat scan.log | grep -e 'Full Report Details' -e 'Failed' + +popd +set +vex +echo "=========================== Finishing SourceClear Script ==========================" + +exit ${SUCCESS} \ No newline at end of file From aabe22405f7803229803423ce42ce7825fb6391f Mon Sep 17 00:00:00 2001 From: Andreea Nechifor Date: Thu, 26 Nov 2020 14:49:57 +0200 Subject: [PATCH 6/6] added release stage --- .travis.yml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index d031443..b4dc5a1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -34,4 +34,15 @@ jobs: if: type != pull_request # Run Veracode install: skip - script: travis_wait 30 bash _ci/source_clear.sh \ No newline at end of file + script: travis_wait 30 bash _ci/source_clear.sh + + - stage: release + name: "Push to Nexus" + if: type != pull_request AND commit_message ~ /\[release\]/ + script: + # Use full history for release + - git checkout -B "${TRAVIS_BRANCH}" + # Add email to link commits to user + - git config user.email "${GIT_EMAIL}" + # Skip building of release commits + - mvn --batch-mode -q -DscmCommentPrefix="[maven-release-plugin][skip ci] " -Dusername="${GIT_USERNAME}" -Dpassword="${GIT_PASSWORD}" -DskipTests -Darguments=-DskipTests release:clean release:prepare release:perform