diff --git a/.travis.settings.xml b/.ci.settings.xml similarity index 88% rename from .travis.settings.xml rename to .ci.settings.xml index 7ab2258a6a..12614f6477 100644 --- a/.travis.settings.xml +++ b/.ci.settings.xml @@ -25,10 +25,6 @@ https://artifacts.alfresco.com/nexus/content/groups/public - - - ${env.WHITESOURCE_API_KEY} - diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000000..e6fd5f82e4 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,411 @@ +name: Alfresco Community Repo CI + +on: + pull_request: + branches: + - master + - release/** + - feature/** + - fix/** + + push: + branches: + - feature/** + - fix/** + workflow_call: + workflow_dispatch: + +env: + TAS_SCRIPTS: ../alfresco-community-repo/packaging/tests/scripts + TAS_ENVIRONMENT: ./packaging/tests/environment + DOCKERHUB_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} + DOCKERHUB_USERNAME: ${{ secrets.DOCKER_USERNAME }} + GITHUB_ACTIONS_DEPLOY_TIMEOUT: 60 + MAVEN_PASSWORD: ${{ secrets.NEXUS_PASSWORD }} + MAVEN_USERNAME: ${{ secrets.NEXUS_USERNAME }} + QUAY_PASSWORD: ${{ secrets.QUAY_PASSWORD }} + QUAY_USERNAME: ${{ secrets.QUAY_USERNAME }} + +jobs: + prepare: + name: "Prepare" + runs-on: ubuntu-latest + if: > + !contains(github.event.head_commit.message, '[skip tests]') && + !contains(github.event.head_commit.message, '[force]') + steps: + - uses: actions/checkout@v3 + - uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v1.33.0 + - uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v1.33.0 + with: + java-version: "11" + - name: "Init" + run: bash ./scripts/ci/init.sh + - name: "Prepare maven cache and check compilation" + run: bash ./scripts/ci/prepare.sh + - name: "Clean Maven cache" + run: bash ./scripts/ci/cleanup_cache.sh + + all_unit_tests_suite: + name: "Core, Data-Model, Repository - AllUnitTestsSuite - Build and test" + runs-on: ubuntu-latest + needs: [prepare] + if: > + !contains(github.event.head_commit.message, '[skip repo]') && + !contains(github.event.head_commit.message, '[skip tests]') && + !contains(github.event.head_commit.message, '[force]') + steps: + - uses: actions/checkout@v3 + - uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v1.33.0 + - uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v1.33.0 + with: + java-version: "11" + - name: "Init" + run: bash ./scripts/ci/init.sh + - name: "Run tests" + run: | + mvn -B test -pl core,data-model -am -DfailIfNoTests=false + mvn -B test -pl "repository" -am "-Dtest=AllUnitTestsSuite" -DfailIfNoTests=false + - name: "Clean Maven cache" + run: bash ./scripts/ci/cleanup_cache.sh + + repository_app_context_test_suites: + name: Repository - ${{ matrix.testSuite }} + runs-on: ubuntu-latest + needs: [prepare] + if: > + !contains(github.event.head_commit.message, '[skip repo]') && + !contains(github.event.head_commit.message, '[skip tests]') && + !contains(github.event.head_commit.message, '[force]') + strategy: + fail-fast: false + matrix: + include: + - testSuite: AppContext01TestSuite + compose-profile: with-transform-core-aio + - testSuite: AppContext02TestSuite + compose-profile: default + - testSuite: AppContext03TestSuite + compose-profile: with-transform-core-aio + - testSuite: AppContext04TestSuite + compose-profile: with-transform-core-aio + - testSuite: AppContext05TestSuite + compose-profile: default + mvn-options: '"-Didentity-service.auth-server-url=http://${HOST_IP}:8999/auth"' + - testSuite: AppContext06TestSuite + compose-profile: with-transform-core-aio + - testSuite: AppContextExtraTestSuite + compose-profile: with-transform-core-aio + - testSuite: MiscContextTestSuite + compose-profile: with-transform-core-aio + - testSuite: SearchTestSuite + compose-profile: default + mvn-options: '-Dindex.subsystem.name=solr6' + steps: + - uses: actions/checkout@v3 + - uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v1.33.0 + - uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v1.33.0 + with: + java-version: "11" + - name: "Init" + run: bash ./scripts/ci/init.sh + - name: "Set transformers tag" + run: echo "TRANSFORMERS_TAG=$(mvn help:evaluate -Dexpression=dependency.alfresco-transform-core.version -q -DforceStdout)" >> $GITHUB_ENV + - name: "Set up the environment" + run: | + if [ -e ./scripts/ci/tests/${{ matrix.testSuite }}-setup.sh ]; then + bash ./scripts/ci/tests/${{ matrix.testSuite }}-setup.sh + fi + docker-compose -f ./scripts/ci/docker-compose/docker-compose.yaml --profile ${{ matrix.compose-profile }} up -d + - name: "Run tests" + run: mvn -B test -pl repository -am -Dtest=${{ matrix.testSuite }} -DfailIfNoTests=false -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco ${{ matrix.mvn-options }} + - name: "Clean Maven cache" + run: bash ./scripts/ci/cleanup_cache.sh + + repository_mariadb_tests: + name: Repository - MariaDB ${{ matrix.version }} tests + runs-on: ubuntu-latest + needs: [prepare] + if: > + (((github.ref_name == 'master' || startsWith(github.ref_name, 'release/')) && + github.event_name != 'pull_request' && + !contains(github.event.head_commit.message, '[skip db]')) || + contains(github.event.head_commit.message, '[db]')) && + !contains(github.event.head_commit.message, '[skip tests]') && + !contains(github.event.head_commit.message, '[force]') + strategy: + fail-fast: false + matrix: + version: ['10.2.18', '10.4'] + steps: + - uses: actions/checkout@v3 + - uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v1.33.0 + - uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v1.33.0 + with: + java-version: "11" + - name: "Init" + run: bash ./scripts/ci/init.sh + - name: Run MariaDB ${{ matrix.version }} database + run: docker-compose -f ./scripts/ci/docker-compose/docker-compose-db.yaml --profile mariadb up -d + env: + MARIADB_VERSION: ${{ matrix.version }} + - name: "Run tests" + run: mvn -B test -pl repository -am -Dtest=AllDBTestsTestSuite -DfailIfNoTests=false -Ddb.name=alfresco -Ddb.url=jdbc:mariadb://localhost:3307/alfresco?useUnicode=yes\&characterEncoding=UTF-8 -Ddb.username=alfresco -Ddb.password=alfresco -Ddb.driver=org.mariadb.jdbc.Driver + - name: "Clean Maven cache" + run: bash ./scripts/ci/cleanup_cache.sh + + repository_mariadb_10_5_tests: + name: Repository - MariaDB 10.5 tests + runs-on: ubuntu-latest + needs: [prepare] + if: > + (((github.ref_name == 'master' || startsWith(github.ref_name, 'release/') || github.event_name == 'pull_request') && + !contains(github.event.head_commit.message, '[skip db]')) || + contains(github.event.head_commit.message, '[latest db]') || + contains(github.event.head_commit.message, '[db]')) && + !contains(github.event.head_commit.message, '[skip tests]') && + !contains(github.event.head_commit.message, '[force]') + steps: + - uses: actions/checkout@v3 + - uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v1.33.0 + - uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v1.33.0 + with: + java-version: "11" + - name: "Init" + run: bash ./scripts/ci/init.sh + - name: Run MariaDB 10.5 database + run: docker-compose -f ./scripts/ci/docker-compose/docker-compose-db.yaml --profile mariadb up -d + env: + MARIADB_VERSION: 10.5 + - name: "Run tests" + run: mvn -B test -pl repository -am -Dtest=AllDBTestsTestSuite -DfailIfNoTests=false -Ddb.name=alfresco -Ddb.url=jdbc:mariadb://localhost:3307/alfresco?useUnicode=yes\&characterEncoding=UTF-8 -Ddb.username=alfresco -Ddb.password=alfresco -Ddb.driver=org.mariadb.jdbc.Driver + - name: "Clean Maven cache" + run: bash ./scripts/ci/cleanup_cache.sh + + repository_mysql_5_7_28_tests: + name: Repository - MySQL ${{ matrix.version }} tests + runs-on: ubuntu-latest + needs: [prepare] + if: > + (((github.ref_name == 'master' || startsWith(github.ref_name, 'release/')) && + github.event_name != 'pull_request' && + !contains(github.event.head_commit.message, '[skip db]')) || + contains(github.event.head_commit.message, '[db]')) && + !contains(github.event.head_commit.message, '[skip tests]') && + !contains(github.event.head_commit.message, '[force]') + steps: + - uses: actions/checkout@v3 + - uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v1.33.0 + - uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v1.33.0 + with: + java-version: "11" + - name: "Init" + run: bash ./scripts/ci/init.sh + - name: "Run MySQL 5.7.28 database" + run: docker-compose -f ./scripts/ci/docker-compose/docker-compose-db.yaml --profile mysql up -d + env: + MYSQL_VERSION: 5.7.28 + - name: "Run tests" + run: mvn -B test -pl repository -am -Dtest=AllDBTestsTestSuite -DfailIfNoTests=false -Ddb.driver=com.mysql.jdbc.Driver -Ddb.name=alfresco -Ddb.url=jdbc:mysql://localhost:3307/alfresco -Ddb.username=alfresco -Ddb.password=alfresco + - name: "Clean Maven cache" + run: bash ./scripts/ci/cleanup_cache.sh + + repository_mysql_8_tests: + name: Repository - MySQL 8 tests + runs-on: ubuntu-latest + needs: [prepare] + if: > + (((github.ref_name == 'master' || startsWith(github.ref_name, 'release/') || github.event_name == 'pull_request') && + !contains(github.event.head_commit.message, '[skip db]')) || + contains(github.event.head_commit.message, '[latest db]') || + contains(github.event.head_commit.message, '[db]')) && + !contains(github.event.head_commit.message, '[skip tests]') && + !contains(github.event.head_commit.message, '[force]') + steps: + - uses: actions/checkout@v3 + - uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v1.33.0 + - uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v1.33.0 + with: + java-version: "11" + - name: "Init" + run: bash ./scripts/ci/init.sh + - name: "Run MySQL 8 database" + run: docker-compose -f ./scripts/ci/docker-compose/docker-compose-db.yaml --profile mysql up -d + env: + MYSQL_VERSION: 8 + - name: "Run tests" + run: mvn -B test -pl repository -am -Dtest=AllDBTestsTestSuite -DfailIfNoTests=false -Ddb.driver=com.mysql.jdbc.Driver -Ddb.name=alfresco -Ddb.url=jdbc:mysql://localhost:3307/alfresco -Ddb.username=alfresco -Ddb.password=alfresco + - name: "Clean Maven cache" + run: bash ./scripts/ci/cleanup_cache.sh + + repository_postgresql_tests: + name: "Repository - PostgreSQL ${{ matrix.version }} tests" + runs-on: ubuntu-latest + needs: [prepare] + if: > + (((github.ref_name == 'master' || startsWith(github.ref_name, 'release/')) && + github.event_name != 'pull_request' && + !contains(github.event.head_commit.message, '[skip db]')) || + contains(github.event.head_commit.message, '[db]')) && + !contains(github.event.head_commit.message, '[skip tests]') && + !contains(github.event.head_commit.message, '[force]') + strategy: + fail-fast: false + matrix: + version: ['10.9', '11.7', '12.4'] + steps: + - uses: actions/checkout@v3 + - uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v1.33.0 + - uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v1.33.0 + with: + java-version: "11" + - name: "Init" + run: bash ./scripts/ci/init.sh + - name: "Run PostgreSQL ${{ matrix.version }} database" + run: docker-compose -f ./scripts/ci/docker-compose/docker-compose-db.yaml --profile postgres up -d + env: + POSTGRES_VERSION: ${{ matrix.version }} + - name: "Run tests" + run: mvn -B test -pl repository -am -Dtest=AllDBTestsTestSuite -DfailIfNoTests=false -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco + - name: "Clean Maven cache" + run: bash ./scripts/ci/cleanup_cache.sh + + repository_postgresql_13_1_tests: + name: "Repository - PostgreSQL 13.1 tests" + runs-on: ubuntu-latest + needs: [prepare] + if: > + (((github.ref_name == 'master' || startsWith(github.ref_name, 'release/') || github.event_name == 'pull_request') && + !contains(github.event.head_commit.message, '[skip db]')) || + contains(github.event.head_commit.message, '[latest db]') || + contains(github.event.head_commit.message, '[db]')) && + !contains(github.event.head_commit.message, '[skip tests]') && + !contains(github.event.head_commit.message, '[force]') + steps: + - uses: actions/checkout@v3 + - uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v1.33.0 + - uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v1.33.0 + with: + java-version: "11" + - name: "Init" + run: bash ./scripts/ci/init.sh + - name: "Run PostgreSQL 13.1 database" + run: docker-compose -f ./scripts/ci/docker-compose/docker-compose-db.yaml --profile postgres up -d + env: + POSTGRES_VERSION: 13.1 + - name: "Run tests" + run: mvn -B test -pl repository -am -Dtest=AllDBTestsTestSuite -DfailIfNoTests=false -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco + - name: "Clean Maven cache" + run: bash ./scripts/ci/cleanup_cache.sh + + remote_api_app_context_test_suites: + name: Remote-api - ${{ matrix.testSuite }} + runs-on: ubuntu-latest + needs: [prepare] + if: > + !contains(github.event.head_commit.message, '[skip repo]') && + !contains(github.event.head_commit.message, '[skip tests]') && + !contains(github.event.head_commit.message, '[force]') + strategy: + fail-fast: false + matrix: + include: + - testSuite: AppContext01TestSuite + compose-profile: default + - testSuite: AppContext02TestSuite + compose-profile: with-transform-core-aio + - testSuite: AppContext03TestSuite + compose-profile: with-transform-core-aio + - testSuite: AppContext04TestSuite + compose-profile: with-transform-core-aio + - testSuite: AppContextExtraTestSuite + compose-profile: default + env: + REQUIRES_INSTALLED_ARTIFACTS: true + steps: + - uses: actions/checkout@v3 + - uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v1.33.0 + - uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v1.33.0 + with: + java-version: "11" + - name: "Build" + timeout-minutes: ${{ fromJSON(env.GITHUB_ACTIONS_DEPLOY_TIMEOUT) }} + run: | + bash ./scripts/ci/init.sh + bash ./scripts/ci/build.sh + - name: "Set transformers tag" + run: echo "TRANSFORMERS_TAG=$(mvn help:evaluate -Dexpression=dependency.alfresco-transform-core.version -q -DforceStdout)" >> $GITHUB_ENV + - name: "Set up the environment" + run: docker-compose -f ./scripts/ci/docker-compose/docker-compose.yaml --profile ${{ matrix.compose-profile }} up -d + - name: "Run tests" + run: mvn -B test -pl remote-api -Dtest=${{ matrix.testSuite }} -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco + - name: "Clean Maven cache" + run: bash ./scripts/ci/cleanup_cache.sh + + tas_tests: + name: ${{ matrix.test-name }} + runs-on: ubuntu-latest + needs: [prepare] + if: > + (((github.ref_name == 'master' || startsWith(github.ref_name, 'release/') || github.event_name == 'pull_request' ) && + !contains(github.event.head_commit.message, '[skip tas]')) || + contains(github.event.head_commit.message, '[tas]')) && + !contains(github.event.head_commit.message, '[skip tests]') && + !contains(github.event.head_commit.message, '[force]') + strategy: + fail-fast: false + matrix: + include: + - test-name: "REST API TAS tests part1" + pom-dir: tas-restapi + test-profile: run-restapi-part1 + - test-name: "REST API TAS tests part2" + pom-dir: tas-restapi + test-profile: run-restapi-part2 + - test-name: "REST API TAS tests part3" + pom-dir: tas-restapi + test-profile: run-restapi-part3 + - test-name: "CMIS TAS tests - BROWSER binding" + pom-dir: tas-cmis + test-profile: run-cmis-browser + - test-name: "CMIS TAS tests - ATOM binding" + pom-dir: tas-cmis + test-profile: run-cmis-atom + - test-name: "CMIS TAS tests - WEBSERVICES binding" + pom-dir: tas-cmis + test-profile: run-cmis-webservices + - test-name: "Email TAS tests" + pom-dir: tas-email + - test-name: "WebDAV TAS tests" + pom-dir: tas-webdav + - test-name: "Integration TAS tests" + pom-dir: tas-integration + env: + REQUIRES_LOCAL_IMAGES: true + steps: + - uses: actions/checkout@v3 + - uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v1.33.0 + - uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v1.33.0 + with: + java-version: "11" + - name: "Build" + timeout-minutes: ${{ fromJSON(env.GITHUB_ACTIONS_DEPLOY_TIMEOUT) }} + run: | + bash ./scripts/ci/init.sh + bash ./scripts/ci/build.sh + - name: "Set up the environment" + run: | + ${{ env.TAS_SCRIPTS }}/start-compose.sh ${{ env.TAS_ENVIRONMENT }}/docker-compose-minimal+transforms.yml + ${{ env.TAS_SCRIPTS }}/wait-for-alfresco-start.sh "http://localhost:8082/alfresco" + - name: "Run tests" + id: tests + timeout-minutes: ${{ fromJSON(env.GITHUB_ACTIONS_DEPLOY_TIMEOUT) }} + run: mvn -B verify -f packaging/tests/${{ matrix.pom-dir }}/pom.xml -Pall-tas-tests,${{ matrix.test-profile }} -Denvironment=default -DrunBugs=false + - name: "Print output after success" + if: ${{ always() && steps.tests.outcome == 'success' }} + run: ${TAS_SCRIPTS}/output_tests_run.sh "packaging/tests/${{ matrix.pom-dir }}" + - name: "Print output after failure" + if: ${{ always() && steps.tests.outcome == 'failure' }} + run: ${TAS_SCRIPTS}/output_logs_for_failures.sh "packaging/tests/${{ matrix.pom-dir }}" + - name: "Clean Maven cache" + run: bash ./scripts/ci/cleanup_cache.sh \ No newline at end of file diff --git a/.github/workflows/master_release.yml b/.github/workflows/master_release.yml new file mode 100644 index 0000000000..e1de1d98ef --- /dev/null +++ b/.github/workflows/master_release.yml @@ -0,0 +1,79 @@ +name: Master/Release branch workflow + +on: + push: + branches: + - master + - release/** + +env: + GIT_USERNAME: ${{ secrets.BOT_GITHUB_USERNAME }} + GIT_EMAIL: ${{ secrets.BOT_GITHUB_EMAIL }} + GIT_PASSWORD: ${{ secrets.BOT_GITHUB_TOKEN }} + DOCKERHUB_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} + DOCKERHUB_USERNAME: ${{ secrets.DOCKER_USERNAME }} + MAVEN_PASSWORD: ${{ secrets.NEXUS_PASSWORD }} + MAVEN_USERNAME: ${{ secrets.NEXUS_USERNAME }} + QUAY_PASSWORD: ${{ secrets.QUAY_PASSWORD }} + QUAY_USERNAME: ${{ secrets.QUAY_USERNAME }} + GITHUB_ACTIONS_DEPLOY_TIMEOUT: 60 + +jobs: + run_ci: + uses: ./.github/workflows/ci.yml + secrets: inherit + push_to_nexus: + name: "Push to Nexus" + runs-on: ubuntu-latest + needs: [run_ci] + if: > + !(failure() || cancelled()) && + !contains(github.event.head_commit.message, '[no release]') && + github.event_name != 'pull_request' + steps: + - uses: actions/checkout@v3 + with: + persist-credentials: false + - uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v1.33.0 + - uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v1.33.0 + - name: "Init" + run: bash ./scripts/ci/init.sh + - uses: Alfresco/alfresco-build-tools/.github/actions/configure-git-author@v1.33.0 + with: + username: ${{ env.GIT_USERNAME }} + email: ${{ env.GIT_EMAIL }} + global: true + - name: "Release" + timeout-minutes: ${{ fromJSON(env.GITHUB_ACTIONS_DEPLOY_TIMEOUT) }} + run: | + bash scripts/ci/verify_release_tag.sh + bash scripts/ci/maven_release.sh + - name: "Clean Maven cache" + run: bash ./scripts/ci/cleanup_cache.sh + update_downstream: + name: "Update alfresco-enterprise-repo" + runs-on: ubuntu-latest + needs: [push_to_nexus] + if: > + !(failure() || cancelled()) && + !contains(github.event.head_commit.message, '[no downstream]') && + github.event_name != 'pull_request' + steps: + - uses: actions/checkout@v3 + with: + persist-credentials: false + - uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v1.33.0 + - uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v1.33.0 + - name: "Init" + run: bash ./scripts/ci/init.sh + - uses: Alfresco/alfresco-build-tools/.github/actions/configure-git-author@v1.33.0 + with: + username: ${{ env.GIT_USERNAME }} + email: ${{ env.GIT_EMAIL }} + global: true + - name: "Update downstream" + run: bash ./scripts/ci/update_downstream.sh + env: + COMMIT_MESSAGE: ${{ github.event.head_commit.message }} + - name: "Clean Maven cache" + run: bash ./scripts/ci/cleanup_cache.sh \ No newline at end of file diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 4f1886347e..0000000000 --- a/.travis.yml +++ /dev/null @@ -1,317 +0,0 @@ ---- -dist: focal -language: java -jdk: openjdk11 - -services: - - docker - -git: - depth: false - quiet: true - -cache: - directories: - - ${HOME}/.m2/repository - -# the cache can grow constantly -before_cache: bash scripts/travis/cleanup_cache.sh - -branches: - only: - - master - - /release\/.*/ - - /feature\/.*/ - - /fix\/.*/ - -env: - global: - - TAS_SCRIPTS=../alfresco-community-repo/packaging/tests/scripts - - TAS_ENVIRONMENT=./packaging/tests/environment - -stages: - - name: test - if: commit_message !~ /\[skip tests\]/ - - name: release - if: fork = false AND (branch = master OR branch =~ /release\/.*/) AND type != pull_request AND commit_message !~ /\[no release\]/ - - name: update_downstream - if: fork = false AND (branch = master OR branch =~ /release\/.*/) AND type != pull_request AND commit_message !~ /\[no downstream\]/ - - name: trigger_downstream - if: fork = false AND (branch != master AND branch !~ /release\/.*/) AND type != pull_request AND commit_message !~ /\[no downstream\]/ - -before_install: travis_retry bash scripts/travis/init.sh -install: travis_retry travis_wait 40 bash scripts/travis/build.sh - -jobs: - include: - - - name: "Core, Data-Model, Repository - AllUnitTestsSuite - Build and test" - if: commit_message !~ /\[skip repo\]/ - script: - - travis_retry mvn -B test -pl core,data-model - - travis_retry mvn -B test -pl repository -Dtest=AllUnitTestsSuite - - - name: "Repository - AppContext01TestSuite" - if: commit_message !~ /\[skip repo\]/ - before_script: - - docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:13.1 postgres -c 'max_connections=300' - - docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1 - - docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.4.0 - script: travis_wait 20 mvn -B test -pl repository -Dtest=AppContext01TestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco - - - name: "Repository - AppContext02TestSuite" - if: commit_message !~ /\[skip repo\]/ - before_script: - - docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:13.1 postgres -c 'max_connections=300' - - docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1 - script: travis_wait 20 mvn -B test -pl repository -Dtest=AppContext02TestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco - - - name: "Repository - AppContext03TestSuite" - if: commit_message !~ /\[skip repo\]/ - before_script: - - docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:13.1 postgres -c 'max_connections=300' - - docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1 - - docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.4.0 - script: travis_wait 20 mvn -B test -pl repository -Dtest=AppContext03TestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco - - - name: "Repository - AppContext04TestSuite" - if: commit_message !~ /\[skip repo\]/ - before_script: - - docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:13.1 postgres -c 'max_connections=300' - - docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1 - - docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.4.0 - script: travis_wait 20 mvn -B test -pl repository -Dtest=AppContext04TestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco - - - name: "Repository - AppContext05TestSuite" - if: commit_message !~ /\[skip repo\]/ - before_script: - - docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:13.1 postgres -c 'max_connections=300' - - docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1 - - mkdir -p "${HOME}/tmp" - - cp repository/src/test/resources/realms/alfresco-realm.json "${HOME}/tmp" - - export HOST_IP=$(hostname -I | cut -f1 -d' ') - - docker run -d -e KEYCLOAK_USER=admin -e KEYCLOAK_PASSWORD=admin -e DB_VENDOR=h2 -p 8999:8080 -e KEYCLOAK_IMPORT=/tmp/alfresco-realm.json -v $HOME/tmp/alfresco-realm.json:/tmp/alfresco-realm.json alfresco/alfresco-identity-service:1.2 - script: travis_wait 20 mvn -B test -pl repository -Dtest=AppContext05TestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco "-Didentity-service.auth-server-url=http://${HOST_IP}:8999/auth" - - - name: "Repository - AppContext06TestSuite" - if: commit_message !~ /\[skip repo\]/ - before_script: - - docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:13.1 postgres -c 'max_connections=300' - - docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1 - - docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.4.0 - script: travis_wait 20 mvn -B test -pl repository -Dtest=AppContext06TestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco - - - name: "Repository - AppContextExtraTestSuite" - if: commit_message !~ /\[skip repo\]/ - before_script: - - docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:13.1 postgres -c 'max_connections=300' - - docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1 - - docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.4.0 - script: travis_wait 20 mvn -B test -pl repository -Dtest=AppContextExtraTestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco - - - name: "Repository - MiscContextTestSuite" - if: commit_message !~ /\[skip repo\]/ - before_script: - - docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:13.1 postgres -c 'max_connections=300' - - docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1 - - docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.4.0 - script: travis_wait 20 mvn -B test -pl repository -Dtest=MiscContextTestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco - - - name: "Repository - SearchTestSuite" - if: commit_message !~ /\[skip repo\]/ - before_script: - - docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:13.1 postgres -c 'max_connections=300' - - docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1 - script: travis_wait 20 mvn -B test -pl repository -Dtest=SearchTestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco -Dindex.subsystem.name=solr6 - - - name: "Repository - MariaDB 10.2.18 tests" - if: (branch =~ /(release\/.*$|master)/ AND commit_message !~ /\[skip db\]/ AND type != pull_request) OR commit_message =~ /\[db\]/ - before_script: - - docker run -d -p 3307:3306 --name mariadb -e MYSQL_ROOT_PASSWORD=alfresco -e MYSQL_USER=alfresco -e MYSQL_DATABASE=alfresco -e MYSQL_PASSWORD=alfresco mariadb:10.2.18 --transaction-isolation=READ-COMMITTED --max-connections=300 --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci - - docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1 - script: travis_wait 20 mvn -B test -pl repository -Dtest=AllDBTestsTestSuite -Ddb.name=alfresco -Ddb.url=jdbc:mariadb://localhost:3307/alfresco?useUnicode=yes\&characterEncoding=UTF-8 -Ddb.username=alfresco -Ddb.password=alfresco -Ddb.driver=org.mariadb.jdbc.Driver - - - name: "Repository - MariaDB 10.4 tests" - if: (branch =~ /(release\/.*$|master)/ AND commit_message !~ /\[skip db\]/ AND type != pull_request) OR commit_message =~ /\[db\]/ - before_script: - - docker run -d -p 3307:3306 --name mariadb -e MYSQL_ROOT_PASSWORD=alfresco -e MYSQL_USER=alfresco -e MYSQL_DATABASE=alfresco -e MYSQL_PASSWORD=alfresco mariadb:10.4 --transaction-isolation=READ-COMMITTED --max-connections=300 --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci - - docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1 - script: travis_wait 20 mvn -B test -pl repository -Dtest=AllDBTestsTestSuite -Ddb.name=alfresco -Ddb.url=jdbc:mariadb://localhost:3307/alfresco?useUnicode=yes\&characterEncoding=UTF-8 -Ddb.username=alfresco -Ddb.password=alfresco -Ddb.driver=org.mariadb.jdbc.Driver - - - name: "Repository - MariaDB 10.5 tests" - if: (branch =~ /(release\/.*$|master)/ AND commit_message !~ /\[skip db\]/ AND type != pull_request) OR commit_message =~ /\[db\]/ OR commit_message =~ /\[latest db\]/ - before_script: - - docker run -d -p 3307:3306 --name mariadb -e MYSQL_ROOT_PASSWORD=alfresco -e MYSQL_USER=alfresco -e MYSQL_DATABASE=alfresco -e MYSQL_PASSWORD=alfresco mariadb:10.5 --transaction-isolation=READ-COMMITTED --max-connections=300 --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci - - docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1 - script: travis_wait 20 mvn -B test -pl repository -Dtest=AllDBTestsTestSuite -Ddb.name=alfresco -Ddb.url=jdbc:mariadb://localhost:3307/alfresco?useUnicode=yes\&characterEncoding=UTF-8 -Ddb.username=alfresco -Ddb.password=alfresco -Ddb.driver=org.mariadb.jdbc.Driver - - - name: "Repository - MySQL 5.7.28 tests" - if: (branch =~ /(release\/.*$|master)/ AND commit_message !~ /\[skip db\]/ AND type != pull_request) OR commit_message =~ /\[db\]/ - before_script: - - docker run -d -p 3307:3306 -e MYSQL_ROOT_PASSWORD=alfresco -e MYSQL_USER=alfresco -e MYSQL_DATABASE=alfresco -e MYSQL_PASSWORD=alfresco mysql:5.7.28 --transaction-isolation='READ-COMMITTED' - - docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1 - script: travis_wait 20 mvn -B test -pl repository -Dtest=AllDBTestsTestSuite -Ddb.driver=com.mysql.jdbc.Driver -Ddb.name=alfresco -Ddb.url=jdbc:mysql://localhost:3307/alfresco -Ddb.username=alfresco -Ddb.password=alfresco - - - name: "Repository - MySQL 8 tests" - if: (branch =~ /(release\/.*$|master)/ AND commit_message !~ /\[skip db\]/ AND type != pull_request) OR commit_message =~ /\[db\]/ OR commit_message =~ /\[latest db\]/ - before_script: - - docker run -d -p 3307:3306 -e MYSQL_ROOT_PASSWORD=alfresco -e MYSQL_USER=alfresco -e MYSQL_DATABASE=alfresco -e MYSQL_PASSWORD=alfresco mysql:8 --transaction-isolation='READ-COMMITTED' - - docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1 - script: travis_wait 20 mvn -B test -pl repository -Dtest=AllDBTestsTestSuite -Ddb.driver=com.mysql.jdbc.Driver -Ddb.name=alfresco -Ddb.url=jdbc:mysql://localhost:3307/alfresco -Ddb.username=alfresco -Ddb.password=alfresco - - - name: "Repository - PostgreSQL 10.9 tests" - if: (branch =~ /(release\/.*$|master)/ AND commit_message !~ /\[skip db\]/ AND type != pull_request) OR commit_message =~ /\[db\]/ - before_script: - - docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:10.9 postgres -c 'max_connections=300' - - docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1 - script: travis_wait 20 mvn -B test -pl repository -Dtest=AllDBTestsTestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco - - - name: "Repository - PostgreSQL 11.7 tests" - if: (branch =~ /(release\/.*$|master)/ AND commit_message !~ /\[skip db\]/ AND type != pull_request) OR commit_message =~ /\[db\]/ - before_script: - - docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:11.7 postgres -c 'max_connections=300' - - docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1 - script: travis_wait 20 mvn -B test -pl repository -Dtest=AllDBTestsTestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco - - - name: "Repository - PostgreSQL 12.4 tests" - if: (branch =~ /(release\/.*$|master)/ AND commit_message !~ /\[skip db\]/ AND type != pull_request) OR commit_message =~ /\[db\]/ - before_script: - - docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:12.4 postgres -c 'max_connections=300' - - docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1 - script: travis_wait 20 mvn -B test -pl repository -Dtest=AllDBTestsTestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco - - - name: "Repository - PostgreSQL 13.1 tests" - # We only run DB tests on the latest version of PostgreSQL on feature branches - if: (branch =~ /(release\/.*$|master)/ AND commit_message !~ /\[skip db\]/ AND type != pull_request) OR commit_message =~ /\[db\]/ - before_script: - - docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:13.1 postgres -c 'max_connections=300' - - docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1 - script: travis_wait 20 mvn -B test -pl repository -Dtest=AllDBTestsTestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco - - - name: "Remote-api - AppContext01TestSuite" - if: commit_message !~ /\[skip repo\]/ - before_script: - - docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:13.1 postgres -c 'max_connections=300' - - docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1 - script: travis_wait 20 mvn -B test -pl remote-api -Dtest=AppContext01TestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco - - - name: "Remote-api - AppContext02TestSuite" - if: commit_message !~ /\[skip repo\]/ - before_script: - - docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:13.1 postgres -c 'max_connections=300' - - docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1 - - docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.4.0 - script: travis_wait 20 mvn -B test -pl remote-api -Dtest=AppContext02TestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco - - - name: "Remote-api - AppContext03TestSuite" - if: commit_message !~ /\[skip repo\]/ - before_script: - - docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:13.1 postgres -c 'max_connections=300' - - docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1 - - docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.4.0 - script: travis_wait 20 mvn -B test -pl remote-api -Dtest=AppContext03TestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco - - - name: "Remote-api - AppContext04TestSuite" - if: commit_message !~ /\[skip repo\]/ - before_script: - - docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:13.1 postgres -c 'max_connections=300' - - docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1 - - docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.4.0 - script: travis_wait 20 mvn -B test -pl remote-api -Dtest=AppContext04TestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco - - - name: "Remote-api - AppContextExtraTestSuite" - if: commit_message !~ /\[skip repo\]/ - before_script: - - docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:13.1 postgres -c 'max_connections=300' - - docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1 - script: travis_wait 20 mvn -B test -pl remote-api -Dtest=AppContextExtraTestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco - - - name: "REST API TAS tests part1" - # TAS tests are generally skipped on feature branches as they will be repeated on the enterprise repo or community packaging builds - if: (branch =~ /(release\/.*$|master)/ AND commit_message !~ /\[skip tas\]/) OR commit_message =~ /\[tas\]/ - before_script: - - ${TAS_SCRIPTS}/start-compose.sh ${TAS_ENVIRONMENT}/docker-compose-minimal+transforms.yml - - ${TAS_SCRIPTS}/wait-for-alfresco-start.sh "http://localhost:8082/alfresco" - script: - - travis_wait 60 mvn -B install -f packaging/tests/tas-restapi/pom.xml -Pall-tas-tests,run-restapi-part1 -Denvironment=default -DrunBugs=false - - - name: "REST API TAS tests part2" - if: (branch =~ /(release\/.*$|master)/ AND commit_message !~ /\[skip tas\]/) OR commit_message =~ /\[tas\]/ - before_script: - - ${TAS_SCRIPTS}/start-compose.sh ${TAS_ENVIRONMENT}/docker-compose-minimal+transforms.yml - - ${TAS_SCRIPTS}/wait-for-alfresco-start.sh "http://localhost:8082/alfresco" - script: - - travis_wait 60 mvn -B install -f packaging/tests/tas-restapi/pom.xml -Pall-tas-tests,run-restapi-part2 -Denvironment=default -DrunBugs=false - - - name: "REST API TAS tests part3" - if: (branch =~ /(release\/.*$|master)/ AND commit_message !~ /\[skip tas\]/) OR commit_message =~ /\[tas\]/ - before_script: - - ${TAS_SCRIPTS}/start-compose.sh ${TAS_ENVIRONMENT}/docker-compose-minimal+transforms.yml - - ${TAS_SCRIPTS}/wait-for-alfresco-start.sh "http://localhost:8082/alfresco" - script: - - travis_wait 60 mvn -B install -f packaging/tests/tas-restapi/pom.xml -Pall-tas-tests,run-restapi-part3 -Denvironment=default -DrunBugs=false - - - name: "CMIS TAS tests - BROWSER binding" - if: (branch =~ /(release\/.*$|master)/ AND commit_message !~ /\[skip tas\]/) OR commit_message =~ /\[tas\]/ - before_script: - - ${TAS_SCRIPTS}/start-compose.sh ${TAS_ENVIRONMENT}/docker-compose-minimal+transforms.yml - - ${TAS_SCRIPTS}/wait-for-alfresco-start.sh "http://localhost:8082/alfresco" - script: - - travis_wait 40 mvn -B install -f packaging/tests/tas-cmis/pom.xml -Pall-tas-tests,run-cmis-browser -Denvironment=default -DrunBugs=false - - - name: "CMIS TAS tests - ATOM binding" - if: (branch =~ /(release\/.*$|master)/ AND commit_message !~ /\[skip tas\]/) OR commit_message =~ /\[tas\]/ - before_script: - - ${TAS_SCRIPTS}/start-compose.sh ${TAS_ENVIRONMENT}/docker-compose-minimal+transforms.yml - - ${TAS_SCRIPTS}/wait-for-alfresco-start.sh "http://localhost:8082/alfresco" - script: - - travis_wait 40 mvn -B install -f packaging/tests/tas-cmis/pom.xml -Pall-tas-tests,run-cmis-atom -Denvironment=default -DrunBugs=false - - - name: "CMIS TAS tests - WEBSERVICES binding" - if: (branch =~ /(release\/.*$|master)/ AND commit_message !~ /\[skip tas\]/) OR commit_message =~ /\[tas\]/ - before_script: - - ${TAS_SCRIPTS}/start-compose.sh ${TAS_ENVIRONMENT}/docker-compose-minimal+transforms.yml - - ${TAS_SCRIPTS}/wait-for-alfresco-start.sh "http://localhost:8082/alfresco" - script: - - travis_wait 40 mvn -B install -f packaging/tests/tas-cmis/pom.xml -Pall-tas-tests,run-cmis-webservices -Denvironment=default -DrunBugs=false - - - name: "Email TAS tests" - if: (branch =~ /(release\/.*$|master)/ AND commit_message !~ /\[skip tas\]/) OR commit_message =~ /\[tas\]/ - before_script: - - ${TAS_SCRIPTS}/start-compose.sh ${TAS_ENVIRONMENT}/docker-compose-minimal.yml - - ${TAS_SCRIPTS}/wait-for-alfresco-start.sh "http://localhost:8082/alfresco" - script: - - travis_wait 30 mvn -B install -f packaging/tests/tas-email/pom.xml -Pall-tas-tests -Denvironment=default -DrunBugs=false - - - name: "WebDAV TAS tests" - if: (branch =~ /(release\/.*$|master)/ AND commit_message !~ /\[skip tas\]/) OR commit_message =~ /\[tas\]/ - before_script: - - ${TAS_SCRIPTS}/start-compose.sh ${TAS_ENVIRONMENT}/docker-compose-minimal.yml - - ${TAS_SCRIPTS}/wait-for-alfresco-start.sh "http://localhost:8082/alfresco" - script: - - travis_wait 30 mvn -B install -f packaging/tests/tas-webdav/pom.xml -Pall-tas-tests -Denvironment=default -DrunBugs=false - - - name: "Integration TAS tests" - if: (branch =~ /(release\/.*$|master)/ AND commit_message !~ /\[skip tas\]/) OR commit_message =~ /\[tas\]/ - before_script: - - ${TAS_SCRIPTS}/start-compose.sh ${TAS_ENVIRONMENT}/docker-compose-minimal.yml - - ${TAS_SCRIPTS}/wait-for-alfresco-start.sh "http://localhost:8082/alfresco" - script: - - travis_wait 30 mvn -B install -f packaging/tests/tas-integration/pom.xml -Pall-tas-tests -Denvironment=default -DrunBugs=false - - - name: "Push to Nexus" - stage: release - before_script: bash scripts/travis/verify_release_tag.sh - script: travis_wait 40 bash scripts/travis/maven_release.sh - - - name: "Update alfresco-enterprise-repo" - stage: update_downstream - 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}" - diff --git a/README.md b/README.md index d4ff31e0ee..61960c4ac8 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # alfresco-community-repo -[![Build Status](https://travis-ci.com/Alfresco/alfresco-community-repo.svg?branch=master)](https://travis-ci.com/Alfresco/alfresco-community-repo) +[![Build Status](https://github.com/Alfresco/alfresco-community-repo/actions/workflows/master_release.yml/badge.svg?branch=release/7.0.1)](https://github.com/Alfresco/alfresco-community-repo/actions/workflows/master_release.yml) This project contains the bulk of the [Alfresco Content Services Repository](https://community.alfresco.com/docs/DOC-6385-project-overview-repository) code. diff --git a/packaging/tests/scripts/output_logs_for_failures.sh b/packaging/tests/scripts/output_logs_for_failures.sh new file mode 100755 index 0000000000..4fb71d2050 --- /dev/null +++ b/packaging/tests/scripts/output_logs_for_failures.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash + +TAS_DIRECTORY=$1 + +cd ${TAS_DIRECTORY} + +failures=$(grep 'status="FAIL"' target/surefire-reports/testng-results.xml | sed 's|^.*[ ]name="\([^"]*\)".*$|\1|g') + +for failure in ${failures} +do + cat target/reports/alfresco-tas.log | sed '/STARTING Test: \['${failure}'\]/,/ENDING Test: \['${failure}'\]/!d;/ENDING Test: \['${failure}'\]/q' +done diff --git a/packaging/tests/scripts/output_tests_run.sh b/packaging/tests/scripts/output_tests_run.sh new file mode 100755 index 0000000000..cd7c630cbf --- /dev/null +++ b/packaging/tests/scripts/output_tests_run.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +TAS_DIRECTORY=$1 + +cd ${TAS_DIRECTORY} + +cat target/reports/alfresco-tas.log | grep -a "*** STARTING" diff --git a/packaging/tests/scripts/start-compose.sh b/packaging/tests/scripts/start-compose.sh index 96c5cacf20..c7b97738dc 100755 --- a/packaging/tests/scripts/start-compose.sh +++ b/packaging/tests/scripts/start-compose.sh @@ -1,7 +1,18 @@ #!/usr/bin/env bash export DOCKER_COMPOSE_PATH=$1 -export CLEAN_UP="$2" +export DOCKER_COMPOSES="" +export CLEAN_UP="" + +for var in "$@" +do + if [ "$var" == "no-clean-up" ] + then + export CLEAN_UP="$var" + else + export DOCKER_COMPOSES+="--file $var " + fi +done if [ -z "$DOCKER_COMPOSE_PATH" ] then @@ -15,8 +26,8 @@ fi # The second parameter can be used to avoid doing a clean up if we are doing a restart test. if [ "$CLEAN_UP" != "no-clean-up" ] then - docker-compose --file "${DOCKER_COMPOSE_PATH}" kill - docker-compose --file "${DOCKER_COMPOSE_PATH}" rm -f + docker-compose ${DOCKER_COMPOSES} --project-directory $(dirname "${DOCKER_COMPOSE_PATH}") kill + docker-compose ${DOCKER_COMPOSES} --project-directory $(dirname "${DOCKER_COMPOSE_PATH}") rm -f export GENERATED_IMAGES=$(docker images | grep '^environment_' | awk '{ print $3 }') if [ -n "$GENERATED_IMAGES" ] @@ -28,7 +39,7 @@ fi echo "Starting ACS stack in ${DOCKER_COMPOSE_PATH}" # .env files are picked up from project directory correctly on docker-compose 1.23.0+ -docker-compose --file "${DOCKER_COMPOSE_PATH}" --project-directory $(dirname "${DOCKER_COMPOSE_PATH}") up -d +docker-compose ${DOCKER_COMPOSES} --project-directory $(dirname "${DOCKER_COMPOSE_PATH}") up -d if [ $? -eq 0 ] then diff --git a/packaging/tests/tas-webdav/src/test/java/org/alfresco/webdav/WebDavTest.java b/packaging/tests/tas-webdav/src/test/java/org/alfresco/webdav/WebDavTest.java index f75eed0f92..2b95980194 100644 --- a/packaging/tests/tas-webdav/src/test/java/org/alfresco/webdav/WebDavTest.java +++ b/packaging/tests/tas-webdav/src/test/java/org/alfresco/webdav/WebDavTest.java @@ -1,17 +1,25 @@ package org.alfresco.webdav; +import java.lang.reflect.Method; + +import org.alfresco.utility.LogFactory; import org.alfresco.utility.data.DataContent; import org.alfresco.utility.data.DataSite; import org.alfresco.utility.data.DataUser; import org.alfresco.utility.network.ServerHealth; +import org.slf4j.Logger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.testng.AbstractTestNGSpringContextTests; +import org.testng.annotations.AfterMethod; +import org.testng.annotations.BeforeMethod; import org.testng.annotations.BeforeSuite; @ContextConfiguration("classpath:alfresco-webdav-context.xml") public abstract class WebDavTest extends AbstractTestNGSpringContextTests { + private static final Logger LOG = LogFactory.getLogger(); + @Autowired protected DataSite dataSite; @@ -36,4 +44,16 @@ public abstract class WebDavTest extends AbstractTestNGSpringContextTests // The webdav protocol is enabled by default. //webDavProtocol.assertThat().protocolIsEnabled(); } + + @BeforeMethod(alwaysRun=true) + public void showStartTestInfo(Method method) + { + LOG.info(String.format("*** STARTING Test: [%s] ***", method.getName())); + } + + @AfterMethod(alwaysRun=true) + public void showEndTestInfo(Method method) + { + LOG.info(String.format("*** ENDING Test: [%s] ***", method.getName())); + } } diff --git a/repository/src/main/java/org/alfresco/repo/urlshortening/BitlyUrlShortenerImpl.java b/repository/src/main/java/org/alfresco/repo/urlshortening/BitlyUrlShortenerImpl.java deleted file mode 100644 index e59289eca1..0000000000 --- a/repository/src/main/java/org/alfresco/repo/urlshortening/BitlyUrlShortenerImpl.java +++ /dev/null @@ -1,140 +0,0 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.repo.urlshortening; - -import java.util.ArrayList; -import java.util.List; - -import org.alfresco.service.cmr.urlshortening.UrlShortener; -import org.apache.commons.httpclient.HostConfiguration; -import org.apache.commons.httpclient.HttpClient; -import org.apache.commons.httpclient.MultiThreadedHttpConnectionManager; -import org.apache.commons.httpclient.NameValuePair; -import org.apache.commons.httpclient.methods.GetMethod; -import org.apache.commons.httpclient.protocol.Protocol; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * @deprecated as it is no longer used in the core repository code. - */ -@Deprecated -public class BitlyUrlShortenerImpl implements UrlShortener -{ - private static final Log log = LogFactory.getLog(BitlyUrlShortenerImpl.class); - - private int urlLength = 20; - private String username; - private String apiKey = "R_ca15c6c89e9b25ccd170bafd209a0d4f"; - private HttpClient httpClient; - - public BitlyUrlShortenerImpl() - { - httpClient = new HttpClient(); - httpClient.setHttpConnectionManager(new MultiThreadedHttpConnectionManager()); - HostConfiguration hostConfiguration = new HostConfiguration(); - hostConfiguration.setHost("api-ssl.bitly.com", 443, Protocol.getProtocol("https")); - httpClient.setHostConfiguration(hostConfiguration); - } - - @Override - public String shortenUrl(String longUrl) - { - if (log.isDebugEnabled()) - { - log.debug("Shortening URL: " + longUrl); - } - String shortUrl = longUrl; - if (longUrl.length() > urlLength) - { - GetMethod getMethod = new GetMethod(); - getMethod.setPath("/v3/shorten"); - - List args = new ArrayList(); - args.add(new NameValuePair("login", username)); - args.add(new NameValuePair("apiKey", apiKey)); - args.add(new NameValuePair("longUrl", longUrl)); - args.add(new NameValuePair("format", "txt")); - getMethod.setQueryString(args.toArray(new NameValuePair[args.size()])); - - try - { - int resultCode = httpClient.executeMethod(getMethod); - if (resultCode == 200) - { - shortUrl = getMethod.getResponseBodyAsString(); - } - else - { - log.warn("Failed to shorten URL " + longUrl + " - response code == " + resultCode); - log.warn(getMethod.getResponseBodyAsString()); - } - } - catch (Exception ex) - { - log.error("Failed to shorten URL " + longUrl, ex); - } - if (log.isDebugEnabled()) - { - log.debug("URL " + longUrl + " has been shortened to " + shortUrl); - } - } - return shortUrl.trim(); - } - - /** - * {@inheritDoc} - */ - @Override - public int getUrlLength() - { - return urlLength; - } - - /** - * @param urlLength the urlLength to set - */ - public void setUrlLength(int urlLength) - { - this.urlLength = urlLength; - } - - /** - * @param username the username to set - */ - public void setUsername(String username) - { - this.username = username; - } - - /** - * @param apiKey the apiKey to set - */ - public void setApiKey(String apiKey) - { - this.apiKey = apiKey; - } -} \ No newline at end of file diff --git a/repository/src/test/java/org/alfresco/AllUnitTestsSuite.java b/repository/src/test/java/org/alfresco/AllUnitTestsSuite.java index d031dc42ec..921789ae86 100644 --- a/repository/src/test/java/org/alfresco/AllUnitTestsSuite.java +++ b/repository/src/test/java/org/alfresco/AllUnitTestsSuite.java @@ -75,7 +75,6 @@ import org.junit.runners.Suite; org.alfresco.repo.transfer.HttpClientTransmitterImplTest.class, org.alfresco.repo.transfer.manifest.TransferManifestTest.class, org.alfresco.repo.transfer.TransferVersionCheckerImplTest.class, - org.alfresco.repo.urlshortening.BitlyUrlShortenerTest.class, org.alfresco.service.cmr.calendar.CalendarRecurrenceHelperTest.class, org.alfresco.service.cmr.calendar.CalendarTimezoneHelperTest.class, org.alfresco.tools.RenameUserTest.class, @@ -110,6 +109,7 @@ import org.junit.runners.Suite; org.alfresco.util.schemacomp.validator.NameValidatorTest.class, org.alfresco.util.schemacomp.validator.SchemaVersionValidatorTest.class, org.alfresco.util.schemacomp.validator.TypeNameOnlyValidatorTest.class, + org.alfresco.util.test.junitrules.RetryAtMostRuleTest.class, org.alfresco.util.test.junitrules.TemporaryMockOverrideTest.class, org.alfresco.repo.search.impl.solr.AbstractSolrQueryHTTPClientTest.class, org.alfresco.repo.search.impl.solr.SpellCheckDecisionManagerTest.class, diff --git a/repository/src/test/java/org/alfresco/repo/domain/permissions/FixedAclUpdaterTest.java b/repository/src/test/java/org/alfresco/repo/domain/permissions/FixedAclUpdaterTest.java index cebd5b8070..865ea6e3ea 100644 --- a/repository/src/test/java/org/alfresco/repo/domain/permissions/FixedAclUpdaterTest.java +++ b/repository/src/test/java/org/alfresco/repo/domain/permissions/FixedAclUpdaterTest.java @@ -25,6 +25,11 @@ */ package org.alfresco.repo.domain.permissions; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; @@ -61,12 +66,15 @@ import org.alfresco.service.cmr.security.PermissionService; import org.alfresco.service.namespace.QName; import org.alfresco.util.ApplicationContextHelper; import org.alfresco.util.Pair; +import org.alfresco.util.test.junitrules.RetryAtMostRule; +import org.alfresco.util.test.junitrules.RetryAtMostRule.RetryAtMost; +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; import org.junit.Test; import org.springframework.context.ApplicationContext; import org.springframework.dao.ConcurrencyFailureException; -import junit.framework.TestCase; - /** * Test class for {@link FixedAclUpdater} * @@ -75,7 +83,7 @@ import junit.framework.TestCase; * @since 4.2.7 * */ -public class FixedAclUpdaterTest extends TestCase +public class FixedAclUpdaterTest { private ApplicationContext ctx; private RetryingTransactionHelper txnHelper; @@ -99,7 +107,10 @@ public class FixedAclUpdaterTest extends TestCase private static String TEST_GROUP_NAME_FULL = PermissionService.GROUP_PREFIX + TEST_GROUP_NAME; private static String DEFAULT_PERMISSION = PermissionService.CONTRIBUTOR; - @Override + @Rule + public RetryAtMostRule retryAtMostRule = new RetryAtMostRule(); + + @Before public void setUp() throws Exception { ctx = ApplicationContextHelper.getApplicationContext(); @@ -122,7 +133,7 @@ public class FixedAclUpdaterTest extends TestCase setFixedAclMaxTransactionTime(permissionsDaoComponent, homeFolderNodeRef, maxTransactionTime); } - @Override + @After public void tearDown() throws Exception { AuthenticationUtil.clearCurrentSecurityContext(); @@ -198,6 +209,7 @@ public class FixedAclUpdaterTest extends TestCase * Test setting permissions explicitly as async */ @Test + @RetryAtMost(3) public void testAsync() { NodeRef folderRef = createFolderHierarchyInRootForFolderTests("testAsyncFolder"); @@ -244,6 +256,7 @@ public class FixedAclUpdaterTest extends TestCase * MNT-21847 - Create a new content in folder that has the aspect applied */ @Test + @RetryAtMost(3) public void testAsyncWithNodeCreation() { NodeRef folderRef = createFolderHierarchyInRootForFolderTests("testAsyncWithNodeCreationFolder"); @@ -274,6 +287,7 @@ public class FixedAclUpdaterTest extends TestCase * MNT-22009 - Delete node that has the aspect applied before job runs */ @Test + @RetryAtMost(3) public void testAsyncWithNodeDeletion() { NodeRef folderRef = createFolderHierarchyInRootForFolderTests("testAsyncWithNodeDeletionFolder"); @@ -364,6 +378,7 @@ public class FixedAclUpdaterTest extends TestCase * MNT-22040 - Copy node that has the aspect applied before job runs */ @Test + @RetryAtMost(3) public void testAsyncWithNodeCopy() { NodeRef folderRef = createFolderHierarchyInRootForFolderTests("testAsyncWithNodeCopyOriginFolder"); @@ -443,6 +458,7 @@ public class FixedAclUpdaterTest extends TestCase * Copy node that has the aspect to another folder that also has the aspect applied before job runs */ @Test + @RetryAtMost(3) public void testAsyncWithNodeCopyToPendingFolder() { NodeRef folderRef = createFolderHierarchyInRootForFolderTests("testAsyncWithNodeCopyOriginFolder"); @@ -534,6 +550,7 @@ public class FixedAclUpdaterTest extends TestCase * runs */ @Test + @RetryAtMost(3) public void testAsyncWithNodeCopyParentToChildPendingFolder() { NodeRef folderRef = createFolderHierarchyInRootForFolderTests("testAsyncWithNodeCopyOriginFolder"); @@ -645,6 +662,7 @@ public class FixedAclUpdaterTest extends TestCase * runs */ @Test + @RetryAtMost(3) public void testAsyncWithNodeMoveChildToChildPendingFolder() { NodeRef folderRef = createFolderHierarchyInRootForFolderTests("testAsyncWithNodeMoveChildToChildPendingFolderOrigin"); @@ -730,6 +748,7 @@ public class FixedAclUpdaterTest extends TestCase * ACL */ @Test + @RetryAtMost(3) public void testAsyncWithErrorsForceSharedACL() { NodeRef folderRef = createFolderHierarchyInRootForFolderTests("testAsyncWithErrorsForceSharedACL"); @@ -788,6 +807,7 @@ public class FixedAclUpdaterTest extends TestCase * MNT-22040 - Move node that has the aspect applied before job runs */ @Test + @RetryAtMost(3) public void testAsyncWithNodeMove() { NodeRef folderRef = createFolderHierarchyInRootForFolderTests("testAsyncWithNodeMoveOriginFolder"); @@ -864,6 +884,7 @@ public class FixedAclUpdaterTest extends TestCase * Move node that has the aspect to another folder that also has the aspect applied before job runs */ @Test + @RetryAtMost(3) public void testAsyncWithNodeMoveToPendingFolder() { NodeRef folderRef = createFolderHierarchyInRootForFolderTests("testAsyncWithNodeMoveOriginFolder"); @@ -952,6 +973,7 @@ public class FixedAclUpdaterTest extends TestCase * Lock node that has the aspect applied before job runs */ @Test + @RetryAtMost(3) public void testAsyncWithNodeLock() { NodeRef folderRef = createFolderHierarchyInRootForFileTests("testAsyncWithNodeLockFolder"); @@ -981,6 +1003,7 @@ public class FixedAclUpdaterTest extends TestCase * Checkout a node for editing that has the aspect applied before job runs */ @Test + @RetryAtMost(3) public void testAsyncWithNodeCheckout() { NodeRef folderRef = createFolderHierarchyInRootForFileTests("testAsyncWithNodeCheckoutFolder"); @@ -1011,6 +1034,7 @@ public class FixedAclUpdaterTest extends TestCase * Update the permissions of a node that has the aspect applied (new permissions: fixed) */ @Test + @RetryAtMost(3) public void testAsyncWithNodeUpdatePermissionsFixed() { NodeRef folderRef = createFolderHierarchyInRootForFolderTests("testAsyncWithNodeUpdatePermissionsFixedFolder"); @@ -1052,6 +1076,7 @@ public class FixedAclUpdaterTest extends TestCase * Update the permissions of a node that has the aspect applied (new permissions: shared) */ @Test + @RetryAtMost(3) public void testAsyncWithNodeUpdatePermissionsShared() { NodeRef folderRef = createFolderHierarchyInRootForFolderTests("testAsyncWithNodeUpdatePermissionsSharedFolder"); @@ -1090,6 +1115,7 @@ public class FixedAclUpdaterTest extends TestCase * Update the permissions of the parent of a node that has the aspect applied (new permissions: fixed) */ @Test + @RetryAtMost(3) public void testAsyncWithParentUpdatePermissionsFixed() { NodeRef folderRef = createFolderHierarchyInRootForFolderTests("testAsyncWithParentUpdatePermissionsFixedFolder"); @@ -1131,6 +1157,7 @@ public class FixedAclUpdaterTest extends TestCase * Update the permissions of the parent of a node that has the aspect applied (new permissions: shared) */ @Test + @RetryAtMost(3) public void testAsyncWithParentUpdatePermissionsShared() { NodeRef folderRef = createFolderHierarchyInRootForFolderTests("testAsyncWithParentUpdatePermissionsSharedFolder"); @@ -1169,6 +1196,7 @@ public class FixedAclUpdaterTest extends TestCase } @Test + @RetryAtMost(3) public void testAsyncCascadeUpdatePermissions() { NodeRef folderRef = createFolderHierarchyInRootForFolderTests("testAsyncCascadeUpdatePermissionsFolder"); @@ -1221,6 +1249,7 @@ public class FixedAclUpdaterTest extends TestCase * Update the content of a node that has the aspect applied before job runs */ @Test + @RetryAtMost(3) public void testAsyncWithNodeContentUpdate() { NodeRef folderRef = createFolderHierarchyInRootForFileTests("testAsyncWithNodeContentUpdateFolder"); @@ -1253,6 +1282,7 @@ public class FixedAclUpdaterTest extends TestCase * Test setting permissions concurrently to actually cause the expected concurrency exception */ @Test + @RetryAtMost(3) public void testAsyncConcurrentPermissionsUpdate() throws Throwable { NodeRef folderRef = createFolderHierarchyInRootForFolderTests("testAsyncConcurrentPermissionsUpdateFolder"); @@ -1324,6 +1354,7 @@ public class FixedAclUpdaterTest extends TestCase * exception but the job should be able to recover */ @Test + @RetryAtMost(3) public void testAsyncConcurrentUpdateAndJob() throws Throwable { NodeRef folderRef = createFolderHierarchyInRootForFolderTests("testAsyncConcurrentUpdateAndJobFolder"); diff --git a/repository/src/test/java/org/alfresco/repo/security/SecurityTestSuite.java b/repository/src/test/java/org/alfresco/repo/security/SecurityTestSuite.java index 2509caecc7..4382fa91cc 100644 --- a/repository/src/test/java/org/alfresco/repo/security/SecurityTestSuite.java +++ b/repository/src/test/java/org/alfresco/repo/security/SecurityTestSuite.java @@ -99,7 +99,7 @@ public class SecurityTestSuite extends TestSuite suite.addTest(new JUnit4TestAdapter(HomeFolderProviderSynchronizerTest.class)); suite.addTest(new JUnit4TestAdapter(AlfrescoSSLSocketFactoryTest.class)); - suite.addTestSuite(FixedAclUpdaterTest.class); + suite.addTest(new JUnit4TestAdapter(FixedAclUpdaterTest.class)); suite.addTestSuite(DefaultRemoteUserMapperTest.class); suite.addTestSuite(IdentityServiceRemoteUserMapperTest.class); diff --git a/repository/src/test/java/org/alfresco/repo/urlshortening/BitlyUrlShortenerTest.java b/repository/src/test/java/org/alfresco/repo/urlshortening/BitlyUrlShortenerTest.java deleted file mode 100644 index c75e64e7e6..0000000000 --- a/repository/src/test/java/org/alfresco/repo/urlshortening/BitlyUrlShortenerTest.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.repo.urlshortening; - -import junit.framework.TestCase; - -/** - * @deprecated as BitlyUrlShortenerImpl is no longer used in the core repository code. - */ -@Deprecated -public class BitlyUrlShortenerTest extends TestCase -{ - private BitlyUrlShortenerImpl shortener; - - public void testShorten() - { - String url = "http://www.alfresco.com/"; - String shortUrl = shortener.shortenUrl(url); - assertNotNull(shortUrl); - assertFalse(shortUrl.isEmpty()); - assertFalse(url.equals(shortUrl)); - assertTrue(shortUrl.length() < url.length()); - } - - /** - * {@inheritDoc} - */ - @Override - protected void setUp() throws Exception - { - this.shortener = new BitlyUrlShortenerImpl();; - shortener.setApiKey("R_ca15c6c89e9b25ccd170bafd209a0d4f"); - shortener.setUrlLength(20); - shortener.setUsername("brianalfresco"); - } -} diff --git a/repository/src/test/java/org/alfresco/util/test/junitrules/RetryAtMostRule.java b/repository/src/test/java/org/alfresco/util/test/junitrules/RetryAtMostRule.java new file mode 100644 index 0000000000..1ca090c579 --- /dev/null +++ b/repository/src/test/java/org/alfresco/util/test/junitrules/RetryAtMostRule.java @@ -0,0 +1,132 @@ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2022 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ +package org.alfresco.util.test.junitrules; + +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.junit.Test; +import org.junit.rules.TestRule; +import org.junit.runner.Description; +import org.junit.runners.model.Statement; + +/** + * This JUnit rule can be used to turn existing test code into retryable tests. + * The test methods marked with the {@link RetryAtMost} annotation will be attempted at most the specified + * amount of times, stopping at the first successful execution. + * + * @author Domenico Sibilio + */ +public class RetryAtMostRule implements TestRule +{ + private static final Log LOG = LogFactory.getLog(RetryAtMostRule.class); + + @Override + public Statement apply(final Statement statement, final Description description) + { + RetryAtMost retryAtMost = description.getAnnotation(RetryAtMost.class); + + if (retryAtMost != null) + { + return new RetryAtMostTestStatement(statement, description, retryAtMost.value()); + } + + return statement; + } + + private static class RetryAtMostTestStatement extends Statement + { + private final Statement statement; + private final Description description; + private final int retryCount; + + private RetryAtMostTestStatement(Statement statement, Description description, int retryCount) + { + this.statement = statement; + this.description = description; + this.retryCount = retryCount; + } + + @Override + public void evaluate() throws Throwable + { + validate(); + for (int i = 0; i < retryCount; i++) + { + try + { + LOG.debug( + "Retryable testing configured for method: " + description.getMethodName() + + " // Attempt #" + (i + 1)); + statement.evaluate(); + break; // stop at the first successful execution + } + catch (Throwable t) + { + // ignore failed test runs unless it's the last possible execution + if (isLastExecution(i)) + { + throw t; + } + } + } + } + + private void validate() + { + if (retryCount < 1) + { + String methodName = description.getMethodName(); + throw new IllegalArgumentException( + "Invalid value for @RetryAtMost on method " + methodName + ": " + retryCount + " is less than 1."); + } + } + + private boolean isLastExecution(int i) + { + return i == retryCount - 1; + } + } + + /** + * This annotation is a marker used to identify a JUnit @{@link Test} method as a retryable test. + */ + @Target(ElementType.METHOD) + @Retention(RetentionPolicy.RUNTIME) + @Documented + public @interface RetryAtMost + { + /** + * @return The amount of times a test will be attempted, at most. + */ + int value() default 1; + } +} diff --git a/repository/src/test/java/org/alfresco/util/test/junitrules/RetryAtMostRuleTest.java b/repository/src/test/java/org/alfresco/util/test/junitrules/RetryAtMostRuleTest.java new file mode 100644 index 0000000000..f49f861094 --- /dev/null +++ b/repository/src/test/java/org/alfresco/util/test/junitrules/RetryAtMostRuleTest.java @@ -0,0 +1,138 @@ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2022 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ +package org.alfresco.util.test.junitrules; + +import static org.junit.Assert.assertSame; +import static org.mockito.Mockito.doThrow; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyNoInteractions; + +import java.lang.annotation.Annotation; +import java.util.concurrent.atomic.AtomicInteger; + +import org.alfresco.util.test.junitrules.RetryAtMostRule.RetryAtMost; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; +import org.junit.runner.Description; +import org.junit.runner.RunWith; +import org.junit.runners.model.Statement; +import org.mockito.Mock; +import org.mockito.junit.MockitoJUnitRunner; + +/** + * Test class for {@link RetryAtMostRule}. + * + * @author Domenico Sibilio + */ +@RunWith(MockitoJUnitRunner.class) +public class RetryAtMostRuleTest +{ + + private static final String ANNOTATION_WITH_NEGATIVE_VALUE = "annotationRetryAtMostNegativeTimes"; + private static final String ANNOTATION_RETRY_AT_MOST_THRICE = "annotationRetryAtMostThrice"; + private static final AtomicInteger EXECUTION_COUNT = new AtomicInteger(0); + @Rule + public RetryAtMostRule retryAtMostRule = new RetryAtMostRule(); + @Rule + public TestName testNameRule = new TestName(); + @Mock + private Statement statementMock; + + @Test + public void testSucceedOnFirstAttempt() throws Throwable + { + Description description = Description.createTestDescription(RetryAtMostRuleTest.class.getSimpleName(), + testNameRule.getMethodName(), getAnnotationByMethodName(ANNOTATION_RETRY_AT_MOST_THRICE)); + + Statement statement = retryAtMostRule.apply(statementMock, description); + statement.evaluate(); + verify(statementMock, times(1)).evaluate(); + } + + @Test + public void testSucceedOnSecondAttempt() throws Throwable + { + doThrow(new AssertionError("First execution should fail")).doNothing().when(statementMock).evaluate(); + + Description description = Description.createTestDescription(RetryAtMostRuleTest.class.getSimpleName(), + testNameRule.getMethodName(), getAnnotationByMethodName(ANNOTATION_RETRY_AT_MOST_THRICE)); + + Statement statement = retryAtMostRule.apply(statementMock, description); + statement.evaluate(); + verify(statementMock, times(2)).evaluate(); + } + + @Test + @RetryAtMost(3) + public void testSucceedOnThirdAttempt() + { + int currentExecution = EXECUTION_COUNT.incrementAndGet(); + assertSame("This test should be executed 3 times", 3, currentExecution); + } + + @Test(expected = AssertionError.class) + public void testFailAfterMaxAttempts() throws Throwable + { + doThrow(new AssertionError("All executions should fail")).when(statementMock).evaluate(); + + Description description = Description.createTestDescription(RetryAtMostRuleTest.class.getSimpleName(), + testNameRule.getMethodName(), getAnnotationByMethodName(ANNOTATION_RETRY_AT_MOST_THRICE)); + + Statement statement = retryAtMostRule.apply(statementMock, description); + statement.evaluate(); + } + + @Test(expected = IllegalArgumentException.class) + public void testInvalidRetryAtMostTimes() throws Throwable + { + Description description = Description.createTestDescription(RetryAtMostRuleTest.class.getSimpleName(), + testNameRule.getMethodName(), getAnnotationByMethodName(ANNOTATION_WITH_NEGATIVE_VALUE)); + + Statement statement = retryAtMostRule.apply(statementMock, description); + statement.evaluate(); + verifyNoInteractions(statementMock); + } + + private Annotation getAnnotationByMethodName(String methodName) throws NoSuchMethodException + { + return this.getClass().getMethod(methodName).getAnnotation(RetryAtMost.class); + } + + @RetryAtMost(-1) + public void annotationRetryAtMostNegativeTimes() + { + // intentionally empty + } + + @RetryAtMost(3) + public void annotationRetryAtMostThrice() + { + // intentionally empty + } + +} \ No newline at end of file diff --git a/scripts/travis/build.sh b/scripts/ci/build.sh similarity index 58% rename from scripts/travis/build.sh rename to scripts/ci/build.sh index 2c4fff11d6..1710bee529 100644 --- a/scripts/travis/build.sh +++ b/scripts/ci/build.sh @@ -6,18 +6,21 @@ pushd "$(dirname "${BASH_SOURCE[0]}")/../../" source "$(dirname "${BASH_SOURCE[0]}")/build_functions.sh" -if isBranchBuild && [ "${TRAVIS_BRANCH}" = "master" ] && [ "${TRAVIS_BUILD_STAGE_NAME,,}" = "release" ] ; then - # update ":latest" image tags on remote repositories by using the maven *internal* profile - PROFILES="-Pinternal" -else +if [[ -n ${BUILD_PROFILES} ]]; then + PROFILES="${BUILD_PROFILES}" +elif [[ "${REQUIRES_LOCAL_IMAGES}" == "true" ]]; then # build the ":latest" image tags locally with the maven *communityDocker* profile PROFILES="-PcommunityDocker" fi -mvn -B -V install -DskipTests -Dmaven.javadoc.skip=true "${PROFILES}" +if [[ "${REQUIRES_INSTALLED_ARTIFACTS}" == "true" ]]; then + PHASE="install" +else + PHASE="package" +fi +mvn -B -V $PHASE -DskipTests -Dmaven.javadoc.skip=true $PROFILES $BUILD_OPTIONS popd set +vex -echo "=========================== Finishing Build Script ==========================" - +echo "=========================== Finishing Build Script ==========================" \ No newline at end of file diff --git a/scripts/travis/build_functions.sh b/scripts/ci/build_functions.sh similarity index 89% rename from scripts/travis/build_functions.sh rename to scripts/ci/build_functions.sh index be8247265f..103ed2e0ee 100644 --- a/scripts/travis/build_functions.sh +++ b/scripts/ci/build_functions.sh @@ -2,18 +2,18 @@ set +vx function isPullRequestBuild() { - test "${TRAVIS_PULL_REQUEST}" != "false" + test "${PULL_REQUEST}" != "false" } function isBranchBuild() { - test "${TRAVIS_PULL_REQUEST}" = "false" + test "${PULL_REQUEST}" = "false" } function cloneRepo() { local REPO="${1}" local TAG_OR_BRANCH="${2}" - printf "Clonning \"%s\" on %s\n" "${TAG_OR_BRANCH}" "${REPO}" + printf "Cloning \"%s\" on %s\n" "${TAG_OR_BRANCH}" "${REPO}" # clone the repository branch/tag pushd "$(dirname "${BASH_SOURCE[0]}")/../../../" >/dev/null @@ -82,15 +82,9 @@ function remoteBranchExists() { function identifyUpstreamSourceBranch() { local UPSTREAM_REPO="${1}" - # if it's a pull request, use the source branch name (if it exists) - if isPullRequestBuild && remoteBranchExists "${UPSTREAM_REPO}" "${TRAVIS_PULL_REQUEST_BRANCH}" ; then - echo "${TRAVIS_PULL_REQUEST_BRANCH}" - exit 0 - fi - # otherwise use the current branch name (or in case of PRs, the target branch name) - if remoteBranchExists "${UPSTREAM_REPO}" "${TRAVIS_BRANCH}" ; then - echo "${TRAVIS_BRANCH}" + if remoteBranchExists "${UPSTREAM_REPO}" "${BRANCH_NAME}" ; then + echo "${BRANCH_NAME}" exit 0 fi diff --git a/scripts/ci/cleanup_cache.sh b/scripts/ci/cleanup_cache.sh new file mode 100644 index 0000000000..3403895514 --- /dev/null +++ b/scripts/ci/cleanup_cache.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env bash +set -ev + +find "${HOME}/.m2/repository/" -type d -name "*-SNAPSHOT" | xargs -r -l rm -rf \ No newline at end of file diff --git a/scripts/ci/docker-compose/docker-compose-db.yaml b/scripts/ci/docker-compose/docker-compose-db.yaml new file mode 100644 index 0000000000..1e74d3f65d --- /dev/null +++ b/scripts/ci/docker-compose/docker-compose-db.yaml @@ -0,0 +1,40 @@ +version: "3" + +services: + postgres: + profiles: ["postgres"] + image: postgres:${POSTGRES_VERSION} + environment: + - POSTGRES_PASSWORD=alfresco + - POSTGRES_USER=alfresco + - POSTGRES_DB=alfresco + command: postgres -c max_connections=300 + ports: + - "5433:5432" + mariadb: + profiles: ["mariadb"] + image: mariadb:${MARIADB_VERSION} + command: --transaction-isolation=READ-COMMITTED --max-connections=300 --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci + environment: + - MYSQL_ROOT_PASSWORD=alfresco + - MYSQL_USER=alfresco + - MYSQL_DATABASE=alfresco + - MYSQL_PASSWORD=alfresco + ports: + - "3307:3306" + mysql: + profiles: ["mysql"] + image: mysql:${MYSQL_VERSION} + command: --transaction-isolation='READ-COMMITTED' + environment: + - MYSQL_ROOT_PASSWORD=alfresco + - MYSQL_USER=alfresco + - MYSQL_DATABASE=alfresco + - MYSQL_PASSWORD=alfresco + ports: + - "3307:3306" + activemq: + image: alfresco/alfresco-activemq:5.17.1-jre11-rockylinux8 + ports: + - "5672:5672" # AMQP + - "61616:61616" # OpenWire \ No newline at end of file diff --git a/scripts/ci/docker-compose/docker-compose.yaml b/scripts/ci/docker-compose/docker-compose.yaml new file mode 100644 index 0000000000..334c33ef1e --- /dev/null +++ b/scripts/ci/docker-compose/docker-compose.yaml @@ -0,0 +1,26 @@ +version: "3" + +services: + transform-core-aio: + profiles: ["with-transform-core-aio"] + image: alfresco/alfresco-transform-core-aio:2.4.0 + environment: + JAVA_OPTS: " -Xms256m -Xmx256m" + ports: + - "8090:8090" + postgres: + image: postgres:13.1 + profiles: ["default", "with-transform-core-aio", "postgres"] + environment: + - POSTGRES_PASSWORD=alfresco + - POSTGRES_USER=alfresco + - POSTGRES_DB=alfresco + command: postgres -c max_connections=300 + ports: + - "5433:5432" + activemq: + profiles: ["default", "with-transform-core-aio", "activemq"] + image: alfresco/alfresco-activemq:5.16.1 + ports: + - "5672:5672" # AMQP + - "61616:61616" # OpenWire \ No newline at end of file diff --git a/scripts/travis/init.sh b/scripts/ci/init.sh similarity index 50% rename from scripts/travis/init.sh rename to scripts/ci/init.sh index 2eb4e3f158..c806257f83 100644 --- a/scripts/travis/init.sh +++ b/scripts/ci/init.sh @@ -5,17 +5,11 @@ set -vex pushd "$(dirname "${BASH_SOURCE[0]}")/../../" # Maven Setup -mkdir -p "${HOME}/.m2" && cp -f .travis.settings.xml "${HOME}/.m2/settings.xml" find "${HOME}/.m2/repository/" -type d -name "*-SNAPSHOT*" | xargs -r -l rm -rf # Docker Logins -if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then - echo "${DOCKERHUB_PASSWORD}" | docker login -u="${DOCKERHUB_USERNAME}" --password-stdin - echo "${QUAY_PASSWORD}" | docker login -u="${QUAY_USERNAME}" --password-stdin quay.io -fi - -# not helpful in this script -# export HOST_IP=$(hostname -I | cut -f1 -d' ') +echo "${DOCKERHUB_PASSWORD}" | docker login -u="${DOCKERHUB_USERNAME}" --password-stdin +echo "${QUAY_PASSWORD}" | docker login -u="${QUAY_USERNAME}" --password-stdin quay.io popd set +vex diff --git a/scripts/travis/maven_release.sh b/scripts/ci/maven_release.sh similarity index 92% rename from scripts/travis/maven_release.sh rename to scripts/ci/maven_release.sh index beb01fb830..4ef95ea1f8 100755 --- a/scripts/travis/maven_release.sh +++ b/scripts/ci/maven_release.sh @@ -6,14 +6,14 @@ pushd "$(dirname "${BASH_SOURCE[0]}")/../../" # Use full history for release -git checkout -B "${TRAVIS_BRANCH}" +git checkout -B "${BRANCH_NAME}" # Add email to link commits to user 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=-PfullBuild,all-tas-tests -DskipTests -Dbuild-number=${TRAVIS_BUILD_NUMBER}" \ + "-Darguments=-PfullBuild,all-tas-tests -DskipTests -Dbuild-number=${BUILD_NUMBER}" \ release:clean release:prepare release:perform \ -DscmCommentPrefix="[maven-release-plugin][skip ci] " \ -Dusername="${GIT_USERNAME}" \ diff --git a/scripts/ci/prepare.sh b/scripts/ci/prepare.sh new file mode 100755 index 0000000000..bb3fcdb85e --- /dev/null +++ b/scripts/ci/prepare.sh @@ -0,0 +1,29 @@ +#!/usr/bin/env bash + +set -e + +M2_REPO_DIR="$HOME/.m2/repository" +M2_REPO_TTL_MINUTES=10080 +M2_REPO_EXPIRED="$(find $M2_REPO_DIR -type f -mmin +$M2_REPO_TTL_MINUTES 2>/dev/null | head -n 1 | wc -l)" +M2_REPO_FILE_COUNT="$(find $M2_REPO_DIR -type f 2>/dev/null | wc -l)" + +ORG_ALFRESCO_M2_REPO_DIR="$M2_REPO_DIR/org/alfresco" +ORG_ALFRESCO_M2_REPO_TTL_MINUTES=1440 +ORG_ALFRESCO_M2_REPO_EXPIRED="$(find $ORG_ALFRESCO_M2_REPO_DIR -type f -mmin +$ORG_ALFRESCO_M2_REPO_TTL_MINUTES 2>/dev/null | head -n 1 | wc -l)" + +echo "Files in the maven repo: $M2_REPO_FILE_COUNT" + +if [ $ORG_ALFRESCO_M2_REPO_EXPIRED -eq 1 ];then + echo "Invalidating org/alfresco maven local cache." + rm -rf "$ORG_ALFRESCO_M2_REPO_DIR" +fi + +if [ $M2_REPO_EXPIRED -eq 1 ];then + echo "Invalidating maven local cache." + rm -rf "$M2_REPO_DIR" +fi + +echo "Verifying compilation and ensuring maven cache populated." +export BUILD_PROFILES="-Pall-tas-tests" +export BUILD_OPTIONS="-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn -Dmaven.artifact.threads=8" +source "$(dirname "${BASH_SOURCE[0]}")/build.sh" diff --git a/scripts/ci/tests/AppContext05TestSuite-setup.sh b/scripts/ci/tests/AppContext05TestSuite-setup.sh new file mode 100644 index 0000000000..c8458de3c8 --- /dev/null +++ b/scripts/ci/tests/AppContext05TestSuite-setup.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash + +echo "=========================== Starting AppContext05TestSuite setup ===========================" +PS4="\[\e[35m\]+ \[\e[m\]" +set -vex +pushd "$(dirname "${BASH_SOURCE[0]}")/../../../" + +mkdir -p "${HOME}/tmp" +cp repository/src/test/resources/realms/alfresco-realm.json "${HOME}/tmp" +echo "HOST_IP=$(hostname -I | cut -f1 -d' ')" >> $GITHUB_ENV +docker run -d -e KEYCLOAK_USER=admin -e KEYCLOAK_PASSWORD=admin -e DB_VENDOR=h2 -p 8999:8080 -e KEYCLOAK_IMPORT=/tmp/alfresco-realm.json -v $HOME/tmp/alfresco-realm.json:/tmp/alfresco-realm.json alfresco/alfresco-identity-service:1.2 + +popd +set +vex +echo "=========================== Finishing AppContext05TestSuite setup ==========================" \ No newline at end of file diff --git a/scripts/travis/update_downstream.sh b/scripts/ci/update_downstream.sh similarity index 70% rename from scripts/travis/update_downstream.sh rename to scripts/ci/update_downstream.sh index c81e0ac547..53c9cac26a 100644 --- a/scripts/travis/update_downstream.sh +++ b/scripts/ci/update_downstream.sh @@ -6,9 +6,9 @@ pushd "$(dirname "${BASH_SOURCE[0]}")/../../" source "$(dirname "${BASH_SOURCE[0]}")/build_functions.sh" -#Fetch the latest changes, as Travis will only checkout the PR commit -git fetch origin "${TRAVIS_BRANCH}" -git checkout "${TRAVIS_BRANCH}" +#Fetch the latest changes, as GHA will only checkout the PR commit +git fetch origin "${BRANCH_NAME}" +git checkout "${BRANCH_NAME}" git pull # Retrieve the current Community version - latest tag on the current branch @@ -16,7 +16,7 @@ VERSION="$(git describe --abbrev=0 --tags)" DOWNSTREAM_REPO="github.com/Alfresco/alfresco-enterprise-repo.git" -cloneRepo "${DOWNSTREAM_REPO}" "${TRAVIS_BRANCH}" +cloneRepo "${DOWNSTREAM_REPO}" "${BRANCH_NAME}" cd "$(dirname "${BASH_SOURCE[0]}")/../../../$(basename "${DOWNSTREAM_REPO%.git}")" @@ -33,7 +33,11 @@ git status git --no-pager diff pom.xml git add pom.xml -if git status --untracked-files=no --porcelain | grep -q '^' ; then +if [[ "${COMMIT_MESSAGE}" =~ \[force[^\]]*\] ]]; then + FORCE_TOKEN=$(echo "${COMMIT_MESSAGE}" | sed "s|^.*\(\[force[^]]*\]\).*$|\1|g") + git commit --allow-empty -m "${FORCE_TOKEN} Update upstream version to ${VERSION}" + git push +elif git status --untracked-files=no --porcelain | grep -q '^' ; then git commit -m "Update upstream version to ${VERSION}" git push else diff --git a/scripts/travis/verify_release_tag.sh b/scripts/ci/verify_release_tag.sh similarity index 100% rename from scripts/travis/verify_release_tag.sh rename to scripts/ci/verify_release_tag.sh diff --git a/scripts/travis/cleanup_cache.sh b/scripts/travis/cleanup_cache.sh deleted file mode 100644 index 33b940e2cd..0000000000 --- a/scripts/travis/cleanup_cache.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/usr/bin/env bash -set -ev - -rm -rf "${HOME}/.m2/repository/org/alfresco/acs-community-packaging" -rm -rf "${HOME}/.m2/repository/org/alfresco/alfresco-community-repo" -rm -rf "${HOME}/.m2/repository/org/alfresco/alfresco-community-repo-*" -rm -rf "${HOME}/.m2/repository/org/alfresco/alfresco-core" -rm -rf "${HOME}/.m2/repository/org/alfresco/alfresco-data-model" -rm -rf "${HOME}/.m2/repository/org/alfresco/alfresco-enterprise-remote-api" -rm -rf "${HOME}/.m2/repository/org/alfresco/alfresco-enterprise-repo-*" -rm -rf "${HOME}/.m2/repository/org/alfresco/alfresco-enterprise-repository" -rm -rf "${HOME}/.m2/repository/org/alfresco/alfresco-remote-api" -rm -rf "${HOME}/.m2/repository/org/alfresco/alfresco-repository" -rm -rf "${HOME}/.m2/repository/org/alfresco/content-services" -rm -rf "${HOME}/.m2/repository/org/alfresco/content-services*" -rm -rf "${HOME}/.m2/repository/org/alfresco/content-services-community" -rm -rf "${HOME}/.m2/repository/org/alfresco/tas/alfresco-community-repo-*-test" -rm -rf "${HOME}/.m2/repository/org/alfresco/tas/alfresco-enterprise-repo-*-test" - diff --git a/scripts/travis/trigger_travis.sh b/scripts/travis/trigger_travis.sh deleted file mode 100755 index a0fc6b83cb..0000000000 --- a/scripts/travis/trigger_travis.sh +++ /dev/null @@ -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 -