Skip to content

Commit dae9f6c

Browse files
Run Security build on image from opensearch-build (opensearch-project#4966)
Signed-off-by: Craig Perkins <cwperx@amazon.com> Co-authored-by: Darshit Chanpura <dchanp@amazon.com>
1 parent 77dd209 commit dae9f6c

File tree

1 file changed

+94
-5
lines changed

1 file changed

+94
-5
lines changed

.github/workflows/ci.yml

+94-5
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ env:
1313
CI_ENVIRONMENT: normal
1414

1515
jobs:
16+
Get-CI-Image-Tag:
17+
uses: opensearch-project/opensearch-build/.github/workflows/get-ci-image-tag.yml@main
18+
with:
19+
product: opensearch
20+
1621
generate-test-list:
1722
runs-on: ubuntu-latest
1823
outputs:
@@ -32,14 +37,14 @@ jobs:
3237
run: |
3338
echo "separateTestsNames=$(./gradlew listTasksAsJSON -q --console=plain | tail -n 1)" >> $GITHUB_OUTPUT
3439
35-
test:
40+
test-windows:
3641
name: test
3742
needs: generate-test-list
3843
strategy:
3944
fail-fast: false
4045
matrix:
4146
gradle_task: ${{ fromJson(needs.generate-test-list.outputs.separateTestsNames) }}
42-
platform: [windows-latest, ubuntu-latest]
47+
platform: [windows-latest]
4348
jdk: [21]
4449
runs-on: ${{ matrix.platform }}
4550

@@ -67,8 +72,51 @@ jobs:
6772
path: |
6873
./build/reports/
6974
75+
test-linux:
76+
name: test
77+
needs: ["generate-test-list", "Get-CI-Image-Tag"]
78+
strategy:
79+
fail-fast: false
80+
matrix:
81+
gradle_task: ${{ fromJson(needs.generate-test-list.outputs.separateTestsNames) }}
82+
platform: [ubuntu-latest]
83+
jdk: [21]
84+
runs-on: ubuntu-latest
85+
container:
86+
# using the same image which is used by opensearch-build to build the OpenSearch Distribution
87+
# this image tag is subject to change as more dependencies and updates will arrive over time
88+
image: ${{ needs.Get-CI-Image-Tag.outputs.ci-image-version-linux }}
89+
# need to switch to root so that github actions can install runner binary on container without permission issues.
90+
options: ${{ needs.Get-CI-Image-Tag.outputs.ci-image-start-options }}
91+
92+
steps:
93+
- name: Run start commands
94+
run: ${{ needs.Get-CI-Image-Tag.outputs.ci-image-start-command }}
95+
- name: Set up JDK for build and test
96+
uses: actions/setup-java@v4
97+
with:
98+
distribution: temurin # Temurin is a distribution of adoptium
99+
java-version: ${{ matrix.jdk }}
100+
101+
- name: Checkout security
102+
uses: actions/checkout@v4
103+
104+
- name: Build and Test
105+
uses: gradle/gradle-build-action@v3
106+
with:
107+
cache-disabled: true
108+
arguments: |
109+
${{ matrix.gradle_task }} -Dbuild.snapshot=false
110+
111+
- uses: actions/upload-artifact@v4
112+
if: always()
113+
with:
114+
name: ${{ matrix.platform }}-JDK${{ matrix.jdk }}-${{ matrix.gradle_task }}-reports
115+
path: |
116+
./build/reports/
117+
70118
report-coverage:
71-
needs: ["test", "integration-tests"]
119+
needs: ["test-windows", "test-linux", "integration-tests-windows", "integration-tests-linux"]
72120
runs-on: ubuntu-latest
73121
steps:
74122
- uses: actions/checkout@v4
@@ -92,13 +140,13 @@ jobs:
92140
verbose: true
93141
94142
95-
integration-tests:
143+
integration-tests-windows:
96144
name: integration-tests
97145
strategy:
98146
fail-fast: false
99147
matrix:
100148
jdk: [21]
101-
platform: [ubuntu-latest, windows-latest]
149+
platform: [windows-latest]
102150
runs-on: ${{ matrix.platform }}
103151

104152
steps:
@@ -125,6 +173,47 @@ jobs:
125173
path: |
126174
./build/reports/
127175
176+
integration-tests-linux:
177+
name: integration-tests
178+
needs: ["Get-CI-Image-Tag"]
179+
strategy:
180+
fail-fast: false
181+
matrix:
182+
jdk: [21]
183+
platform: [ubuntu-latest]
184+
runs-on: ubuntu-latest
185+
container:
186+
# using the same image which is used by opensearch-build team to build the OpenSearch Distribution
187+
# this image tag is subject to change as more dependencies and updates will arrive over time
188+
image: ${{ needs.Get-CI-Image-Tag.outputs.ci-image-version-linux }}
189+
# need to switch to root so that github actions can install runner binary on container without permission issues.
190+
options: ${{ needs.Get-CI-Image-Tag.outputs.ci-image-start-options }}
191+
192+
steps:
193+
- name: Run start commands
194+
run: ${{ needs.Get-CI-Image-Tag.outputs.ci-image-start-command }}
195+
- name: Set up JDK for build and test
196+
uses: actions/setup-java@v4
197+
with:
198+
distribution: temurin # Temurin is a distribution of adoptium
199+
java-version: ${{ matrix.jdk }}
200+
201+
- name: Checkout security
202+
uses: actions/checkout@v4
203+
204+
- name: Build and Test
205+
uses: gradle/gradle-build-action@v3
206+
with:
207+
cache-disabled: true
208+
arguments: |
209+
integrationTest -Dbuild.snapshot=false
210+
211+
- uses: actions/upload-artifact@v4
212+
if: always()
213+
with:
214+
name: integration-${{ matrix.platform }}-JDK${{ matrix.jdk }}-reports
215+
path: |
216+
./build/reports/
128217
129218
resource-tests:
130219
env:

0 commit comments

Comments
 (0)