Skip to content

Commit

Permalink
[ghaction] martix CI for etcd version
Browse files Browse the repository at this point in the history
Signed-off-by: Lan Liang <[email protected]>
  • Loading branch information
liangyuanpeng authored and lburgazzoli committed Jun 30, 2023
1 parent 5c150ac commit ca95a0a
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
1 change: 1 addition & 0 deletions .github/workflows/build-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ jobs:
env:
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
ETCD_IMAGE: ${{ matrix.etcd }}
run: |
export TC_USER="$(id -u):$(id -g)"
echo "tc user -> $TC_USER"
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/build-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ jobs:
uses: actions/dependency-review-action@v3
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
etcd:
- gcr.io/etcd-development/etcd:v3.5.9
- gcr.io/etcd-development/etcd:v3.4.26
steps:
- name: Checkout
uses: actions/checkout@v3
Expand All @@ -50,6 +56,8 @@ jobs:
distribution: 'temurin'
cache: 'gradle'
- name: Build Project
env:
ETCD_IMAGE: ${{ matrix.etcd }}
run: |
export TC_USER="$(id -u):$(id -g)"
echo "tc user -> $TC_USER"
Expand Down
11 changes: 10 additions & 1 deletion jetcd-launcher/src/main/java/io/etcd/jetcd/launcher/Etcd.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import java.util.UUID;

import org.testcontainers.containers.Network;
import org.testcontainers.shaded.com.google.common.base.Strings;

public final class Etcd {
public static final String CONTAINER_IMAGE = "gcr.io/etcd-development/etcd:v3.5.9";
Expand All @@ -34,12 +35,20 @@ public final class Etcd {
private Etcd() {
}

private static String resolveContainerImage() {
String image = System.getenv("ETCD_IMAGE");
if (!Strings.isNullOrEmpty(image)) {
return image;
}
return CONTAINER_IMAGE;
}

public static Builder builder() {
return new Builder();
}

public static class Builder {
private String image = Etcd.CONTAINER_IMAGE;
private String image = Etcd.resolveContainerImage();
private String clusterName = UUID.randomUUID().toString();
private String prefix;
private int nodes = 1;
Expand Down

0 comments on commit ca95a0a

Please sign in to comment.