This is an automated email from the ASF dual-hosted git repository.

jgemignani pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/age.git


The following commit(s) were added to refs/heads/master by this push:
     new b7fc3898 Update CIs to pull age image from corresponding pg version 
tag (#757)
b7fc3898 is described below

commit b7fc3898afad218d2f7809b998896b1c3aef58a0
Author: Muhammad Taha Naveed <[email protected]>
AuthorDate: Wed Mar 22 22:16:48 2023 +0500

    Update CIs to pull age image from corresponding pg version tag (#757)
    
    - Since PG11 and master should be able to use the same files, check
      has been included in CIs to pull the correct image based on the branch
      from which the CI triggered.
---
 .github/workflows/go-driver.yml                    | 26 ++++++++++++++++++----
 .github/workflows/jdbc-driver.yaml                 | 20 ++++++++++++++++-
 .github/workflows/nodejs-driver.yaml               | 20 ++++++++++++++++-
 .github/workflows/python-driver.yaml               | 21 ++++++++++++++++-
 drivers/docker-compose.yml                         |  2 +-
 .../org/apache/age/jdbc/BaseDockerizedTest.java    |  7 +++++-
 6 files changed, 87 insertions(+), 9 deletions(-)

diff --git a/.github/workflows/go-driver.yml b/.github/workflows/go-driver.yml
index fbf2cec9..21be683d 100644
--- a/.github/workflows/go-driver.yml
+++ b/.github/workflows/go-driver.yml
@@ -2,10 +2,10 @@ name: Go Driver Tests
 
 on:
   push:
-    branches: [ "master", PG11 ]
+    branches: [ "master", "PG11" ]
 
   pull_request:
-    branches: [ "master", PG11 ]
+    branches: [ "master", "PG11" ]
 
 jobs:
   build:
@@ -19,9 +19,27 @@ jobs:
   
     steps:
     - uses: actions/checkout@v3
-    
+
+    - name: Set tag based on branch
+      run: |
+        if [[ "$GITHUB_EVENT_NAME" == "push" ]]; then
+          if [[ "$GITHUB_REF" == "refs/heads/master" ]]; then
+            echo "TAG=latest" >> $GITHUB_ENV
+          elif [[ "$GITHUB_REF" == "refs/heads/PG11" ]]; then
+            echo "TAG=PG11_latest" >> $GITHUB_ENV
+          fi
+        elif [[ "$GITHUB_EVENT_NAME" == "pull_request" ]]; then
+          if [[ "$GITHUB_BASE_REF" == "master" ]]; then
+            echo "TAG=latest" >> $GITHUB_ENV
+          elif [[ "$GITHUB_BASE_REF" == "PG11" ]]; then
+            echo "TAG=PG11_latest" >> $GITHUB_ENV
+          fi
+        fi
+      
     - name: Run apache/age docker image
-      run: docker-compose up -d
+      run: |
+        export TAG=$TAG
+        docker-compose up -d
 
     - name: Set up Go
       uses: actions/setup-go@v3
diff --git a/.github/workflows/jdbc-driver.yaml 
b/.github/workflows/jdbc-driver.yaml
index 0946bdc3..c8035b23 100644
--- a/.github/workflows/jdbc-driver.yaml
+++ b/.github/workflows/jdbc-driver.yaml
@@ -28,5 +28,23 @@ jobs:
         distribution: ${{ matrix.distributions }}
         java-version: '17'
 
+    - name: Set tag based on branch
+      run: |
+        if [[ "$GITHUB_EVENT_NAME" == "push" ]]; then
+          if [[ "$GITHUB_REF" == "refs/heads/master" ]]; then
+            echo "TAG=latest" >> $GITHUB_ENV
+          elif [[ "$GITHUB_REF" == "refs/heads/PG11" ]]; then
+            echo "TAG=PG11_latest" >> $GITHUB_ENV
+          fi
+        elif [[ "$GITHUB_EVENT_NAME" == "pull_request" ]]; then
+          if [[ "$GITHUB_BASE_REF" == "master" ]]; then
+            echo "TAG=latest" >> $GITHUB_ENV
+          elif [[ "$GITHUB_BASE_REF" == "PG11" ]]; then
+            echo "TAG=PG11_latest" >> $GITHUB_ENV
+          fi
+        fi
+
     - name: Build and Test
-      run: gradle build
\ No newline at end of file
+      run: |
+        export TAG=$TAG
+        gradle build
\ No newline at end of file
diff --git a/.github/workflows/nodejs-driver.yaml 
b/.github/workflows/nodejs-driver.yaml
index f812e2c3..55dccae5 100644
--- a/.github/workflows/nodejs-driver.yaml
+++ b/.github/workflows/nodejs-driver.yaml
@@ -18,8 +18,26 @@ jobs:
     steps:
     - uses: actions/checkout@v3
     
+    - name: Set tag based on branch
+      run: |
+        if [[ "$GITHUB_EVENT_NAME" == "push" ]]; then
+          if [[ "$GITHUB_REF" == "refs/heads/master" ]]; then
+            echo "TAG=latest" >> $GITHUB_ENV
+          elif [[ "$GITHUB_REF" == "refs/heads/PG11" ]]; then
+            echo "TAG=PG11_latest" >> $GITHUB_ENV
+          fi
+        elif [[ "$GITHUB_EVENT_NAME" == "pull_request" ]]; then
+          if [[ "$GITHUB_BASE_REF" == "master" ]]; then
+            echo "TAG=latest" >> $GITHUB_ENV
+          elif [[ "$GITHUB_BASE_REF" == "PG11" ]]; then
+            echo "TAG=PG11_latest" >> $GITHUB_ENV
+          fi
+        fi
+      
     - name: Run apache/age docker image
-      run: docker-compose up -d
+      run: |
+        export TAG=$TAG
+        docker-compose up -d
 
     - name: Set up Node
       uses: actions/setup-node@v3
diff --git a/.github/workflows/python-driver.yaml 
b/.github/workflows/python-driver.yaml
index 720e8c22..a7ef9741 100644
--- a/.github/workflows/python-driver.yaml
+++ b/.github/workflows/python-driver.yaml
@@ -19,7 +19,26 @@ jobs:
     - uses: actions/checkout@v3
     
     - name: Run apache/age docker image
-      run: docker-compose up -d
+    - name: Set tag based on branch
+      run: |
+        if [[ "$GITHUB_EVENT_NAME" == "push" ]]; then
+          if [[ "$GITHUB_REF" == "refs/heads/master" ]]; then
+            echo "TAG=latest" >> $GITHUB_ENV
+          elif [[ "$GITHUB_REF" == "refs/heads/PG11" ]]; then
+            echo "TAG=PG11_latest" >> $GITHUB_ENV
+          fi
+        elif [[ "$GITHUB_EVENT_NAME" == "pull_request" ]]; then
+          if [[ "$GITHUB_BASE_REF" == "master" ]]; then
+            echo "TAG=latest" >> $GITHUB_ENV
+          elif [[ "$GITHUB_BASE_REF" == "PG11" ]]; then
+            echo "TAG=PG11_latest" >> $GITHUB_ENV
+          fi
+        fi
+      
+    - name: Run apache/age docker image
+      run: |
+        export TAG=$TAG
+        docker-compose up -d
 
     - name: Set up python
       uses: actions/setup-python@v4
diff --git a/drivers/docker-compose.yml b/drivers/docker-compose.yml
index 8bdf0031..1716d227 100644
--- a/drivers/docker-compose.yml
+++ b/drivers/docker-compose.yml
@@ -1,7 +1,7 @@
 version: "3.3"
 services:
   db:
-    image: apache/age:latest
+    image: apache/age:${TAG}
     environment:
       - POSTGRES_USER=postgres
       - POSTGRES_PASSWORD=agens
diff --git 
a/drivers/jdbc/lib/src/test/java/org/apache/age/jdbc/BaseDockerizedTest.java 
b/drivers/jdbc/lib/src/test/java/org/apache/age/jdbc/BaseDockerizedTest.java
index 8e6aea46..2a71a462 100644
--- a/drivers/jdbc/lib/src/test/java/org/apache/age/jdbc/BaseDockerizedTest.java
+++ b/drivers/jdbc/lib/src/test/java/org/apache/age/jdbc/BaseDockerizedTest.java
@@ -50,8 +50,13 @@ public class BaseDockerizedTest {
     @BeforeAll
     public void beforeAll() throws Exception {
         String CORRECT_DB_PASSWORDS = "postgres";
+        String imageTag = System.getenv("TAG");
+
+        if (imageTag == null) {
+            imageTag = "latest";
+        }
         agensGraphContainer = new GenericContainer<>(DockerImageName
-            .parse("apache/age:latest"))
+            .parse("apache/age:" + imageTag))
             .withEnv("POSTGRES_PASSWORD", CORRECT_DB_PASSWORDS)
             .withExposedPorts(5432);
         agensGraphContainer.start();

Reply via email to