diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml deleted file mode 100644 index a4aea7f2..00000000 --- a/.github/workflows/cd.yml +++ /dev/null @@ -1,68 +0,0 @@ -name: CD - -on: - push: - tags: - - 'v*' - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - name: Checkout Performance Analyzer package - uses: actions/checkout@v2 - with: - path: ./tmp/pa - - name: Set up JDK 1.12 - uses: actions/setup-java@v1 - with: - java-version: 1.12 - - name: Build Artifacts - working-directory: ./tmp/pa - run: | - ./gradlew build buildDeb buildRpm --refresh-dependencies -Dbuild.snapshot=false -Dperformance-analyzer-rca.build=true -Dperformance-analyzer-rca.branch=main -x javadoc - mkdir artifacts - artifact=`ls build/distributions/*.zip` - rpm_artifact=`ls build/distributions/*.rpm` - deb_artifact=`ls build/distributions/*.deb` - cp $artifact artifacts/ - cp $rpm_artifact artifacts/ - cp $deb_artifact artifacts/ - - - name: Configure AWS Credentials - uses: aws-actions/configure-aws-credentials@v1 - with: - aws-access-key-id: ${{ secrets.AWS_STAGING_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.AWS_STAGING_SECRET_ACCESS_KEY }} - aws-region: us-west-2 - - - name: Upload Artifacts to S3 - working-directory: ./tmp/pa - shell: bash - run: | - zip=`ls artifacts/*.zip` - rpm=`ls artifacts/*.rpm` - deb=`ls artifacts/*.deb` - - # Inject the build number before the suffix - zip_outfile=`basename ${zip%.zip}-build-${GITHUB_RUN_NUMBER}.zip` - rpm_outfile=`basename ${rpm%.rpm}-build-${GITHUB_RUN_NUMBER}.rpm` - deb_outfile=`basename ${deb%.deb}-build-${GITHUB_RUN_NUMBER}.deb` - - s3_prefix="s3://staging.artifacts.opendistroforelasticsearch.amazon.com/snapshots/elasticsearch-plugins/performance-analyzer/" - - echo "Copying ${zip} to ${s3_prefix}${zip_outfile}" - aws s3 cp --quiet $zip ${s3_prefix}${zip_outfile} - - echo "Copying ${rpm} to ${s3_prefix}${rpm_outfile}" - aws s3 cp --quiet $rpm ${s3_prefix}${rpm_outfile} - - echo "Copying ${deb} to ${s3_prefix}${deb_outfile}" - aws s3 cp --quiet $deb ${s3_prefix}${deb_outfile} - - - name: Upload Workflow Artifacts - uses: actions/upload-artifact@v1 - with: - name: artifacts - path: ./tmp/pa/artifacts/ diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index ccc9aa2a..615eb29f 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -9,7 +9,13 @@ on: - "*" jobs: - build_pa_pkg: + Get-CI-Image-Tag: + uses: opensearch-project/opensearch-build/.github/workflows/get-ci-image-tag.yml@main + with: + product: opensearch + + build_pa_pkg_on_prod_docker: + needs: Get-CI-Image-Tag strategy: matrix: java: @@ -17,7 +23,14 @@ jobs: - 17 fail-fast: false runs-on: [ubuntu-latest] - name: Building PA package + container: + # using the same image which is used by opensearch-build team to build the OpenSearch Distribution + # this image tag is subject to change as more dependencies and updates will arrive over time + image: ${{ needs.Get-CI-Image-Tag.outputs.ci-image-version-linux }} + # need to switch to root so that github actions can install runner binary on container without permission issues. + options: --user root + + name: Building PA package on prod docker steps: - name: Set up JDK uses: actions/setup-java@v1 @@ -26,42 +39,69 @@ jobs: # Performance Analyzer in ./tmp/performance-analyzer - name: Checkout Performance Analyzer package uses: actions/checkout@v2 - with: - path: ./tmp/performance-analyzer - # Explicitly set the docker-compose program path so that our build scripts in RCA can run the program - # This is necessary because of the Github Actions environment and the workingDir of the Gradle environment - - name: Set docker-compose path - run: DOCKER_COMPOSE_LOCATION=$(which docker-compose) - # Set the vm.max_map_count system property to the minimum required to run OpenSearch - - name: Set vm.max_map_count - run: sudo sysctl -w vm.max_map_count=262144 - - name: Build Performance Analyzer and run Unit Tests - working-directory: ./tmp/performance-analyzer + #with: + # path: ./tmp/performance-analyzer + - name: Build PA with same command on prod docker + #working-directory: ./tmp/performance-analyzer run: | + #chown -R 1000:1000 `pwd` ./gradlew build -Dperformance-analyzer-rca.build=true \ - -Dperformance-analyzer-rca.repo="https://github.com/opensearch-project/performance-analyzer-rca.git" \ - -Dperformance-analyzer-rca.branch=main - - name: Assemble PA jar for BWC tests - working-directory: ./tmp/performance-analyzer - run: | - ./gradlew assemble - version=`./gradlew properties -q | grep "opensearch_version:" | awk '{print $2}'` - IFS='-' read -r -a version_array <<< "$version" - plugin_version="${version_array[0]}.0"; for entry in ${version_array[@]:1}; do plugin_version+="-$entry"; done - echo $plugin_version - mkdir -p ./src/test/resources/org/opensearch/performanceanalyzer/bwc/$plugin_version - cp ./build/distributions/*.zip ./src/test/resources/org/opensearch/performanceanalyzer/bwc/$plugin_version - - name: Generate Jacoco coverage report - working-directory: ./tmp/performance-analyzer - run: ./gradlew jacocoTestReport - - name: Upload coverage report - working-directory: ./tmp/performance-analyzer - env: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} - run: bash <(curl -s https://codecov.io/bash) -f ./build/reports/jacoco/test/jacocoTestReport.xml - - name: Run Integration Tests - working-directory: ./tmp/performance-analyzer - run: ./gradlew integTest -Dtests.enableIT -Dtests.useDockerCluster - - name: Run PerformanceAnalzyer Backwards Compatibility Tests - working-directory: ./tmp/performance-analyzer - run: ./gradlew bwcTestSuite -Dtests.security.manager=false + -Dperformance-analyzer-rca.repo="https://github.com/opensearch-project/performance-analyzer-rca.git" \ + -Dperformance-analyzer-rca.branch=main + +# build_pa_pkg: +# strategy: +# matrix: +# java: +# - 11 +# - 17 +# fail-fast: false +# runs-on: [ubuntu-latest] +# name: Building PA package +# steps: +# - name: Set up JDK +# uses: actions/setup-java@v1 +# with: +# java-version: ${{matrix.java}} +# # Performance Analyzer in ./tmp/performance-analyzer +# - name: Checkout Performance Analyzer package +# uses: actions/checkout@v2 +# with: +# path: ./tmp/performance-analyzer +# # Explicitly set the docker-compose program path so that our build scripts in RCA can run the program +# # This is necessary because of the Github Actions environment and the workingDir of the Gradle environment +# - name: Set docker-compose path +# run: DOCKER_COMPOSE_LOCATION=$(which docker-compose) +# # Set the vm.max_map_count system property to the minimum required to run OpenSearch +# - name: Set vm.max_map_count +# run: sudo sysctl -w vm.max_map_count=262144 +# - name: Build Performance Analyzer and run Unit Tests +# working-directory: ./tmp/performance-analyzer +# run: | +# ./gradlew build -Dperformance-analyzer-rca.build=true \ +# -Dperformance-analyzer-rca.repo="https://github.com/opensearch-project/performance-analyzer-rca.git" \ +# -Dperformance-analyzer-rca.branch=main +# - name: Assemble PA jar for BWC tests +# working-directory: ./tmp/performance-analyzer +# run: | +# ./gradlew assemble +# version=`./gradlew properties -q | grep "opensearch_version:" | awk '{print $2}'` +# IFS='-' read -r -a version_array <<< "$version" +# plugin_version="${version_array[0]}.0"; for entry in ${version_array[@]:1}; do plugin_version+="-$entry"; done +# echo $plugin_version +# mkdir -p ./src/test/resources/org/opensearch/performanceanalyzer/bwc/$plugin_version +# cp ./build/distributions/*.zip ./src/test/resources/org/opensearch/performanceanalyzer/bwc/$plugin_version +# - name: Generate Jacoco coverage report +# working-directory: ./tmp/performance-analyzer +# run: ./gradlew jacocoTestReport +# - name: Upload coverage report +# working-directory: ./tmp/performance-analyzer +# env: +# CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} +# run: bash <(curl -s https://codecov.io/bash) -f ./build/reports/jacoco/test/jacocoTestReport.xml +# - name: Run Integration Tests +# working-directory: ./tmp/performance-analyzer +# run: ./gradlew integTest -Dtests.enableIT -Dtests.useDockerCluster +# - name: Run PerformanceAnalzyer Backwards Compatibility Tests +# working-directory: ./tmp/performance-analyzer +# run: ./gradlew bwcTestSuite -Dtests.security.manager=false