Skip to content

Commit bc94adb

Browse files
committed
Add Gradle's 'assemble' check to catch the distribution generation issues
Signed-off-by: Andriy Redko <[email protected]>
1 parent 91bc891 commit bc94adb

File tree

5 files changed

+83
-4
lines changed

5 files changed

+83
-4
lines changed

.github/workflows/assemble.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Gradle Assemble
2+
on: [pull_request]
3+
4+
jobs:
5+
assemble:
6+
runs-on: ${{ matrix.os }}
7+
strategy:
8+
matrix:
9+
os: [ubuntu-latest, windows-latest, macos-latest]
10+
steps:
11+
- name: Setup docker (missing on MacOS)
12+
if: runner.os == 'macos'
13+
run: |
14+
brew install docker
15+
colima start
16+
sudo ln -sf $HOME/.colima/default/docker.sock /var/run/docker.sock
17+
- uses: actions/checkout@v3
18+
- name: Set up JDK 11
19+
uses: actions/setup-java@v3
20+
with:
21+
java-version: 11
22+
distribution: temurin
23+
cache: gradle
24+
- name: Run Gradle
25+
run: |
26+
./gradlew assemble

.github/workflows/precommit.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,13 @@ jobs:
88
matrix:
99
os: [windows-latest, macos-latest] # precommit on ubuntu-latest is run as a part of the gradle-check workflow
1010
steps:
11-
- uses: actions/checkout@v2
11+
- uses: actions/checkout@v3
1212
- name: Set up JDK 11
13-
uses: actions/setup-java@v2
13+
uses: actions/setup-java@v3
1414
with:
1515
java-version: 11
16-
distribution: adopt
16+
distribution: temurin
17+
cache: gradle
1718
- name: Run Gradle
1819
run: |
1920
./gradlew javadoc precommit --parallel

buildSrc/src/main/java/org/opensearch/gradle/docker/DockerSupportService.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,9 @@ public abstract class DockerSupportService implements BuildService<DockerSupport
6868
// Defines the possible locations of the Docker CLI. These will be searched in order.
6969
private static String[] DOCKER_BINARIES_UNIX = { "/usr/bin/docker", "/usr/local/bin/docker" };
7070

71-
private static String[] DOCKER_BINARIES_WINDOWS = { System.getenv("PROGRAMFILES") + "\\Docker\\Docker\\resources\\bin\\docker.exe" };
71+
private static String[] DOCKER_BINARIES_WINDOWS = {
72+
System.getenv("PROGRAMFILES") + "\\Docker\\Docker\\resources\\bin\\docker.exe",
73+
System.getenv("SystemRoot") + "\\System32\\docker.exe" /* Github Actions */ };
7274

7375
private static String[] DOCKER_BINARIES = Os.isFamily(Os.FAMILY_WINDOWS) ? DOCKER_BINARIES_WINDOWS : DOCKER_BINARIES_UNIX;
7476

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/*
2+
* SPDX-License-Identifier: Apache-2.0
3+
*
4+
* The OpenSearch Contributors require contributions made to
5+
* this file be licensed under the Apache-2.0 license or a
6+
* compatible open source license.
7+
*
8+
* Modifications Copyright OpenSearch Contributors. See
9+
* GitHub history for details.
10+
*/
11+
12+
import org.opensearch.gradle.DockerBase
13+
14+
apply plugin: 'base'
15+
16+
tasks.register("buildDockerBuildContext", Tar) {
17+
archiveExtension = 'tar.gz'
18+
compression = Compression.GZIP
19+
archiveClassifier = "docker-build-context"
20+
archiveBaseName = "opensearch"
21+
// Non-local builds don't need to specify an architecture.
22+
with dockerBuildContext(null, DockerBase.CENTOS, false)
23+
}
24+
25+
tasks.named("assemble").configure { dependsOn "buildDockerBuildContext" }
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/*
2+
* SPDX-License-Identifier: Apache-2.0
3+
*
4+
* The OpenSearch Contributors require contributions made to
5+
* this file be licensed under the Apache-2.0 license or a
6+
* compatible open source license.
7+
*
8+
* Modifications Copyright OpenSearch Contributors. See
9+
* GitHub history for details.
10+
*/
11+
12+
import org.opensearch.gradle.DockerBase
13+
14+
apply plugin: 'base'
15+
16+
tasks.register("buildDockerBuildContext", Tar) {
17+
archiveExtension = 'tar.gz'
18+
compression = Compression.GZIP
19+
archiveClassifier = "docker-build-context"
20+
archiveBaseName = "opensearch"
21+
// Non-local builds don't need to specify an architecture.
22+
with dockerBuildContext(null, DockerBase.CENTOS, false)
23+
}
24+
25+
tasks.named("assemble").configure { dependsOn "buildDockerBuildContext" }

0 commit comments

Comments
 (0)