Skip to content

Commit 64b9937

Browse files
author
tytv2
committed
Merge branch 'fixbug-mount-root-node' into dev
2 parents ac94bbd + 4b07e30 commit 64b9937

4 files changed

Lines changed: 77 additions & 35 deletions

File tree

.github/workflows/build_prod.yml

Lines changed: 71 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,84 @@
1-
name: Build image on MAIN branch
1+
name: Release PROD - Build & Push Image
22

33
on:
4-
push:
5-
tags:
6-
- 'v*'
7-
pull_request:
8-
tags:
9-
- 'v*'
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: 'Tag version to build'
8+
required: true
9+
registry:
10+
description: 'Select which registry to build & push to'
11+
required: true
12+
default: 'ALL'
13+
type: choice
14+
options:
15+
- ALL
16+
- VCR_REGISTRY
17+
- VCR_HAN_REGISTRY
1018

1119
jobs:
12-
package-image:
20+
build-and-push:
1321
runs-on: ubuntu-latest
14-
environment:
15-
name: production # Set the environment name
22+
environment: production
23+
1624
steps:
17-
- uses: actions/checkout@v4
18-
- name: Login to VngCloud Registry
25+
- name: Checkout repository
26+
uses: actions/checkout@v4
27+
- name: Set common environment
28+
run: |
29+
echo "REGISTRY_INPUT=${{ github.event.inputs.registry }}" >> $GITHUB_ENV
30+
echo "VERSION=${{ github.event.inputs.version }}" >> $GITHUB_ENV
31+
- name: Show build config
32+
run: |
33+
echo "Building version: ${{ inputs.version }}"
34+
echo "Target registry: ${{ inputs.registry }}"
35+
###########################
36+
# VCR_REGISTRY
37+
###########################
38+
- name: Build image for VCR_REGISTRY
39+
if: env.REGISTRY_INPUT == 'VCR_REGISTRY' || env.REGISTRY_INPUT == 'ALL'
40+
env:
41+
REGISTRY: ${{ vars.VCR_REGISTRY }}
42+
VERSION: ${{ env.VERSION }}
43+
run: make build-local-images
44+
45+
- name: Login to VCR_REGISTRY
46+
if: env.REGISTRY_INPUT == 'VCR_REGISTRY' || env.REGISTRY_INPUT == 'ALL'
1947
uses: docker/login-action@v3
2048
with:
2149
registry: ${{ vars.VCR_REGISTRY }}
2250
username: ${{ secrets.VCR_USERNAME }}
2351
password: ${{ secrets.VCR_PASSWORD }}
24-
- name: Get previous tag
25-
id: previoustag
26-
uses: "WyriHaximus/github-action-get-previous-tag@v1"
52+
53+
- name: Push image to VCR_REGISTRY
54+
if: env.REGISTRY_INPUT == 'VCR_REGISTRY' || env.REGISTRY_INPUT == 'ALL'
55+
env:
56+
REGISTRY: ${{ vars.VCR_REGISTRY }}
57+
VERSION: ${{ env.VERSION }}
58+
run: make push-local-images
59+
60+
###########################
61+
# VCR_HAN_REGISTRY
62+
###########################
63+
64+
- name: Build image for VCR_HAN_REGISTRY
65+
if: env.REGISTRY_INPUT == 'VCR_HAN_REGISTRY' || env.REGISTRY_INPUT == 'ALL'
66+
env:
67+
REGISTRY: ${{ vars.VCR_HAN_REGISTRY }}
68+
VERSION: ${{ env.VERSION }}
69+
run: make build-local-images
70+
71+
- name: Login to VCR_HAN_REGISTRY
72+
if: env.REGISTRY_INPUT == 'VCR_HAN_REGISTRY' || env.REGISTRY_INPUT == 'ALL'
73+
uses: docker/login-action@v3
2774
with:
28-
fallback: 1.0.0 # Optional fallback tag to use when no tag can be found
29-
#workingDirectory: another/path/where/a/git/repo/is/checked/out # Optional alternative working directory
30-
- name: Build and push vngcloud-blockstorage-csi-driver image
75+
registry: ${{ vars.VCR_HAN_REGISTRY }}
76+
username: ${{ secrets.VCR_HAN_USERNAME }}
77+
password: ${{ secrets.VCR_HAN_PASSWORD }}
78+
79+
- name: Push image to VCR_HAN_REGISTRY
80+
if: env.REGISTRY_INPUT == 'VCR_HAN_REGISTRY' || env.REGISTRY_INPUT == 'ALL'
3181
env:
32-
NEW_VERSION: ${{ steps.previoustag.outputs.tag }}
33-
run: |
34-
export REGISTRY=${{ vars.VCR_REGISTRY }}
35-
export VERSION=${{ github.ref_name }}
36-
make bush-local-images
82+
REGISTRY: ${{ vars.VCR_HAN_REGISTRY }}
83+
VERSION: ${{ env.VERSION }}
84+
run: make push-local-images

Makefile

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -145,18 +145,13 @@ build-local-image-%:
145145
--tag $(REGISTRY)/$*:$(VERSION) \
146146
.
147147

148-
bush-image-%:
149-
$(CONTAINER_ENGINE) build \
150-
--build-arg VERSION=$(VERSION) \
151-
--tag $(REGISTRY)/$*:$(VERSION) \
152-
.
153-
148+
push-image-%:
154149
$(CONTAINER_ENGINE) image push $(REGISTRY)/$*:$(VERSION)
155150

156151
# Build all images locally
157152
build-local-images: $(addprefix build-local-image-,$(IMAGE_NAMES))
158153

159-
bush-local-images: $(addprefix bush-image-,$(IMAGE_NAMES))
154+
push-local-images: $(addprefix push-image-,$(IMAGE_NAMES))
160155

161156
# Build a single image for all architectures in ARCHS and push it to REGISTRY
162157
push-multiarch-image-%:

pkg/driver/node.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -758,10 +758,9 @@ func (s *nodeService) isMounted(_ string, target string) (bool, error) {
758758
}
759759

760760
func (s *nodeService) getDevicePath(volumeID string) (string, error) {
761-
var devicePath string
762761
devicePath, err := s.mounter.GetDevicePathBySerialID(volumeID)
763762
if err != nil {
764-
klog.Warningf("Couldn't get device path from mount: %v", err)
763+
return "", fmt.Errorf("failed to get device path for volume %s: %w", volumeID, err)
765764
}
766765

767766
return devicePath, nil
@@ -893,7 +892,7 @@ func checkAllocatable(clientset kubernetes.Interface, nodeName string) error {
893892
}
894893
klog.InfoS("CSINode drivers: ", "nodeName", nodeName, "driverName", csiNode.Spec)
895894
for _, driver := range csiNode.Spec.Drivers {
896-
klog.InfoS("CSINode driver info", "nodeName", nodeName, "driverName", driver.Name, "count", *driver.Allocatable.Count)
895+
klog.InfoS("CSINode driver info", "nodeName", nodeName, "driverName", driver)
897896
if driver.Name == DriverName {
898897
if driver.Allocatable != nil && driver.Allocatable.Count != nil {
899898
klog.InfoS("CSINode Allocatable value is set", "nodeName", nodeName, "count", *driver.Allocatable.Count)

pkg/util/util.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ func ConvertPortalZoneToVMZone(zone string) string {
7373
return "HCM-1C"
7474
case "BKK-01":
7575
return "BKK01"
76-
case "HAN-01":
76+
case "HAN01-1A":
7777
return "az01"
7878
default:
7979
return zone
@@ -91,7 +91,7 @@ func ConvertVMZoneToPortalZone(zone string) string {
9191
case "BKK01":
9292
return "BKK-01"
9393
case "az01":
94-
return "HAN-01"
94+
return "HAN01-1A"
9595
default:
9696
return zone
9797
}

0 commit comments

Comments
 (0)