Skip to content

Commit af8d98b

Browse files
[CI]: Refactor github actions (#2141)
* add action to dump context Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * add reusable workflow to build and push target component Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * test build Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * deleted new line Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * add inherit secret Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * update workflow for ci container Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * move docker related workflow to reusable workflow Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * fix agent sidecar image Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * delete unnecessary of coverage workflow Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * add action to deploy chaos mesh Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * add action to notify slack Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * add reusable workflow to scan image Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * bugfix wrong file specification Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * use local action Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * commentout for debug Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * test execution for binary build Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * delete debug code Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * update checkout setting Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * deleted unused branch rule Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * rename workflow name Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * deleted unused chatops command Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * refactoring codeQL workflow Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * refacroing Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * tweak Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * add cron for ci image build Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * add new line Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * add action to setup E2E test Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * refactoring action to deploy vald and vald helm operator Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * fix job name and deleted unnecessary Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * use local e2e action for agent chaos test Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * fix helm action warning Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * use local e2e action for chaos testing Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * refactoring and use locaal e2e setup action in the e2e deploy workflow Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * use local e2e action for max dimension test Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * use local e2e action for profiling and refactoring format workflow Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * add action to scan docker image Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * refactor: add new line Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * fix workflow execution error Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * fix deprecate Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * deleted unnecessary step and add debug Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * deleted debug comment Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * deleted unnecessary step Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * refactor existing workflow step name Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * update checkout setting Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * fix dump context job name Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * add action to create k3d cluster Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * deleted unnecessary job and step Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * bugfix fails hack test workflow Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * deleted work space settings Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * delete git config settings Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * add duplicate workflow running rule and add indent Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * proto build for debug Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * add safe directory settings Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * delete debug code because build-protobuf workflow was successful Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * deleted unnecessary max-parallel configuration for matrics job Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * set safe directory to docker image scan workflow Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * set safe directory to build-binary workflow and refactoring docker image scan workflow Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * debug build binary workflow Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * Revert "debug build binary workflow" This reverts commit 35e5d14. * debug build protobuf workflow Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * delete debug workflow rule Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * add debug rule to chatops help workflow and refactoring Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * add debug url for comment api Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * delete debug workflow rule for chaotops help Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * set safe directory to codeql workflow Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * set safe directory to coverage workflow Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * delete unnecessary job name Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * debug for internal config changes workflow Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * Revert "debug for internal config changes workflow" This reverts commit 5d68cd3. * fix docker image build rule Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * fix concurrency group name for reusable docker image workflow Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * deleted debug rule of docker image scan workflow Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * add action to setup yq Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * deleted unnecessary environment Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * add new workflow rule for docker build Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * rename docekr image scan workflow Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * add workflow to dispatch vald client Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> deleted unnecessary workflow Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * deleted unnecessary step Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * debug for scan docker image Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * Revert "debug for scan docker image" This reverts commit f6ee241. * add safe directory settings to test/hack-test workflow Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * fix fails hack test Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * refactor existing workflow Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * rename workflow name for proto update Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * add working directory for hack test Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * set safe directory and rename workflow file Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * add debug rule for update pull request template workflow Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * Revert "add debug rule for update pull request template workflow" This reverts commit 967dff9. * add debug rule for update pull request template workflow Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * Revert "add debug rule for update pull request template workflow" This reverts commit 4ef0388. * set safe directory and small refactor for semver workflow Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * update configuration for reviewdog workflow Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * add action to determine docekr image tag name and fix helm workflow Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * deleted unnecessary commentout Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * add safe directory settings to e2e and formater workflow Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * bugfix e2e agent test error Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * use local setup go action Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * deleted unnecessary step Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * add debug rule for helm lint workflow Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * Revert "add debug rule for helm lint workflow" This reverts commit 7fd16da. * add new line between steps Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * add debug rule for helm workflow Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * fix workflow execution rule for debug Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * Revert "fix workflow execution rule for debug" This reverts commit 8cc7e30. * Revert "add debug rule for helm workflow" This reverts commit 77a2c7e. * update step name for fossa workflow Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * add workflow execution rule Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * enable e2e workflow Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * fix job execution rule for e2e Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * enable e2e deploy step Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * add new rob execution rule for fossa Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * deleted unnecessary actions parameter Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * deleted unnecessary actions parameter of helm operator deploy Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * deleted unnecessary log Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * output values or valdrelease.yaml Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * update insert vector count of e2e deploy workflow Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * change default value to install libhdf5 Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * bugfix operator deploy using specified image tag Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * add HELM_EXTRA_OPTIONS for helm operator deploy Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * fix step name Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * bugfix passing of helm option Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * bugfix use default nightly image Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * bugfix assign of previous step result Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * set nightly version as default to valdrelease Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * fix typo Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * [CI]: Improve Chaos E2E test (#2151) * e2e test Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * reduce inserted vector size Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * reduce search by id count Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * enable ingress when running e2e-chaos test Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * style: Format code with prettier and gofumpt * change discovery duration for chaos test Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * enable persistent volume for e2e chaos testing Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * fix pv access mode to prevent unsupported error Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * use make e2e/insert/search command Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * set workflow environment variable Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * add new environment variable for refactor Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * fix index replicas Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * update helth check duration for grpc client Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> --------- Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com> * add step to dump github context Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * refactor step name Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * fix actions description to be more clear Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * update job name formatting and update workflow description Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * debug for slack notifycation Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * Revert "debug for slack notifycation" This reverts commit 21d7e3d. * update description of dump-context action Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * add command and fix workflow run rule Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * add workflow execution rule for index manager docker build Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * enable rebase command Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * change file name from e2e-deploy to e2e Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * revert moditication about vector count Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> * change file name from test to unit-test Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> --------- Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com> Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
1 parent bb04cb2 commit af8d98b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+1731
-3496
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: "Deploy Chaos Mesh"
2+
description: "A action to deploy Chaos Mesh"
3+
4+
inputs:
5+
chaos_mesh_version:
6+
description: "The Chaos Mesh version to use. The default version is `versions/CHAOS_MESH_VERSION`"
7+
required: false
8+
default: ""
9+
helm_extra_options:
10+
description: "Extra options that passed to Helm command"
11+
required: false
12+
default: ""
13+
14+
runs:
15+
using: "composite"
16+
steps:
17+
- name: Fetch Chaos Mesh version
18+
id: chaos_mesh_version
19+
shell: bash
20+
run: |
21+
CHAOS_MESH_VERSION=${CHAOS_MESH_VERSION:-`cat versions/CHAOS_MESH_VERSION`}
22+
23+
echo "version=${CHAOS_MESH_VERSION}" >> $GITHUB_OUTPUT
24+
env:
25+
CHAOS_MESH_VERSION: ${{ inputs.chaos_mesh_version }}
26+
27+
- name: Check k3d
28+
shell: bash
29+
id: check_k3d
30+
run: |
31+
kubectl cluster-info
32+
33+
- name: Check Helm
34+
shell: bash
35+
run: |
36+
helm version
37+
38+
- name: Deploy Chaos Mesh
39+
shell: bash
40+
run: |
41+
make kubectl/install
42+
43+
curl -sSL "https://mirrors.chaos-mesh.org/v${CHAOS_MESH_VERSION}/install.sh" | bash -s -- --k3s
44+
45+
helm install \
46+
${HELM_EXTRA_OPTIONS} \
47+
vald-chaos-test tests/chaos/chart
48+
env:
49+
HELM_EXTRA_OPTIONS: ${{ inputs.helm_extra_options }}
50+
CHAOS_MESH_VERSION: ${{ steps.chaos_mesh_version.outputs.version }}

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

+8-5
Original file line numberDiff line numberDiff line change
@@ -14,26 +14,28 @@
1414
# limitations under the License.
1515
#
1616
name: "Detect Docker image tags"
17-
description: "Detect Docker image tags"
17+
description: "A action to detect Docker image tags"
18+
1819
inputs:
1920
tag_name:
20-
description: "tag name to check whether exists or not"
21+
description: "Tag name to check whether exists or not"
2122
required: true
2223
default: ""
2324
images:
24-
description: "image names"
25+
description: "Image names"
2526
required: false
2627
default: "vdaas/vald-agent-ngt \
2728
vdaas/vald-discoverer-k8s \
2829
vdaas/vald-lb-gateway \
2930
vdaas/vald-manager-index"
3031
outputs:
3132
HELM_EXTRA_OPTIONS:
32-
description: "helm extra options that specifies image tags"
33+
description: "Helm extra options that specifies image tags"
3334
value: ${{ steps.specify_container_versions.outputs.HELM_EXTRA_OPTIONS }}
3435
IMAGE_TAGS:
35-
description: "specifies image tags"
36+
description: "Specifies image tags"
3637
value: ${{ steps.specify_container_versions.outputs.IMAGE_TAGS }}
38+
3739
runs:
3840
using: "composite"
3941
steps:
@@ -47,6 +49,7 @@ runs:
4749
["vdaas/vald-discoverer-k8s"]="discoverer.image.tag"
4850
["vdaas/vald-lb-gateway"]="gateway.lb.image.tag"
4951
["vdaas/vald-manager-index"]="manager.index.image.tag"
52+
["vdaas/vald-helm-operator"]="image.tag"
5053
)
5154
5255
for image in ${IMAGES}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: "Determine Docker image tag"
2+
description: "A action to determine Docker image tag"
3+
4+
outputs:
5+
PRIMARY_TAG:
6+
description: "Primary tag"
7+
value: ${{ steps.determine_tag_name.outputs.PRIMARY_TAG }}
8+
9+
runs:
10+
using: "composite"
11+
steps:
12+
- name: Dump Github context
13+
shell: bash
14+
run: |
15+
echo "GITHUB_REF $GITHUB_REF"
16+
echo "GITHUB_EVENT_PATH $GITHUB_EVENT_PATH"
17+
echo "GITHUB_EVENT_NAME ${{ github.event_name }}"
18+
echo "GITHUB_EVENT_NUMBER ${{ github.event.number }}"
19+
20+
- name: Determine tag name
21+
shell: bash
22+
id: determine_tag_name
23+
run: |
24+
if [[ "$GITHUB_REF" =~ ^refs/tags/.* ]]; then
25+
tag_name=`echo $GITHUB_REF | sed -e 's:^refs/tags/::'`
26+
primary_tag="${tag_name}"
27+
elif [ "${{ github.event_name }}" = "pull_request" ]; then
28+
pr_num=`cat $GITHUB_EVENT_PATH | jq -r ".number"`
29+
echo "PR-${pr_num}" > versions/VALD_VERSION
30+
primary_tag="pr-${pr_num}"
31+
elif [ "${{ github.event_name }}" = "pull_request_target" ]; then
32+
pr_num=`cat $GITHUB_EVENT_PATH | jq -r ".number"`
33+
echo "PR-${pr_num}" > versions/VALD_VERSION
34+
primary_tag="pr-${pr_num}"
35+
elif [ "$GITHUB_REF" = "refs/heads/main" ]; then
36+
echo "nightly" > versions/VALD_VERSION
37+
primary_tag="nightly"
38+
else
39+
primary_tag="unknown"
40+
fi
41+
echo "PRIMARY_TAG is determined: ${primary_tag}"
42+
echo "PRIMARY_TAG=${primary_tag}" >> $GITHUB_OUTPUT

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

+16-34
Original file line numberDiff line numberDiff line change
@@ -14,36 +14,38 @@
1414
# limitations under the License.
1515
#
1616
name: "Build Docker images"
17-
description: "Build Docker images and publish them"
17+
description: "A action to build Docker images and publish them"
18+
1819
inputs:
1920
target:
20-
description: "build target"
21+
description: "Build target"
2122
required: true
2223
default: "base"
2324
builder:
24-
description: "buildx builder name"
25+
description: "Buildx builder name"
2526
required: true
2627
default: ""
2728
platforms:
28-
description: "if it is specified, specified platforms will be used."
29+
description: "If it is specified, specified platforms will be used."
2930
required: false
3031
default: ""
3132
outputs:
3233
IMAGE_NAME:
33-
description: "image name"
34+
description: "Image name"
3435
value: ${{ steps.image_name.outputs.IMAGE_NAME }}
3536
ALTER_IMAGE_NAME:
36-
description: "alter image name"
37+
description: "Alter image name"
3738
value: ${{ steps.image_name.outputs.ALTER_IMAGE_NAME }}
3839
PRIMARY_TAG:
39-
description: "primary tag"
40+
description: "Primary tag"
4041
value: ${{ steps.determine_tag_name.outputs.PRIMARY_TAG }}
4142
PLATFORMS:
42-
description: "target platforms"
43+
description: "Target platforms"
4344
value: ${{ steps.determine_platforms.outputs.PLATFORMS }}
4445
EXTRA_TAGS:
45-
description: "extra tags"
46+
description: "Extra tags"
4647
value: ${{ steps.add_extra_tags.outputs.EXTRA_TAGS }}
48+
4749
runs:
4850
using: "composite"
4951
steps:
@@ -60,33 +62,11 @@ runs:
6062
echo "ALTER_IMAGE_NAME=${alter_image_name}" >> $GITHUB_OUTPUT
6163
env:
6264
TARGET: ${{ inputs.target }}
65+
6366
- name: Determine tag name
64-
shell: bash
6567
id: determine_tag_name
66-
run: |
67-
echo "GITHUB_REF $GITHUB_REF"
68-
echo "GITHUB_EVENT_PATH $GITHUB_EVENT_PATH"
69-
echo "GITHUB_EVENT_NAME ${{ github.event_name }}"
70-
echo "GITHUB_EVENT_NUMBER ${{ github.event.number }}"
71-
if [[ "$GITHUB_REF" =~ ^refs/tags/.* ]]; then
72-
tag_name=`echo $GITHUB_REF | sed -e 's:^refs/tags/::'`
73-
primary_tag="${tag_name}"
74-
elif [ "${{ github.event_name }}" = "pull_request" ]; then
75-
pr_num=`cat $GITHUB_EVENT_PATH | jq -r ".number"`
76-
echo "PR-${pr_num}" > versions/VALD_VERSION
77-
primary_tag="pr-${pr_num}"
78-
elif [ "${{ github.event_name }}" = "pull_request_target" ]; then
79-
pr_num=`cat $GITHUB_EVENT_PATH | jq -r ".number"`
80-
echo "PR-${pr_num}" > versions/VALD_VERSION
81-
primary_tag="pr-${pr_num}"
82-
elif [ "$GITHUB_REF" = "refs/heads/main" ]; then
83-
echo "nightly" > versions/VALD_VERSION
84-
primary_tag="nightly"
85-
else
86-
primary_tag="unknown"
87-
fi
88-
echo "PRIMARY_TAG is determined: ${primary_tag}"
89-
echo "PRIMARY_TAG=${primary_tag}" >> $GITHUB_OUTPUT
68+
uses: ./.github/actions/determine-docker-image-tag
69+
9070
- name: Determine platforms
9171
shell: bash
9272
id: determine_platforms
@@ -106,6 +86,7 @@ runs:
10686
echo "PLATFORMS=${platforms}" >> $GITHUB_OUTPUT
10787
env:
10888
TARGET_PLATFORMS: ${{ inputs.platforms }}
89+
10990
- name: Add extra tags
11091
shell: bash
11192
id: add_extra_tags
@@ -121,6 +102,7 @@ runs:
121102
IMAGE_NAME: ${{ steps.image_name.outputs.IMAGE_NAME }}
122103
ALTER_IMAGE_NAME: ${{ steps.image_name.outputs.ALTER_IMAGE_NAME }}
123104
PRIMARY_TAG: ${{ steps.determine_tag_name.outputs.PRIMARY_TAG }}
105+
124106
- name: Build and Push
125107
shell: bash
126108
id: build_and_push
+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: "Dump context to log"
2+
description: "A action to dump context to log"
3+
4+
runs:
5+
using: "composite"
6+
steps:
7+
- name: "Dump GitHub context"
8+
shell: bash
9+
run: echo $JSON
10+
env:
11+
JSON: ${{toJSON(github)}}
12+
13+
- name: "Dump job context"
14+
shell: bash
15+
run: echo $JSON
16+
env:
17+
JSON: ${{ toJSON(job) }}
18+
19+
- name: "Dump steps context"
20+
shell: bash
21+
run: echo $JSON
22+
env:
23+
JSON: ${{toJSON(steps)}}
24+
25+
- name: "Dump runner context"
26+
shell: bash
27+
run: echo $JSON
28+
env:
29+
JSON: ${{toJSON(runner)}}
30+
31+
- name: "Dump strategy context"
32+
shell: bash
33+
run: echo $JSON
34+
env:
35+
JSON: ${{toJSON(strategy)}}
36+
37+
- name: "Dump matrix context"
38+
shell: bash
39+
run: echo $JSON
40+
env:
41+
JSON: ${{toJSON(matrix)}}

0 commit comments

Comments
 (0)