Skip to content

Commit 8537f27

Browse files
vdaas-cikpangovankichi
authored
Refactor github actions (#2773) (#2779)
Signed-off-by: kpango <[email protected]> Co-authored-by: Yusuke Kato <[email protected]> Co-authored-by: Kiichiro YUKAWA <[email protected]>
1 parent 7c25316 commit 8537f27

File tree

24 files changed

+85
-74
lines changed

24 files changed

+85
-74
lines changed

.github/actions/deploy-chaos-mesh/action.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
# limitations under the License.
1515
#
1616
name: "Deploy Chaos Mesh"
17-
description: "A action to deploy Chaos Mesh"
17+
description: "An action to deploy Chaos Mesh"
1818
inputs:
1919
chaos_mesh_version:
2020
description: "The Chaos Mesh version to use. The default version is `versions/CHAOS_MESH_VERSION`"

.github/actions/detect-docker-image-tags/action.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
# limitations under the License.
1515
#
1616
name: "Detect Docker image tags"
17-
description: "A action to detect Docker image tags"
17+
description: "An action to detect Docker image tags"
1818
inputs:
1919
tags:
2020
description: "Tag name to check whether exists or not"

.github/actions/determine-docker-image-tag/action.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
# limitations under the License.
1515
#
1616
name: "Determine Docker image tag"
17-
description: "A action to determine Docker image tag"
17+
description: "An action to determine Docker image tag"
1818
outputs:
1919
TAGS:
2020
description: "docker image tag list"

.github/actions/docker-build/action.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
# limitations under the License.
1515
#
1616
name: "Build Docker images"
17-
description: "A action to build Docker images and publish them"
17+
description: "An action to build Docker images and publish them"
1818
inputs:
1919
target:
2020
description: "Build target"

.github/actions/dump-context/action.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
# limitations under the License.
1515
#
1616
name: "Dump context to log"
17-
description: "A action to dump context to log"
17+
description: "An action to dump context to log"
1818
runs:
1919
using: "composite"
2020
steps:

.github/actions/e2e-deploy-vald-helm-operator/action.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
# limitations under the License.
1515
#
1616
name: "Deploy Vald using vald-helm-operator for E2E test"
17-
description: "A action to deploy vald using vald-helm-operator for E2E test"
17+
description: "An action to deploy vald using vald-helm-operator for E2E test"
1818
inputs:
1919
require_minio:
2020
description: "If Minio is required, set this to true."

.github/actions/e2e-deploy-vald-readreplica/action.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
# limitations under the License.
1515
#
1616
name: "Deploy Vald Read Replica for E2E test"
17-
description: "A action to deploy vald read replica for E2E test"
17+
description: "An action to deploy vald read replica for E2E test"
1818
inputs:
1919
require_minio:
2020
description: "If Minio is required, set this to true."

.github/actions/e2e-deploy-vald/action.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
# limitations under the License.
1515
#
1616
name: "Deploy Vald for E2E test"
17-
description: "A action to deploy vald for E2E test"
17+
description: "An action to deploy vald for E2E test"
1818
inputs:
1919
require_minio:
2020
description: "If Minio is required, set this to true."

.github/actions/notify-slack/action.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
# limitations under the License.
1515
#
1616
name: "Notify Slack"
17-
description: "A action to notify Slack"
17+
description: "An action to notify Slack"
1818
inputs:
1919
author_name:
2020
description: "User name for slack notification"

.github/actions/scan-docker-image/action.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
# limitations under the License.
1515
#
1616
name: "Scan the Docker image"
17-
description: "A action to scan the Docker image"
17+
description: "An action to scan the Docker image"
1818
inputs:
1919
image_ref:
2020
description: "Docker image reference"

.github/actions/setup-e2e/action.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
# limitations under the License.
1515
#
1616
name: "Setup E2E environment"
17-
description: "A action to set up the environment for executing E2E test"
17+
description: "An action to set up the environment for executing E2E test"
1818
inputs:
1919
require_libhdf5:
2020
description: "If libhdf5 is not required, set this to false"

.github/actions/setup-go/action.yaml

+15-4
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
# limitations under the License.
1515
#
1616
name: "Setup Go environment"
17-
description: "A action to set up Go environment"
17+
description: "An action to set up Go environment"
1818
inputs:
1919
go_version:
2020
description: "The Go version to use. The default version is `versions/GO_VERSION`"
@@ -28,14 +28,25 @@ runs:
2828
shell: bash
2929
run: |
3030
GO_VERSION=${GO_VERSION:-`make version/go`}
31-
3231
echo "version=${GO_VERSION}" >> $GITHUB_OUTPUT
3332
env:
3433
GO_VERSION: ${{ inputs.go_version }}
35-
- uses: actions/setup-go@v5
34+
- name: Check if Go is installed
35+
id: check_go
36+
shell: bash
37+
run: |
38+
if command -v go &> /dev/null; then
39+
echo "go_installed=true" >> $GITHUB_OUTPUT
40+
echo "installed_version=$(go version | awk '{print $3}')" >> $GITHUB_OUTPUT
41+
else
42+
echo "go_installed=false" >> $GITHUB_OUTPUT
43+
fi
44+
- name: Setup Go (if not installed or version mismatch)
45+
if: steps.check_go.outputs.go_installed == 'false' || steps.check_go.outputs.installed_version != steps.go_version.outputs.version
46+
uses: actions/setup-go@v5
3647
with:
3748
go-version: ${{ steps.go_version.outputs.version }}
38-
- name: Check Go version
49+
- name: Verify Go version
3950
shell: bash
4051
run: |
4152
go version

.github/actions/setup-helm/action.yaml

+16-5
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
# limitations under the License.
1515
#
1616
name: "Setup Helm environment"
17-
description: "A action to set up Helm environment"
17+
description: "An action to set up Helm environment"
1818
inputs:
1919
helm_version:
2020
description: "The Helm version to use. The default version is `versions/HELM_VERSION`"
@@ -28,14 +28,25 @@ runs:
2828
shell: bash
2929
run: |
3030
HELM_VERSION=${HELM_VERSION:-`make version/helm`}
31-
3231
echo "version=${HELM_VERSION}" >> $GITHUB_OUTPUT
3332
env:
3433
HELM_VERSION: ${{ inputs.helm_version }}
35-
- uses: azure/setup-helm@v4
34+
- name: Check if Helm is installed
35+
id: check_helm
36+
shell: bash
37+
run: |
38+
if command -v helm &> /dev/null; then
39+
echo "helm_installed=true" >> $GITHUB_OUTPUT
40+
echo "installed_version=$(helm version --short --client | awk '{print $2}' | sed 's/^v//')" >> $GITHUB_OUTPUT
41+
else
42+
echo "helm_installed=false" >> $GITHUB_OUTPUT
43+
fi
44+
- name: Setup Helm (if not installed or version mismatch)
45+
if: steps.check_helm.outputs.helm_installed == 'false' || steps.check_helm.outputs.installed_version != steps.helm_version.outputs.version
46+
uses: azure/setup-helm@v4
3647
with:
3748
version: ${{ steps.helm_version.outputs.version }}
38-
- name: Check Helm version
49+
- name: Verify Helm version
3950
shell: bash
4051
run: |
41-
helm version
52+
helm version --short --client

.github/actions/setup-k3d/action.yaml

+14-5
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
# limitations under the License.
1515
#
1616
name: "Setup k3d environment"
17-
description: "A action to set up k3d (k3s in Docker)"
17+
description: "An action to set up k3d (k3s in Docker)"
1818
inputs:
1919
version:
2020
description: "k3d version"
@@ -67,12 +67,21 @@ runs:
6767
echo "tag=${K3S_VERSION}" >> $GITHUB_OUTPUT
6868
env:
6969
K3S_VERSION: ${{ inputs.k3s_version }}
70-
- name: Install k3d
70+
- name: Check if k3d is installed
71+
id: check_k3d
7172
shell: bash
7273
run: |
73-
curl -s ${REPO_URL} | ${{ steps.k3d_version.outputs.tag }} bash
74-
env:
75-
REPO_URL: "https://raw.githubusercontent.com/k3d-io/k3d/main/install.sh"
74+
if command -v k3d &> /dev/null; then
75+
echo "k3d_installed=true" >> $GITHUB_OUTPUT
76+
echo "installed_version=$(k3d version --short | sed 's/^v//')" >> $GITHUB_OUTPUT
77+
else
78+
echo "k3d_installed=false" >> $GITHUB_OUTPUT
79+
fi
80+
- name: Install k3d (if not installed or version mismatch)
81+
if: steps.check_k3d.outputs.k3d_installed == 'false' || steps.check_k3d.outputs.installed_version != steps.k3d_version.outputs.tag
82+
shell: bash
83+
run: |
84+
make k3d/install
7685
- name: Check k3d version
7786
shell: bash
7887
run: |

.github/actions/setup-yq/action.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
# limitations under the License.
1515
#
1616
name: "Setup yq environment"
17-
description: "A action to set up yq"
17+
description: "An action to set up yq"
1818
inputs:
1919
yq_version:
2020
description: "The yq version to use. The default version is `versions/YQ_VERSION`"

.github/actions/wait-for-docker-image/action.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
# limitations under the License.
1515
#
1616
name: "Wait for Docker Images"
17-
description: "A action to wait for Docker images to be published"
17+
description: "An action to wait for Docker images to be published"
1818
inputs:
1919
images:
2020
description: "image names"

.github/workflows/build-binaries.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ jobs:
3838
- name: Set Git config
3939
run: |
4040
git config --global --add safe.directory ${GITHUB_WORKSPACE}
41-
- uses: ./.github/actions/setup-go
4241
- name: Build and zip
4342
run: |
4443
make binary/build/zip

.github/workflows/chatops.yaml

+15-19
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,11 @@ jobs:
2424
- uses: actions/checkout@v4
2525
- uses: ./.github/actions/dump-context
2626
label:
27+
if: github.event.comment.user.login != 'vdaas-ci'
2728
name: Add labels
2829
runs-on: ubuntu-latest
29-
if: github.event.comment.user.login != 'vdaas-ci'
30+
container:
31+
image: ghcr.io/vdaas/vald/vald-ci-container:nightly
3032
steps:
3133
- name: Check PR Comments
3234
id: check_comments_label
@@ -35,8 +37,6 @@ jobs:
3537
TRIGGER_PHRASE: "/label"
3638
env:
3739
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
38-
- uses: ./.github/actions/setup-yq
39-
if: steps.check_comments_label.outputs.BOOL_TRIGGERED == 'true'
4040
- name: Check permissions
4141
if: steps.check_comments_label.outputs.BOOL_TRIGGERED == 'true'
4242
id: check_permissions
@@ -74,9 +74,11 @@ jobs:
7474
USERNAME: ${{ steps.check_comments_label.outputs.COMMENTER_USERNAME }}
7575
TRAILING_LINE: ${{ steps.check_comments_label.outputs.TRAILING_LINE }}
7676
rebase:
77+
if: github.event.comment.user.login != 'vdaas-ci'
7778
name: Rebase
7879
runs-on: ubuntu-latest
79-
if: github.event.comment.user.login != 'vdaas-ci'
80+
container:
81+
image: ghcr.io/vdaas/vald/vald-ci-container:nightly
8082
steps:
8183
- name: Check PR Comments
8284
id: check_comments_rebase
@@ -85,8 +87,6 @@ jobs:
8587
TRIGGER_PHRASE: "/rebase"
8688
env:
8789
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
88-
- uses: ./.github/actions/setup-yq
89-
if: steps.check_comments_rebase.outputs.BOOL_TRIGGERED == 'true'
9090
- name: Check permissions
9191
if: steps.check_comments_rebase.outputs.BOOL_TRIGGERED == 'true'
9292
id: check_permissions
@@ -149,11 +149,13 @@ jobs:
149149
GITHUB_TOKEN: ${{ secrets.DISPATCH_TOKEN }}
150150
API_URL: ${{ github.event.issue.comments_url }}
151151
gentest:
152+
if: github.event.comment.user.login != 'vdaas-ci'
152153
name: Add tests
153154
needs:
154155
- rebase
155156
runs-on: ubuntu-latest
156-
if: github.event.comment.user.login != 'vdaas-ci'
157+
container:
158+
image: ghcr.io/vdaas/vald/vald-ci-container:nightly
157159
steps:
158160
- name: check PR Comments
159161
id: check_comments_gen_test
@@ -162,8 +164,6 @@ jobs:
162164
TRIGGER_PHRASE: "/gen-test"
163165
env:
164166
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
165-
- uses: ./.github/actions/setup-yq
166-
if: steps.check_comments_gen_test.outputs.BOOL_TRIGGERED == 'true'
167167
- name: check permissions
168168
if: steps.check_comments_gen_test.outputs.BOOL_TRIGGERED == 'true'
169169
id: check_permissions
@@ -212,8 +212,6 @@ jobs:
212212
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
213213
git_user_signingkey: true
214214
git_commit_gpgsign: true
215-
- uses: ./.github/actions/setup-go
216-
if: steps.check_comments_gen_test.outputs.BOOL_TRIGGERED == 'true' && steps.check_permissions.outputs.EXECUTABLE == 'true'
217215
- name: Generate tests and push
218216
id: gen_test
219217
if: steps.check_comments_gen_test.outputs.BOOL_TRIGGERED == 'true' && steps.check_permissions.outputs.EXECUTABLE == 'true'
@@ -263,12 +261,14 @@ jobs:
263261
GITHUB_TOKEN: ${{ secrets.DISPATCH_TOKEN }}
264262
API_URL: ${{ github.event.issue.comments_url }}
265263
format:
264+
if: github.event.comment.user.login != 'vdaas-ci'
266265
name: Add license and run golines + gofumpt + goimports
267266
needs:
268267
- rebase
269268
- gentest
270269
runs-on: ubuntu-latest
271-
if: github.event.comment.user.login != 'vdaas-ci'
270+
container:
271+
image: ghcr.io/vdaas/vald/vald-ci-container:nightly
272272
steps:
273273
- name: check PR Comments
274274
id: check_comments_format
@@ -277,8 +277,6 @@ jobs:
277277
TRIGGER_PHRASE: "/format"
278278
env:
279279
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
280-
- uses: ./.github/actions/setup-yq
281-
if: steps.check_comments_format.outputs.BOOL_TRIGGERED == 'true'
282280
- name: check permissions
283281
if: steps.check_comments_format.outputs.BOOL_TRIGGERED == 'true'
284282
id: check_permissions
@@ -327,8 +325,6 @@ jobs:
327325
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
328326
git_user_signingkey: true
329327
git_commit_gpgsign: true
330-
- uses: ./.github/actions/setup-go
331-
if: steps.check_comments_format.outputs.BOOL_TRIGGERED == 'true' && steps.check_permissions.outputs.EXECUTABLE == 'true'
332328
- name: update and push
333329
id: format_push
334330
if: steps.check_comments_format.outputs.BOOL_TRIGGERED == 'true' && steps.check_permissions.outputs.EXECUTABLE == 'true'
@@ -397,12 +393,14 @@ jobs:
397393
GITHUB_TOKEN: ${{ secrets.DISPATCH_TOKEN }}
398394
API_URL: ${{ github.event.issue.comments_url }}
399395
approve:
396+
if: github.event.comment.user.login != 'vdaas-ci'
400397
name: Approve
401398
needs:
402399
- rebase
403400
- format
404401
runs-on: ubuntu-latest
405-
if: github.event.comment.user.login != 'vdaas-ci'
402+
container:
403+
image: ghcr.io/vdaas/vald/vald-ci-container:nightly
406404
steps:
407405
- name: check PR Comments
408406
id: check_comments_approve
@@ -411,8 +409,6 @@ jobs:
411409
TRIGGER_PHRASE: "/approve"
412410
env:
413411
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
414-
- uses: ./.github/actions/setup-yq
415-
if: steps.check_comments_approve.outputs.BOOL_TRIGGERED == 'true'
416412
- name: check permissions
417413
if: steps.check_comments_approve.outputs.BOOL_TRIGGERED == 'true'
418414
id: check_permissions

.github/workflows/e2e-code-bench-agent.yaml

-2
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ jobs:
6464
- name: Set Git config
6565
run: |
6666
git config --global --add safe.directory ${GITHUB_WORKSPACE}
67-
- uses: ./.github/actions/setup-go
6867
- name: Run grpc-sequential
6968
run: |
7069
make hack/benchmark/assets/dataset/${{ env.DATASET }}
@@ -92,7 +91,6 @@ jobs:
9291
- name: Set Git config
9392
run: |
9493
git config --global --add safe.directory ${GITHUB_WORKSPACE}
95-
- uses: ./.github/actions/setup-go
9694
- name: Run grpc-stream
9795
run: |
9896
make hack/benchmark/assets/dataset/${{ env.DATASET }}

0 commit comments

Comments
 (0)