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

wangdan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-pegasus.git


The following commit(s) were added to refs/heads/master by this push:
     new bed48daa9 ci(github): fix Go workflows which failed due to Ubuntu 
20.04 retirement (#2240)
bed48daa9 is described below

commit bed48daa9f55a96f60812e6e0513aa6b8bd4119f
Author: Dan Wang <[email protected]>
AuthorDate: Sun Apr 27 16:54:45 2025 +0800

    ci(github): fix Go workflows which failed due to Ubuntu 20.04 retirement 
(#2240)
    
    Resolve https://github.com/apache/incubator-pegasus/issues/2241.
    
    Go workflows run on Ubuntu 20.04 because Go client uses thrift-compiler 
0.13.0
    to generate code and the thrift-compiler version on Ubuntu 20.04 is 0.13.0. 
However
    Ubuntu 20.04 runner has been retired and removed on 2025-04-15. To solve 
this
    problem, we choose to build thrift 0.13.0 in a image based on Ubuntu 22.04.
    
    Also add Collector to the workflow for regular building.
---
 .github/workflows/build-push-env-docker.yml        | 38 +++++++++++++++
 .github/workflows/lint_and_test_admin-cli.yml      | 15 +++---
 .github/workflows/lint_and_test_collector.yml      | 18 +++++---
 .github/workflows/lint_and_test_go-client.yml      | 16 +++----
 .github/workflows/lint_and_test_pegic.yml          | 15 ++++--
 .github/workflows/regular-build.yml                | 26 +++++++----
 .golangci.yml                                      |  8 ++++
 .../{ubuntu2204 => go}/Dockerfile                  | 54 ++++++----------------
 docker/pegasus-build-env/ubuntu2204/Dockerfile     |  7 +--
 9 files changed, 117 insertions(+), 80 deletions(-)

diff --git a/.github/workflows/build-push-env-docker.yml 
b/.github/workflows/build-push-env-docker.yml
index 8a26637af..2c504c1e0 100644
--- a/.github/workflows/build-push-env-docker.yml
+++ b/.github/workflows/build-push-env-docker.yml
@@ -73,3 +73,41 @@ jobs:
             apache/pegasus:build-env-${{ matrix.dockertag }}-${{ 
github.ref_name }}
       - name: Image digest
         run: echo ${{ steps.docker_build.outputs.digest }}
+
+  build_go_compilation_env_docker_images:
+    runs-on: ubuntu-latest
+    env:
+      ACTIONS_RUNNER_FORCE_ACTIONS_NODE_VERSION: node16
+      ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true
+    strategy:
+      fail-fast: false
+    steps:
+      - name: Checkout
+        uses: actions/checkout@v4
+      - name: Set up QEMU
+        uses: docker/setup-qemu-action@v3
+      - name: Set up Docker Buildx
+        uses: docker/setup-buildx-action@v3
+      - name: Login to DockerHub
+        uses: docker/login-action@v3
+        with:
+          username: ${{ secrets.DOCKERHUB_USER }}
+          password: ${{ secrets.DOCKERHUB_TOKEN }}
+      - name: Build and push
+        uses: docker/build-push-action@v6
+        with:
+          platforms: linux/amd64
+          context: .
+          file: ./docker/pegasus-build-env/go/Dockerfile
+          push: true
+          tags: |
+            apache/pegasus:build-env-ubuntu2204-${{ github.ref_name }}-go
+          # go-client imports thrift package of 0.13.0, so we must use 
thrift-compiler 0.13.0
+          # to generate code as well. The thrift-compiler version on 
ubuntu-20.04 is 0.13.0,
+          # however ubuntu-20.04 LTS runner has been retired on 2025-04-15. 
Thus we choose to
+          # build thrift 0.13.0 in a image based on ubuntu-22.04 whose thrift 
version is 0.16.0
+          # by default.
+          build-args: |
+            THRIFT_VERSION=0.13.0
+      - name: Image digest
+        run: echo ${{ steps.docker_build.outputs.digest }}
diff --git a/.github/workflows/lint_and_test_admin-cli.yml 
b/.github/workflows/lint_and_test_admin-cli.yml
index 4fef441bf..f17f141e2 100644
--- a/.github/workflows/lint_and_test_admin-cli.yml
+++ b/.github/workflows/lint_and_test_admin-cli.yml
@@ -41,15 +41,16 @@ jobs:
     name: Lint
     runs-on: ubuntu-latest
     steps:
-      - uses: actions/checkout@v4
-      - name: Set up Go
-        uses: actions/setup-go@v2
+      - name: Checkout
+        uses: actions/checkout@v4
+      - name: Setup Go
+        uses: actions/setup-go@v4
         with:
           go-version: 1.18
-      - name: golangci-lint
+      - name: Lint
         uses: golangci/golangci-lint-action@v3
         with:
-          version: v1.55.2
+          version: v1.56.2
           working-directory: ./admin-cli
 
   build:
@@ -58,8 +59,8 @@ jobs:
     steps:
       - name: Checkout
         uses: actions/checkout@v4
-      - name: Set up Go
-        uses: actions/setup-go@v2
+      - name: Setup Go
+        uses: actions/setup-go@v4
         with:
           go-version: 1.18
       - name: Compile
diff --git a/.github/workflows/lint_and_test_collector.yml 
b/.github/workflows/lint_and_test_collector.yml
index 6fc8308c2..46e473098 100644
--- a/.github/workflows/lint_and_test_collector.yml
+++ b/.github/workflows/lint_and_test_collector.yml
@@ -45,7 +45,7 @@ jobs:
       - name: Checkout
         uses: actions/checkout@v4
       - name: Setup Go
-        uses: actions/setup-go@v2
+        uses: actions/setup-go@v4
         with:
           go-version: 1.18
       - name: Format
@@ -57,13 +57,15 @@ jobs:
   lint:
     name: Lint
     needs: format
-    runs-on: ubuntu-20.04
+    runs-on: ubuntu-latest
+    container:
+      image: apache/pegasus:build-env-ubuntu2204-${{ github.base_ref }}-go
     steps:
       - name: Checkout
         uses: actions/checkout@v4
         with:
           fetch-depth: 1
-      - name: Set up Go
+      - name: Setup Go
         uses: actions/setup-go@v4
         with:
           go-version: 1.18
@@ -71,20 +73,22 @@ jobs:
       - name: Lint
         uses: golangci/golangci-lint-action@v3
         with:
-          version: v1.55.2
+          version: v1.56.2
           working-directory: ./collector
 
   build:
     name: Build
     needs: lint
-    runs-on: ubuntu-20.04
+    runs-on: ubuntu-latest
+    container:
+      image: apache/pegasus:build-env-ubuntu2204-${{ github.base_ref }}-go
     steps:
       - name: Checkout
         uses: actions/checkout@v4
         with:
           fetch-depth: 1
-      - name: Set up Go
-        uses: actions/setup-go@v2
+      - name: Setup Go
+        uses: actions/setup-go@v4
         with:
           go-version: 1.18
       - name: Build
diff --git a/.github/workflows/lint_and_test_go-client.yml 
b/.github/workflows/lint_and_test_go-client.yml
index 691121b0f..8f935ee02 100644
--- a/.github/workflows/lint_and_test_go-client.yml
+++ b/.github/workflows/lint_and_test_go-client.yml
@@ -47,7 +47,7 @@ jobs:
       - name: Checkout
         uses: actions/checkout@v4
       - name: Setup Go
-        uses: actions/setup-go@v2
+        uses: actions/setup-go@v4
         with:
           go-version: 1.18
       - name: Format
@@ -59,16 +59,14 @@ jobs:
   lint:
     name: Lint
     needs: format
-    # go-client imports thrift package of 0.13.0, so we must use 
thrift-compiler 0.13.0
-    # to generate code as well. The thrift-compiler version on ubuntu-20.04 is 
0.13.0
-    runs-on: ubuntu-20.04
+    runs-on: ubuntu-latest
+    container:
+      image: apache/pegasus:build-env-ubuntu2204-${{ github.base_ref }}-go
     steps:
-      - name: Install thrift
-        run: sudo apt-get install -y thrift-compiler
       - name: Checkout
         uses: actions/checkout@v4
       - name: Setup Go
-        uses: actions/setup-go@v2
+        uses: actions/setup-go@v4
         with:
           go-version: 1.18
       - name: Build
@@ -119,8 +117,8 @@ jobs:
           cd - && rm -rf thrift-${THRIFT_VERSION} v${THRIFT_VERSION}.tar.gz
       - name: Checkout
         uses: actions/checkout@v4
-      - name: Set up Go
-        uses: actions/setup-go@v2
+      - name: Setup Go
+        uses: actions/setup-go@v4
         with:
           go-version: 1.18
       - uses: "./.github/actions/download_artifact"
diff --git a/.github/workflows/lint_and_test_pegic.yml 
b/.github/workflows/lint_and_test_pegic.yml
index da94f9b4a..3cff3c1c5 100644
--- a/.github/workflows/lint_and_test_pegic.yml
+++ b/.github/workflows/lint_and_test_pegic.yml
@@ -41,11 +41,16 @@ jobs:
     name: Lint
     runs-on: ubuntu-latest
     steps:
-      - uses: actions/checkout@v4
-      - name: golangci-lint
+      - name: Checkout
+        uses: actions/checkout@v4
+      - name: Setup Go
+        uses: actions/setup-go@v4
+        with:
+          go-version: 1.18
+      - name: Lint
         uses: golangci/golangci-lint-action@v3
         with:
-          version: v1.55.2
+          version: v1.56.2
           working-directory: ./pegic
 
   build:
@@ -54,8 +59,8 @@ jobs:
     steps:
       - name: Checkout
         uses: actions/checkout@v4
-      - name: Set up Go
-        uses: actions/setup-go@v2
+      - name: Setup Go
+        uses: actions/setup-go@v4
         with:
           go-version: 1.18
       - name: Compile 
diff --git a/.github/workflows/regular-build.yml 
b/.github/workflows/regular-build.yml
index 1ff13f874..05fa904c8 100644
--- a/.github/workflows/regular-build.yml
+++ b/.github/workflows/regular-build.yml
@@ -86,16 +86,14 @@ jobs:
 
   build_and_lint_go:
     name: Build and Lint Golang
-    runs-on: ubuntu-20.04
+    runs-on: ubuntu-latest
+    container:
+      image: apache/pegasus:build-env-ubuntu2204-${{ github.ref_name }}-go
     steps:
-      - name: Install thrift
-        # go-client imports thrift package of 0.13.0, so we must use 
thrift-compiler 0.13.0
-        # to generate code as well. The thrift-compiler version on 
ubuntu-20.04 is 0.13.0
-        run: sudo apt-get install -y thrift-compiler
       - name: Checkout
         uses: actions/checkout@v4
-      - name: Set up Go
-        uses: actions/setup-go@v2
+      - name: Setup Go
+        uses: actions/setup-go@v4
         with:
           go-version: 1.18
       - name: Build go-client
@@ -104,15 +102,23 @@ jobs:
       - name: Lint go-client
         uses: golangci/golangci-lint-action@v3
         with:
-          version: v1.55.2
+          version: v1.56.2
           working-directory: ./go-client
+      - name: Build collector
+        run: make
+        working-directory: ./collector
+      - name: Lint collector
+        uses: golangci/golangci-lint-action@v3
+        with:
+          version: v1.56.2
+          working-directory: ./collector
       - name: Build admin-cli
         run: make
         working-directory: ./admin-cli
       - name: Lint admin-cli
         uses: golangci/golangci-lint-action@v3
         with:
-          version: v1.55.2
+          version: v1.56.2
           working-directory: ./admin-cli
       - name: Build pegic
         run: make
@@ -120,7 +126,7 @@ jobs:
       - name: Lint pegic
         uses: golangci/golangci-lint-action@v3
         with:
-          version: v1.55.2
+          version: v1.56.2
           working-directory: ./pegic
 
   build_java:
diff --git a/.golangci.yml b/.golangci.yml
index deab2f145..013f1cd61 100644
--- a/.golangci.yml
+++ b/.golangci.yml
@@ -16,6 +16,14 @@
 # under the License.
 ---
 linters:
+  # TODO(wangdan): consider replacing 'golint' with 'revive' because 'golint' 
is
+  # deprecated (since v1.41.0, its repository has been archived by the owner).
+  #
+  # After Go is upgraded to v1.22, consider replacing 'exportloopref' with 
'copyloopvar'
+  # because as of Go 1.22, the problem resolved by 'exportloopref' no longer 
occurs and
+  # fixed by Go team (https://go.dev/blog/loopvar-preview).
+  #
+  # After all of above are bumped, consider upgrading golangci-lint (e.g. to 
v1.64.8).
   enable:
     - gofmt
     - goimports
diff --git a/docker/pegasus-build-env/ubuntu2204/Dockerfile 
b/docker/pegasus-build-env/go/Dockerfile
similarity index 53%
copy from docker/pegasus-build-env/ubuntu2204/Dockerfile
copy to docker/pegasus-build-env/go/Dockerfile
index e5a08417d..99eaec5ca 100644
--- a/docker/pegasus-build-env/ubuntu2204/Dockerfile
+++ b/docker/pegasus-build-env/go/Dockerfile
@@ -22,49 +22,25 @@ RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo 
$TZ > /etc/timezone
 
 RUN apt-get update -y; \
     apt-get install -y --no-install-recommends \
+                       automake \
                        build-essential \
-                       software-properties-common \
-                       clang-14 \
-                       libclang-14-dev \
-                       llvm-14-dev \
-                       openjdk-8-jdk \
+                       bison \
+                       flex \
+                      g++ \
+                       libboost-dev \
+                       libevent-dev \
+                       libssl-dev \
+                       libtool \
+                      make \
                        pkg-config \
-                       python3-pip \
-                       libaio-dev \
-                       zlib1g \
-                       zlib1g.dev \
-                       patch \
-                       netcat \
+                      ca-certificates \
                        wget \
-                       ccache \
-                       git \
-                       curl \
-                       zip \
-                       unzip \
-                       gdb \
-                       vim \
-                       automake \
-                       libtool \
-                       libssl-dev \
-                       bison \
-                       libkrb5-dev \
-                       libsasl2-dev \
-                       maven \
-                       flex; \
+                       unzip; \
     rm -rf /var/lib/apt/lists/*
 
-RUN pip3 install --no-cache-dir --upgrade pip
-RUN pip3 install --no-cache-dir cmake
-
-RUN wget --progress=dot:giga 
https://archive.apache.org/dist/thrift/0.11.0/thrift-0.11.0.tar.gz -P 
/opt/thrift && \
-    cd /opt/thrift && tar xzf thrift-0.11.0.tar.gz && cd thrift-0.11.0 && 
./bootstrap.sh && \
+ARG THRIFT_VERSION=0.13.0
+RUN wget --progress=dot:giga 
https://archive.apache.org/dist/thrift/${THRIFT_VERSION}/thrift-${THRIFT_VERSION}.tar.gz
 -P /opt/thrift && \
+    cd /opt/thrift && tar xzf thrift-${THRIFT_VERSION}.tar.gz && cd 
thrift-${THRIFT_VERSION} && ./bootstrap.sh && \
     ./configure --enable-libs=no && \
     make -j$(($(nproc)/2+1)) && make install && cd - && \
-    rm -rf thrift-0.11.0 thrift-0.11.0.tar.gz
-
-ENV JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
-ENV CLASSPATH=$JAVA_HOME/lib/
-ENV PATH=$JAVA_HOME/bin:$PATH
-ENV LD_LIBRARY_PATH=$JAVA_HOME/jre/lib/amd64/server:$LD_LIBRARY_PATH
-
-WORKDIR /root/apache
+    rm -rf thrift-${THRIFT_VERSION} thrift-${THRIFT_VERSION}.tar.gz
diff --git a/docker/pegasus-build-env/ubuntu2204/Dockerfile 
b/docker/pegasus-build-env/ubuntu2204/Dockerfile
index e5a08417d..d439b98ed 100644
--- a/docker/pegasus-build-env/ubuntu2204/Dockerfile
+++ b/docker/pegasus-build-env/ubuntu2204/Dockerfile
@@ -56,11 +56,12 @@ RUN apt-get update -y; \
 RUN pip3 install --no-cache-dir --upgrade pip
 RUN pip3 install --no-cache-dir cmake
 
-RUN wget --progress=dot:giga 
https://archive.apache.org/dist/thrift/0.11.0/thrift-0.11.0.tar.gz -P 
/opt/thrift && \
-    cd /opt/thrift && tar xzf thrift-0.11.0.tar.gz && cd thrift-0.11.0 && 
./bootstrap.sh && \
+ARG THRIFT_VERSION=0.11.0
+RUN wget --progress=dot:giga 
https://archive.apache.org/dist/thrift/${THRIFT_VERSION}/thrift-${THRIFT_VERSION}.tar.gz
 -P /opt/thrift && \
+    cd /opt/thrift && tar xzf thrift-${THRIFT_VERSION}.tar.gz && cd 
thrift-${THRIFT_VERSION} && ./bootstrap.sh && \
     ./configure --enable-libs=no && \
     make -j$(($(nproc)/2+1)) && make install && cd - && \
-    rm -rf thrift-0.11.0 thrift-0.11.0.tar.gz
+    rm -rf thrift-${THRIFT_VERSION} thrift-${THRIFT_VERSION}.tar.gz
 
 ENV JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
 ENV CLASSPATH=$JAVA_HOME/lib/


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to