Skip to content

Commit bed48da

Browse files
authored
ci(github): fix Go workflows which failed due to Ubuntu 20.04 retirement (#2240)
Resolve #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.
1 parent a59acd0 commit bed48da

9 files changed

Lines changed: 148 additions & 41 deletions

File tree

.github/workflows/build-push-env-docker.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,3 +73,41 @@ jobs:
7373
apache/pegasus:build-env-${{ matrix.dockertag }}-${{ github.ref_name }}
7474
- name: Image digest
7575
run: echo ${{ steps.docker_build.outputs.digest }}
76+
77+
build_go_compilation_env_docker_images:
78+
runs-on: ubuntu-latest
79+
env:
80+
ACTIONS_RUNNER_FORCE_ACTIONS_NODE_VERSION: node16
81+
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true
82+
strategy:
83+
fail-fast: false
84+
steps:
85+
- name: Checkout
86+
uses: actions/checkout@v4
87+
- name: Set up QEMU
88+
uses: docker/setup-qemu-action@v3
89+
- name: Set up Docker Buildx
90+
uses: docker/setup-buildx-action@v3
91+
- name: Login to DockerHub
92+
uses: docker/login-action@v3
93+
with:
94+
username: ${{ secrets.DOCKERHUB_USER }}
95+
password: ${{ secrets.DOCKERHUB_TOKEN }}
96+
- name: Build and push
97+
uses: docker/build-push-action@v6
98+
with:
99+
platforms: linux/amd64
100+
context: .
101+
file: ./docker/pegasus-build-env/go/Dockerfile
102+
push: true
103+
tags: |
104+
apache/pegasus:build-env-ubuntu2204-${{ github.ref_name }}-go
105+
# go-client imports thrift package of 0.13.0, so we must use thrift-compiler 0.13.0
106+
# to generate code as well. The thrift-compiler version on ubuntu-20.04 is 0.13.0,
107+
# however ubuntu-20.04 LTS runner has been retired on 2025-04-15. Thus we choose to
108+
# build thrift 0.13.0 in a image based on ubuntu-22.04 whose thrift version is 0.16.0
109+
# by default.
110+
build-args: |
111+
THRIFT_VERSION=0.13.0
112+
- name: Image digest
113+
run: echo ${{ steps.docker_build.outputs.digest }}

.github/workflows/lint_and_test_admin-cli.yml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,16 @@ jobs:
4141
name: Lint
4242
runs-on: ubuntu-latest
4343
steps:
44-
- uses: actions/checkout@v4
45-
- name: Set up Go
46-
uses: actions/setup-go@v2
44+
- name: Checkout
45+
uses: actions/checkout@v4
46+
- name: Setup Go
47+
uses: actions/setup-go@v4
4748
with:
4849
go-version: 1.18
49-
- name: golangci-lint
50+
- name: Lint
5051
uses: golangci/golangci-lint-action@v3
5152
with:
52-
version: v1.55.2
53+
version: v1.56.2
5354
working-directory: ./admin-cli
5455

5556
build:
@@ -58,8 +59,8 @@ jobs:
5859
steps:
5960
- name: Checkout
6061
uses: actions/checkout@v4
61-
- name: Set up Go
62-
uses: actions/setup-go@v2
62+
- name: Setup Go
63+
uses: actions/setup-go@v4
6364
with:
6465
go-version: 1.18
6566
- name: Compile

.github/workflows/lint_and_test_collector.yml

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ jobs:
4545
- name: Checkout
4646
uses: actions/checkout@v4
4747
- name: Setup Go
48-
uses: actions/setup-go@v2
48+
uses: actions/setup-go@v4
4949
with:
5050
go-version: 1.18
5151
- name: Format
@@ -57,34 +57,38 @@ jobs:
5757
lint:
5858
name: Lint
5959
needs: format
60-
runs-on: ubuntu-20.04
60+
runs-on: ubuntu-latest
61+
container:
62+
image: apache/pegasus:build-env-ubuntu2204-${{ github.base_ref }}-go
6163
steps:
6264
- name: Checkout
6365
uses: actions/checkout@v4
6466
with:
6567
fetch-depth: 1
66-
- name: Set up Go
68+
- name: Setup Go
6769
uses: actions/setup-go@v4
6870
with:
6971
go-version: 1.18
7072
cache: false
7173
- name: Lint
7274
uses: golangci/golangci-lint-action@v3
7375
with:
74-
version: v1.55.2
76+
version: v1.56.2
7577
working-directory: ./collector
7678

7779
build:
7880
name: Build
7981
needs: lint
80-
runs-on: ubuntu-20.04
82+
runs-on: ubuntu-latest
83+
container:
84+
image: apache/pegasus:build-env-ubuntu2204-${{ github.base_ref }}-go
8185
steps:
8286
- name: Checkout
8387
uses: actions/checkout@v4
8488
with:
8589
fetch-depth: 1
86-
- name: Set up Go
87-
uses: actions/setup-go@v2
90+
- name: Setup Go
91+
uses: actions/setup-go@v4
8892
with:
8993
go-version: 1.18
9094
- name: Build

.github/workflows/lint_and_test_go-client.yml

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ jobs:
4747
- name: Checkout
4848
uses: actions/checkout@v4
4949
- name: Setup Go
50-
uses: actions/setup-go@v2
50+
uses: actions/setup-go@v4
5151
with:
5252
go-version: 1.18
5353
- name: Format
@@ -59,16 +59,14 @@ jobs:
5959
lint:
6060
name: Lint
6161
needs: format
62-
# go-client imports thrift package of 0.13.0, so we must use thrift-compiler 0.13.0
63-
# to generate code as well. The thrift-compiler version on ubuntu-20.04 is 0.13.0
64-
runs-on: ubuntu-20.04
62+
runs-on: ubuntu-latest
63+
container:
64+
image: apache/pegasus:build-env-ubuntu2204-${{ github.base_ref }}-go
6565
steps:
66-
- name: Install thrift
67-
run: sudo apt-get install -y thrift-compiler
6866
- name: Checkout
6967
uses: actions/checkout@v4
7068
- name: Setup Go
71-
uses: actions/setup-go@v2
69+
uses: actions/setup-go@v4
7270
with:
7371
go-version: 1.18
7472
- name: Build
@@ -119,8 +117,8 @@ jobs:
119117
cd - && rm -rf thrift-${THRIFT_VERSION} v${THRIFT_VERSION}.tar.gz
120118
- name: Checkout
121119
uses: actions/checkout@v4
122-
- name: Set up Go
123-
uses: actions/setup-go@v2
120+
- name: Setup Go
121+
uses: actions/setup-go@v4
124122
with:
125123
go-version: 1.18
126124
- uses: "./.github/actions/download_artifact"

.github/workflows/lint_and_test_pegic.yml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,16 @@ jobs:
4141
name: Lint
4242
runs-on: ubuntu-latest
4343
steps:
44-
- uses: actions/checkout@v4
45-
- name: golangci-lint
44+
- name: Checkout
45+
uses: actions/checkout@v4
46+
- name: Setup Go
47+
uses: actions/setup-go@v4
48+
with:
49+
go-version: 1.18
50+
- name: Lint
4651
uses: golangci/golangci-lint-action@v3
4752
with:
48-
version: v1.55.2
53+
version: v1.56.2
4954
working-directory: ./pegic
5055

5156
build:
@@ -54,8 +59,8 @@ jobs:
5459
steps:
5560
- name: Checkout
5661
uses: actions/checkout@v4
57-
- name: Set up Go
58-
uses: actions/setup-go@v2
62+
- name: Setup Go
63+
uses: actions/setup-go@v4
5964
with:
6065
go-version: 1.18
6166
- name: Compile

.github/workflows/regular-build.yml

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -86,16 +86,14 @@ jobs:
8686

8787
build_and_lint_go:
8888
name: Build and Lint Golang
89-
runs-on: ubuntu-20.04
89+
runs-on: ubuntu-latest
90+
container:
91+
image: apache/pegasus:build-env-ubuntu2204-${{ github.ref_name }}-go
9092
steps:
91-
- name: Install thrift
92-
# go-client imports thrift package of 0.13.0, so we must use thrift-compiler 0.13.0
93-
# to generate code as well. The thrift-compiler version on ubuntu-20.04 is 0.13.0
94-
run: sudo apt-get install -y thrift-compiler
9593
- name: Checkout
9694
uses: actions/checkout@v4
97-
- name: Set up Go
98-
uses: actions/setup-go@v2
95+
- name: Setup Go
96+
uses: actions/setup-go@v4
9997
with:
10098
go-version: 1.18
10199
- name: Build go-client
@@ -104,23 +102,31 @@ jobs:
104102
- name: Lint go-client
105103
uses: golangci/golangci-lint-action@v3
106104
with:
107-
version: v1.55.2
105+
version: v1.56.2
108106
working-directory: ./go-client
107+
- name: Build collector
108+
run: make
109+
working-directory: ./collector
110+
- name: Lint collector
111+
uses: golangci/golangci-lint-action@v3
112+
with:
113+
version: v1.56.2
114+
working-directory: ./collector
109115
- name: Build admin-cli
110116
run: make
111117
working-directory: ./admin-cli
112118
- name: Lint admin-cli
113119
uses: golangci/golangci-lint-action@v3
114120
with:
115-
version: v1.55.2
121+
version: v1.56.2
116122
working-directory: ./admin-cli
117123
- name: Build pegic
118124
run: make
119125
working-directory: ./pegic
120126
- name: Lint pegic
121127
uses: golangci/golangci-lint-action@v3
122128
with:
123-
version: v1.55.2
129+
version: v1.56.2
124130
working-directory: ./pegic
125131

126132
build_java:

.golangci.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,14 @@
1616
# under the License.
1717
---
1818
linters:
19+
# TODO(wangdan): consider replacing 'golint' with 'revive' because 'golint' is
20+
# deprecated (since v1.41.0, its repository has been archived by the owner).
21+
#
22+
# After Go is upgraded to v1.22, consider replacing 'exportloopref' with 'copyloopvar'
23+
# because as of Go 1.22, the problem resolved by 'exportloopref' no longer occurs and
24+
# fixed by Go team (https://go.dev/blog/loopvar-preview).
25+
#
26+
# After all of above are bumped, consider upgrading golangci-lint (e.g. to v1.64.8).
1927
enable:
2028
- gofmt
2129
- goimports
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
FROM ubuntu:22.04
19+
20+
ENV TZ=Asia/Shanghai
21+
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
22+
23+
RUN apt-get update -y; \
24+
apt-get install -y --no-install-recommends \
25+
automake \
26+
build-essential \
27+
bison \
28+
flex \
29+
g++ \
30+
libboost-dev \
31+
libevent-dev \
32+
libssl-dev \
33+
libtool \
34+
make \
35+
pkg-config \
36+
ca-certificates \
37+
wget \
38+
unzip; \
39+
rm -rf /var/lib/apt/lists/*
40+
41+
ARG THRIFT_VERSION=0.13.0
42+
RUN wget --progress=dot:giga https://archive.apache.org/dist/thrift/${THRIFT_VERSION}/thrift-${THRIFT_VERSION}.tar.gz -P /opt/thrift && \
43+
cd /opt/thrift && tar xzf thrift-${THRIFT_VERSION}.tar.gz && cd thrift-${THRIFT_VERSION} && ./bootstrap.sh && \
44+
./configure --enable-libs=no && \
45+
make -j$(($(nproc)/2+1)) && make install && cd - && \
46+
rm -rf thrift-${THRIFT_VERSION} thrift-${THRIFT_VERSION}.tar.gz

docker/pegasus-build-env/ubuntu2204/Dockerfile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,12 @@ RUN apt-get update -y; \
5656
RUN pip3 install --no-cache-dir --upgrade pip
5757
RUN pip3 install --no-cache-dir cmake
5858

59-
RUN wget --progress=dot:giga https://archive.apache.org/dist/thrift/0.11.0/thrift-0.11.0.tar.gz -P /opt/thrift && \
60-
cd /opt/thrift && tar xzf thrift-0.11.0.tar.gz && cd thrift-0.11.0 && ./bootstrap.sh && \
59+
ARG THRIFT_VERSION=0.11.0
60+
RUN wget --progress=dot:giga https://archive.apache.org/dist/thrift/${THRIFT_VERSION}/thrift-${THRIFT_VERSION}.tar.gz -P /opt/thrift && \
61+
cd /opt/thrift && tar xzf thrift-${THRIFT_VERSION}.tar.gz && cd thrift-${THRIFT_VERSION} && ./bootstrap.sh && \
6162
./configure --enable-libs=no && \
6263
make -j$(($(nproc)/2+1)) && make install && cd - && \
63-
rm -rf thrift-0.11.0 thrift-0.11.0.tar.gz
64+
rm -rf thrift-${THRIFT_VERSION} thrift-${THRIFT_VERSION}.tar.gz
6465

6566
ENV JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
6667
ENV CLASSPATH=$JAVA_HOME/lib/

0 commit comments

Comments
 (0)