Skip to content

Commit 8eebb8d

Browse files
authored
CI: Retry update resources with the conflict error (#4843)
Signed-off-by: Cyclinder Kuo <[email protected]>
1 parent 70e9060 commit 8eebb8d

File tree

3 files changed

+41
-25
lines changed

3 files changed

+41
-25
lines changed

.github/workflows/auto-nightly-ci.yaml

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -175,17 +175,19 @@ jobs:
175175
e2e_labels: ${{ needs.get_ref.outputs.e2e_labels }}
176176
secrets: inherit
177177

178-
call_low_kernel:
179-
needs: [call_build_ci_image, get_ref, call_release_chart]
180-
if: ${{ needs.get_ref.outputs.e2e_enabled == 'true' && needs.get_ref.outputs.ipfamily_dual_e2e == 'true' }}
181-
uses: ./.github/workflows/e2e-init.yaml
182-
with:
183-
os: ubuntu-20.04
184-
ip_family: dual
185-
image_tag: ${{ needs.call_build_ci_image.outputs.imageTag }}
186-
ref: ${{ needs.get_ref.outputs.ref }}
187-
e2e_labels: ${{ needs.get_ref.outputs.e2e_labels }}
188-
secrets: inherit
178+
# This is a scheduled Ubuntu 20.04 retirement. Ubuntu 20.04 LTS runner will be removed on 2025-04-15.
179+
# For more details, see https://github.com/actions/runner-images/issues/11101Show less
180+
# call_low_kernel:
181+
# needs: [call_build_ci_image, get_ref, call_release_chart]
182+
# if: ${{ needs.get_ref.outputs.e2e_enabled == 'true' && needs.get_ref.outputs.ipfamily_dual_e2e == 'true' }}
183+
# uses: ./.github/workflows/e2e-init.yaml
184+
# with:
185+
# os: ubuntu-22.04
186+
# ip_family: dual
187+
# image_tag: ${{ needs.call_build_ci_image.outputs.imageTag }}
188+
# ref: ${{ needs.get_ref.outputs.ref }}
189+
# e2e_labels: ${{ needs.get_ref.outputs.e2e_labels }}
190+
# secrets: inherit
189191

190192
creat_issue:
191193
runs-on: ubuntu-latest

.github/workflows/auto-pr-ci.yaml

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -241,17 +241,19 @@ jobs:
241241
e2e_labels: ${{ needs.get_ref.outputs.e2e_labels }}
242242
secrets: inherit
243243

244-
e2e_dual_ubuntu_20:
245-
needs: [call_build_ci_image, get_ref, call_release_chart]
246-
if: ${{ needs.get_ref.outputs.e2e_enabled == 'true' && needs.get_ref.outputs.ipfamily_dual_e2e == 'true' }}
247-
uses: ./.github/workflows/e2e-init.yaml
248-
with:
249-
os: ubuntu-20.04
250-
ip_family: dual
251-
image_tag: ${{ needs.call_build_ci_image.outputs.imageTag }}
252-
ref: ${{ needs.get_ref.outputs.ref }}
253-
e2e_labels: ${{ needs.get_ref.outputs.e2e_labels }}
254-
secrets: inherit
244+
# This is a scheduled Ubuntu 20.04 retirement. Ubuntu 20.04 LTS runner will be removed on 2025-04-15.
245+
# For more details, see https://github.com/actions/runner-images/issues/11101Show less
246+
# e2e_dual_ubuntu_20:
247+
# needs: [call_build_ci_image, get_ref, call_release_chart]
248+
# if: ${{ needs.get_ref.outputs.e2e_enabled == 'true' && needs.get_ref.outputs.ipfamily_dual_e2e == 'true' }}
249+
# uses: ./.github/workflows/e2e-init.yaml
250+
# with:
251+
# os: ubuntu-20.04
252+
# ip_family: dual
253+
# image_tag: ${{ needs.call_build_ci_image.outputs.imageTag }}
254+
# ref: ${{ needs.get_ref.outputs.ref }}
255+
# e2e_labels: ${{ needs.get_ref.outputs.e2e_labels }}
256+
# secrets: inherit
255257

256258
e2e_dual_k8s_12:
257259
needs: [call_build_ci_image, get_ref, call_release_chart]

test/e2e/annotation/annotation_test.go

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import (
2222
pkgconstant "github.com/spidernet-io/spiderpool/pkg/constant"
2323
spiderpool "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1"
2424
"github.com/spidernet-io/spiderpool/pkg/types"
25+
"github.com/spidernet-io/spiderpool/pkg/utils/retry"
2526
"github.com/spidernet-io/spiderpool/test/e2e/common"
2627
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2728
)
@@ -432,7 +433,10 @@ var _ = Describe("test annotation", Label("annotation"), func() {
432433
GinkgoWriter.Printf("Generate namespace objects: %v with namespace annotations \n", namespaceObject)
433434

434435
// Update the namespace with the generated namespace object with annotation
435-
Expect(frame.UpdateResource(namespaceObject)).NotTo(HaveOccurred())
436+
err = retry.RetryOnConflictWithContext(context.Background(), retry.DefaultBackoff, func(ctx context.Context) error {
437+
return frame.UpdateResource(namespaceObject)
438+
})
439+
Expect(err).NotTo(HaveOccurred())
436440
GinkgoWriter.Printf("Succeeded to update namespace: %v object \n", nsName)
437441
})
438442

@@ -1036,7 +1040,11 @@ var _ = Describe("test annotation", Label("annotation"), func() {
10361040
if frame.Info.IpV6Enabled {
10371041
newSpiderMultusConfig.Spec.MacvlanConfig.SpiderpoolConfigPools.IPv6IPPool = []string{v6PoolName1}
10381042
}
1039-
Expect(frame.UpdateResource(newSpiderMultusConfig)).NotTo(HaveOccurred())
1043+
1044+
err = retry.RetryOnConflictWithContext(context.Background(), retry.DefaultBackoff, func(ctx context.Context) error {
1045+
return frame.UpdateResource(newSpiderMultusConfig)
1046+
})
1047+
Expect(err).NotTo(HaveOccurred())
10401048
Eventually(func() bool {
10411049
_, err := frame.GetSpiderMultusInstance(nsName, spiderMultusNadName)
10421050
return !errors.IsNotFound(err)
@@ -1157,7 +1165,11 @@ var _ = Describe("test annotation", Label("annotation"), func() {
11571165
common.MultusDefaultNetwork: fmt.Sprintf("%s/%s", common.MultusNs, common.MacvlanUnderlayVlan0),
11581166
common.MultusNetworks: fmt.Sprintf("%s/%s", common.MultusNs, common.MacvlanVlan100),
11591167
}
1160-
Expect(frame.UpdateResource(stsObj)).NotTo(HaveOccurred())
1168+
1169+
err = retry.RetryOnConflictWithContext(context.Background(), retry.DefaultBackoff, func(ctx context.Context) error {
1170+
return frame.UpdateResource(stsObj)
1171+
})
1172+
Expect(err).NotTo(HaveOccurred())
11611173

11621174
// 5.After the corresponding NIC's IP pool is changed, the IP of the stateful application can also be updated.
11631175
newPodList := &corev1.PodList{}

0 commit comments

Comments
 (0)