Skip to content

Commit 89a71a0

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

File tree

5 files changed

+84
-4
lines changed

5 files changed

+84
-4
lines changed

.github/workflows/assemble.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
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+
os: [windows-latest]
11+
steps:
12+
- name: Setup docker (missing on MacOS)
13+
if: runner.os == 'macos'
14+
run: |
15+
brew install docker
16+
colima start
17+
sudo ln -sf $HOME/.colima/default/docker.sock /var/run/docker.sock
18+
- uses: actions/checkout@v3
19+
- name: Set up JDK 11
20+
uses: actions/setup-java@v3
21+
with:
22+
java-version: 11
23+
distribution: temurin
24+
cache: gradle
25+
- name: Run Gradle
26+
run: |
27+
./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" };
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)