Skip to content

Commit

Permalink
Add ability to specify RCA branch
Browse files Browse the repository at this point in the history
Signed-off-by: Sruti Parthiban <partsrut@amazon.com>
  • Loading branch information
sruti1312 committed Aug 19, 2021
1 parent ece31ee commit 4bd15eb
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 44 deletions.
19 changes: 1 addition & 18 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Checkout RCA package
uses: actions/checkout@v2
with:
repository: opensearch-project/performance-analyzer-rca
path: ./tmp/rca
- name: Checkout Performance Analyzer package
uses: actions/checkout@v2
with:
Expand All @@ -23,22 +18,10 @@ jobs:
uses: actions/setup-java@v1
with:
java-version: 1.12
- name: Build RCA with Gradle
working-directory: ./tmp/rca
run: ./gradlew build -x test
- name: Publish RCA jar to maven local
working-directory: ./tmp/rca
run: ./gradlew publishToMavenLocal
- name: Build PA gradle using the new RCA jar
working-directory: ./tmp/pa
run: rm -f licenses/performanceanalyzer-rca-1.0.0.0.jar.sha1
- name: Update SHA
working-directory: ./tmp/pa
run: ./gradlew updateShas
- name: Build Artifacts
working-directory: ./tmp/pa
run: |
./gradlew build buildDeb buildRpm --refresh-dependencies -Dbuild.snapshot=false -x javadoc
./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`
Expand Down
23 changes: 3 additions & 20 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,10 @@ on:
- "*"

jobs:
build_rca_pkg:
build_pa_pkg:
runs-on: [ubuntu-latest]
name: Building RCA package
name: Building PA package
steps:
- name: Checkout RCA package
uses: actions/checkout@v2
with:
repository: opensearch-project/performance-analyzer-rca
path: ./tmp/rca
- name: Checkout Performance Analyzer package
uses: actions/checkout@v2
with:
Expand All @@ -30,12 +25,6 @@ jobs:
uses: actions/setup-java@v1
with:
java-version: 1.12
- name: Build RCA with Gradle
working-directory: ./tmp/rca
run: ./gradlew build -x test
- name: Publish RCA jar to maven local
working-directory: ./tmp/rca
run: ./gradlew publishToMavenLocal
# dependencies: OpenSearch
- name: Checkout OpenSearch
uses: actions/checkout@v2
Expand All @@ -46,12 +35,6 @@ jobs:
- name: Build OpenSearch
working-directory: ./OpenSearch
run: ./gradlew publishToMavenLocal -Dbuild.snapshot=false
- name: Build PA gradle using the new RCA jar
working-directory: ./tmp/pa
run: rm -f licenses/performanceanalyzer-rca-1.0.0.0.jar.sha1
- name: Update SHA
working-directory: ./tmp/pa
run: ./gradlew updateShas
# 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
Expand All @@ -61,7 +44,7 @@ jobs:
run: sudo sysctl -w vm.max_map_count=262144
- name: Build PA and run Unit Tests
working-directory: ./tmp/pa
run: ./gradlew build
run: ./gradlew build -Dperformance-analyzer-rca.build=true -Dperformance-analyzer-rca.branch=main
- name: Generate Jacoco coverage report
working-directory: ./tmp/pa
run: ./gradlew jacocoTestReport
Expand Down
12 changes: 6 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,14 @@ ext {
opensearchVersion = '1.0.0'
isSnapshot = "true" == System.getProperty("build.snapshot", "true")

// Name of the default git branch. This is used for checking out the RCA repository
gitDefaultBranch = 'main'
// The RCA branch that will be built. Default value is main.
rcaProjectBranch = findProperty("performance-analyzer-rca.branch") ?: "main"

// If true, then the build will clone the RCA Project into $rcaProjectDir
cloneRcaProject = "true" == System.getProperty("cloneRcaProject", "true")
cloneRcaProject = "true" == System.getProperty("performance-analyzer-rca.build", "true")

// By default we will look for RCA in a peer directory
rcaProjectDir = findProperty("rcaProjectDir") ?: "../performance-analyzer-rca"
rcaProjectDir = findProperty("performance-analyzer-rca.path") ?: "../performance-analyzer-rca"
}

group = "org.opensearch"
Expand Down Expand Up @@ -317,7 +317,7 @@ static def propEnabled(property) {
task cloneGitRepo(type: GitClone) {
def destination = file(rcaProjectDir)
uri = "https://github.com/opensearch-project/performance-analyzer-rca.git"
branch = gitDefaultBranch
branch = rcaProjectBranch
destinationPath = destination
bare = false
enabled = cloneRcaProject && !destination.exists() // to clone only once
Expand Down Expand Up @@ -362,7 +362,7 @@ task unpackRca(type: Copy) {
dependsOn(buildRca)
from(zipTree("$rcaProjectDir/build/distributions/performance-analyzer-rca.zip")) {
}
into "$rcaArtifactsDir/build/distributions"
into "$rcaProjectDir/build/distributions"
rcaArtifactsDir = "$rcaProjectDir/build/distributions/performance-analyzer-rca/"

doLast {
Expand Down

0 comments on commit 4bd15eb

Please sign in to comment.