Skip to content

Commit

Permalink
Add pre-pull to gradle task
Browse files Browse the repository at this point in the history
Signed-off-by: Andre Kurait <[email protected]>
  • Loading branch information
AndreKurait committed Dec 10, 2024
1 parent 28eaf85 commit 33d4e79
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 6 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,44 @@ jobs:
with:
gradle-version: ${{ env.gradle-version }}
gradle-home-cache-cleanup: true
- name: Generate Cache Key from Dockerfiles
id: generate_cache_key
run: |
files=$(find . -type f \( -name 'docker-compose.yml' -o -name 'Dockerfile' \))
file_contents=$(cat $files)
key=$(echo "${file_contents}" | sha1sum | awk '{print $1}')
echo "key=${key}" >> "$GITHUB_OUTPUT"
- name: Cache Docker Images
uses: ScribeMD/[email protected]
with:
key: docker-${{ runner.os }}-${{ steps.generate_cache_key.outputs.key }}
- name: Pre pull images
run: |
pull_if_not_present() {
local image="$1"
if docker image inspect "$image" > /dev/null 2>&1; then
echo "Image '$image' already exists locally."
else
echo "Pulling image '$image'..."
docker pull "$image"
fi
}
images=(
"opensearchproject/opensearch:1.3.16"
"opensearchproject/opensearch:2.14.0"
"docker.elastic.co/elasticsearch/elasticsearch:7.17.22"
"docker.elastic.co/elasticsearch/elasticsearch-oss:7.10.2"
"docker.elastic.co/elasticsearch/elasticsearch-oss:6.8.23"
"docker.elastic.co/elasticsearch/elasticsearch:5.6.16"
"httpd:alpine"
"confluentinc/cp-kafka:7.5.0"
"ghcr.io/shopify/toxiproxy:latest"
"amazonlinux:2023"
"alpine:3.16"
)
for image in "${images[@]}"; do
pull_if_not_present "$image"
done
- name: Run Gradle Build
run: ./gradlew build -x test -x TrafficCapture:dockerSolution:build -x spotlessCheck --stacktrace
env:
Expand Down Expand Up @@ -161,6 +199,7 @@ jobs:
uses: ScribeMD/[email protected]
with:
key: docker-${{ runner.os }}-${{ steps.generate_cache_key.outputs.key }}
read-only: true
- name: Start Docker Solution
run: ./gradlew -p TrafficCapture dockerSolution:ComposeUp -x test -x spotlessCheck --info --stacktrace
env:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,22 @@
@Slf4j
public class SearchClusterContainer extends GenericContainer<SearchClusterContainer> {
public static final String CLUSTER_SNAPSHOT_DIR = "/tmp/snapshots";
public static final ContainerVersion ES_V7_10_2 = new ElasticsearchOssVersion(
"docker.elastic.co/elasticsearch/elasticsearch-oss:7.10.2",
Version.fromString("ES 7.10.2")
);
public static final ContainerVersion ES_V7_17 = new ElasticsearchVersion(
"docker.elastic.co/elasticsearch/elasticsearch:7.17.22",
Version.fromString("ES 7.17.22")
);
public static final ContainerVersion ES_V7_10_2 = new ElasticsearchOssVersion(
"docker.elastic.co/elasticsearch/elasticsearch-oss:7.10.2",
Version.fromString("ES 7.10.2")
);
public static final ContainerVersion ES_V6_8_23 = new ElasticsearchOssVersion(
"docker.elastic.co/elasticsearch/elasticsearch-oss:6.8.23",
Version.fromString("ES 6.8.23")
);

public static final ContainerVersion ES_V5_6_13 = new ElasticsearchVersion(
"docker.elastic.co/elasticsearch/elasticsearch:5.6.13",
Version.fromString("ES 5.6.13")
"docker.elastic.co/elasticsearch/elasticsearch:5.6.16",
Version.fromString("ES 5.6.16")
);


Expand Down

0 comments on commit 33d4e79

Please sign in to comment.