From 6a395634e27dd0bf72b175ff597c4a2ca05b845b Mon Sep 17 00:00:00 2001 From: wildone Date: Wed, 11 Aug 2021 20:47:33 +1000 Subject: [PATCH] update pipleine. --- .github/workflows/main.yml | 33 ++++- docker-compose.yml | 20 ++- docker/testing/docker-compose.yml | 58 +++++++- .../playbooks/testingprep-automationtest.yml | 129 ++++++++++++++++++ 4 files changed, 230 insertions(+), 10 deletions(-) create mode 100644 docker/testing/playbooks/testingprep-automationtest.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a4f0796eb..eb12a47b0 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -20,7 +20,7 @@ jobs: python-version: [ 3.6 ] env: - DOCKER_IMAGE: "aemdesign/centos-java-buildpack" + DOCKER_IMAGE: "aemdesign/centos-java-buildpack:jdk11" SONAR_ORGANISATION: "aemdesign-github" SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} SONAR_URL: "https://sonarcloud.io" @@ -102,11 +102,36 @@ jobs: key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} restore-keys: ${{ runner.os }}-m2 - - name: docker - mvn clean (cache .m2 in ./build/.m2/repository in repo dir) + - name: Prepare to Package run: $DOCKER_COMMAND mvn clean -DskipTests=true -Dgpg.skip -Dmaven.javadoc.skip=true -Dmaven.source.skip=true -B -P all-modules -Dmaven.repo.local=./build/.m2/repository - - name: docker - mvn package - run: $DOCKER_COMMAND mvn package -DskipTests=true -Dgpg.skip -Dmaven.javadoc.skip=true -Dmaven.source.skip=true -B -P all-modules -Dmaven.repo.local=./build/.m2/repository + - name: Package project and install into local .m2 repository + run: $DOCKER_COMMAND mvn package install -DskipTests=true -Dgpg.skip -Dmaven.javadoc.skip=true -Dmaven.source.skip=true -B -P all-modules -Dmaven.repo.local=./build/.m2/repository + + - name: Start the stack + run: docker-compose up -d + + - name: Wait for aem using ansible + run: | + docker-compose up automationtestprep + + - name: Start automation tests using docker-compose + run: | + docker-compose up automationtest + + - name: deploy docs + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + destination_dir: ${{ env.GIT_BRANCH }} + publish_dir: ./aemdesign-testing/remote-seleniumhub-chrome/generated-docs/html/ + + - name: Check for success + run: | + docker-compose up testingcheck + + - name: Stop the stack + run: docker-compose down # - name: docker - sonar qube on master # if: github.ref == 'refs/heads/master' diff --git a/docker-compose.yml b/docker-compose.yml index c5e63da96..b8a17ae5d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -126,15 +126,31 @@ services: service: testing profiles: - dotest - working_dir: /build/geb-aem-testing/gebaemtesting-testing + working_dir: /build/source/aemdesign-aem-support/aemdesign-testing volumes: - - "./:/build/geb-aem-testing" + - "../:/build/source" - "~/.m2:/build/.m2" depends_on: - author - seleniumhub - testingprep + automationtest: + extends: + file: ./docker/testing/docker-compose.yml + service: automationtest + profiles: + - dotest + working_dir: /build/source/aemdesign-testing + volumes: + - "./:/build/source" + - "~/.m2:/build/.m2" + depends_on: + - author + - seleniumhub + - testingprepshowcase + + testingprep: extends: file: ./docker/testing/docker-compose.yml diff --git a/docker/testing/docker-compose.yml b/docker/testing/docker-compose.yml index b56a66249..38387363c 100644 --- a/docker/testing/docker-compose.yml +++ b/docker/testing/docker-compose.yml @@ -2,6 +2,7 @@ version: "2.4" services: + # this meant to run when there is a aemdesign-parent repo, so when you are developing localy testing: image: aemdesign/centos-java-buildpack:jdk11 hostname: testing @@ -10,12 +11,12 @@ services: - MAVEN_COMMAND=bash ./test-spec --host author --port 8080 --url http://seleniumhub:4444 --maven # docker - PARENT_PROJECT_WITH_GIT=. - - PARENT_PROJECT_WITH_GIT_NAME=geb-aem-testing - - CURRENT_PROJECT_LOCATION=geb-aem-testing/gebaemtesting-testing + - PARENT_PROJECT_WITH_GIT_NAME=aemdesign-parent + - CURRENT_PROJECT_LOCATION=source/aemdesign-aem-support/aemdesign-testing command: "bash -c -l 'cd /build/$${CURRENT_PROJECT_LOCATION}; $${MAVEN_COMMAND}'" - working_dir: "/build/geb-aem-testing/gebaemtesting-testing/" + working_dir: /build/source/aemdesign-aem-support/aemdesign-testing" volumes: - - ./:/build/geb-aem-testing + - ../../../:/build/source - ~/.m2:/build/.m2 networks: - default @@ -24,6 +25,55 @@ services: - publish-network - dispatcher-network + # this meant to run in aemdesign-aem-support repo pipeline, + automationtest: + image: aemdesign/centos-java-buildpack:jdk11 + hostname: automationtest + environment: + # maven + - MAVEN_COMMAND=bash ./test-spec --host author --port 8080 --url http://seleniumhub:4444 --maven + # docker + - PARENT_PROJECT_WITH_GIT=. + - PARENT_PROJECT_WITH_GIT_NAME=aemdesign-aem-support + - CURRENT_PROJECT_LOCATION=source/aemdesign-testing + command: "bash -c -l 'cd /build/$${CURRENT_PROJECT_LOCATION}; $${MAVEN_COMMAND}'" + working_dir: /build/source/aemdesign-testing" + volumes: + - ../../:/build/source + - ~/.m2:/build/.m2 + networks: + - default + - seleniumgrid + - author-network + - publish-network + - dispatcher-network + + # this meant to run in aemdesign-aem-support repo pipeline, will download latest core and install local support packages + automationtestprep: + image: aemdesign/centos-java-buildpack:jdk11 + hostname: automationtestprep + working_dir: "/build/source" + environment: + aem_port: 4502 + aem_host: author + aem_username: admin + aem_password: admin + command: + - bash + - -l + - -c + - "ls -latr /build/.m2/repository && pwd && ls -l && ansible-galaxy install -r requirements.yml && ansible-playbook testingprep-automationtest.yml --extra-vars debug_hide=true" + volumes: + - ./playbooks:/build/source + - "~/.m2:/build/.m2" + networks: + - seleniumgrid + - author-network + - publish-network + - dispatcher-network + - default + + testingprep: image: aemdesign/ansible-playbook hostname: testingprep diff --git a/docker/testing/playbooks/testingprep-automationtest.yml b/docker/testing/playbooks/testingprep-automationtest.yml new file mode 100644 index 000000000..9b7a06ac1 --- /dev/null +++ b/docker/testing/playbooks/testingprep-automationtest.yml @@ -0,0 +1,129 @@ +--- +- name: testingprep-showcase + hosts: localhost + become: true + vars: + PORT: "8080" + HOST: "author" + USERNAME: "admin" + PASSWORD: "admin" + PACKAGE_VERISON_CORE: "2.1.320" + PACKAGE_VERISON_SHOWCASE: "2.0.597" + debug_hide: false + + + + pre_tasks: + - name: get packages + shell: | + mvn dependency:copy -D"maven.repo.local=/build/.m2/repository" -D"artifact=design.aem:aemdesign-aem-core-deploy:LATEST:zip" -D"outputDirectory=./packages" -D"mdep.stripVersion=true" + mvn dependency:copy -o -D"maven.repo.local=/build/.m2/repository" -D"artifact=design.aem:aemdesign-aem-support-deploy:LATEST:zip" -D"outputDirectory=./packages" -D"mdep.stripVersion=true" + args: + executable: /bin/bash + environment: + PACKAGE_VERISON_CORE: "{{ PACKAGE_VERISON_CORE }}" + PACKAGE_VERISON_SHOWCASE: "{{ PACKAGE_VERISON_SHOWCASE }}" + + tasks: + - name: verify aem is ready + include_role: + name: "aem_design.aem_verify" + vars: + aem_port: "{{ PORT }}" + aem_host: "{{ HOST }}" + aem_username: "{{ USERNAME }}" + aem_password: "{{ PASSWORD }}" + debug_hide: false + + - name: install core package + command: "curl -u '{{ USERNAME }}:{{ PASSWORD }}' \ + -X POST \ + -F 'file=@./packages/aemdesign-aem-core-deploy.zip' \ + -F 'name=aemdesign-aem-core-deploy.zip' \ + -H User-Agent:curl \ + -F force=true \ + -F install=true \ + 'http://{{ HOST }}:{{ PORT }}/crx/packmgr/service.jsp'" + + - name: verify aem is ready + include_role: + name: "aem_design.aem_verify" + vars: + aem_port: "{{ PORT }}" + aem_host: "{{ HOST }}" + aem_username: "{{ USERNAME }}" + aem_password: "{{ PASSWORD }}" + debug_hide: false + + - name: install showcase package + command: "curl -u '{{ USERNAME }}:{{ PASSWORD }}' \ + -X POST \ + -F 'file=@./packages/aemdesign-aem-support-deploy.zip' \ + -F 'name=aemdesign-aem-support-deploy.zip' \ + -H User-Agent:curl \ + -F force=true \ + -F install=true \ + 'http://{{ HOST }}:{{ PORT }}/crx/packmgr/service.jsp'" + + - name: verify aem is ready + include_role: + name: "aem_design.aem_verify" + vars: + aem_port: "{{ PORT }}" + aem_host: "{{ HOST }}" + aem_username: "{{ USERNAME }}" + aem_password: "{{ PASSWORD }}" + debug_hide: false + + + # - name: install aem packages + # include_role: + # name: aem_design.aem_package + # vars: + # aem_port: "{{ PORT }}" + # aem_host: "{{ HOST }}" + # aem_username: "{{ USERNAME }}" + # aem_password: "{{ PASSWORD }}" + # maven_repository_url: "{{ item.maven_repository_url | default('') }}" + # debug_hide: "{{ debug_hide }}" + # simple_name: "{{ item.simple_name }}" + # group_name: "{{ item.group_name }}" + # package_version: "{{ item.package_version }}" + # package_name: "{{ item.package_name }}" + # package_url: "{{ item.package_url }}" + # file_name: "{{ item.file_name }}" + # file_url_username: "{{ item.file_url_username | default('') }}" + # file_url_password: "{{ item.file_url_password | default('') }}" + # install_package_ansible: "{{ item.install_package_ansible }}" + # install_package_docker: "{{ item.install_package_docker }}" + # docker_host: "{{ item.docker_host }}" + # loop: [ + # { + # debug_hide: "false", + # simple_name: "aemdesign-aem-core-deploy", + # group_name: "aemdesign", + # package_version: "{{ PACKAGE_VERISON_CORE }}", + # package_name: "aemdesign-aem-core-deploy", + # package_url: "", + # url_username: "", + # url_password: "", + # file_name: "aemdesign-aem-support-deploy-{{ PACKAGE_VERISON_CORE }}.zip", + # install_package_ansible: true, + # install_package_docker: false, + # docker_host: "unix://var/run/docker.sock" + # }, + # { + # debug_hide: "false", + # simple_name: "aemdesign-aem-support-deploy", + # group_name: "aemdesign", + # package_version: "{{ PACKAGE_VERISON_SHOWCASE }}", + # package_name: "aemdesign-aem-support-deploy", + # package_url: "", + # url_username: "", + # url_password: "", + # file_name: "aemdesign-aem-support-deploy-{{ PACKAGE_VERISON_SHOWCASE }}.zip", + # install_package_ansible: true, + # install_package_docker: false, + # docker_host: "unix://var/run/docker.sock" + # } + # ]