Skip to content

Commit 96dfacb

Browse files
author
openshift-pipelines-bot
committed
[bot] Update main from openshift-pipelines/manual-approval-gate to 6336d097d795b40568f2e98240c77d887e62d0b8
$ git diff --stat 6336d097d795b40568f2e98240c77d887e62d0b8..ac0d2c063bc84d1ab28c1a3cae27aba3ae1adb6b .../auto-merge-upstream-manual-approval-gate.yaml | 2 +- .github/workflows/latest.yml | 6 +++--- .github/workflows/release.yml | 2 +- .../update-sources-manual-approval-gate.yaml | 2 +- pkg/reconciler/approvaltask/approvaltask.go | 23 ---------------------- 5 files changed, 6 insertions(+), 29 deletions(-) https://github.com/openshift-pipelines/manual-approval-gate/compare/6336d097d795b40568f2e98240c77d887e62d0b8..ac0d2c063bc84d1ab28c1a3cae27aba3ae1adb6b
1 parent 5db7901 commit 96dfacb

File tree

6 files changed

+30
-7
lines changed

6 files changed

+30
-7
lines changed

head

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
ac0d2c063bc84d1ab28c1a3cae27aba3ae1adb6b
1+
6336d097d795b40568f2e98240c77d887e62d0b8

upstream/.github/workflows/auto-merge-upstream-manual-approval-gate.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
pull-requests: write
1414
steps:
1515
- name: Checkout the current repo
16-
uses: actions/checkout@v4
16+
uses: actions/checkout@v6
1717
- name: auto-merge-upstream-manual-approval-gate
1818
run: |
1919
gh auth status

upstream/.github/workflows/latest.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
build:
1313
runs-on: ubuntu-latest
1414
steps:
15-
- uses: actions/checkout@v4
15+
- uses: actions/checkout@v6
1616
- name: Set up Go
1717
uses: actions/setup-go@v5
1818
with:
@@ -43,7 +43,7 @@ jobs:
4343
with:
4444
go-version: 1.21
4545
- uses: imjasonh/[email protected]
46-
- uses: actions/checkout@v4
46+
- uses: actions/checkout@v6
4747
- uses: actions/cache@v4
4848
with:
4949
path: |
@@ -72,7 +72,7 @@ jobs:
7272
- uses: actions/setup-go@v5
7373
with:
7474
go-version: 1.21
75-
- uses: actions/checkout@v4
75+
- uses: actions/checkout@v6
7676
- uses: actions/cache@v4
7777
with:
7878
path: |

upstream/.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
repository-projects: write
1919

2020
steps:
21-
- uses: actions/checkout@v4
21+
- uses: actions/checkout@v6
2222
- uses: docker/login-action@v3
2323
with:
2424
registry: ghcr.io

upstream/.github/workflows/update-sources-manual-approval-gate.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
pull-requests: write
1616
steps:
1717
- name: Checkout the current repo
18-
uses: actions/checkout@v4
18+
uses: actions/checkout@v6
1919
with:
2020
ref: main
2121

upstream/pkg/reconciler/approvaltask/approvaltask.go

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ const (
5959
allApprovers = "approvers"
6060
approvalsRequired = "numberOfApprovalsRequired"
6161
description = "description"
62+
timeout = "timeout"
6263

6364
// CustomRunLabelKey is used as the label identifier for a ApprovalTask
6465
CustomRunLabelKey = "tekton.dev/customRun"
@@ -135,6 +136,24 @@ func (c *Reconciler) ReconcileKind(ctx context.Context, run *v1beta1.CustomRun)
135136
return nil
136137
}
137138

139+
// Parse timeout parameter from params if provided
140+
if run.Spec.Timeout == nil {
141+
for _, param := range run.Spec.Params {
142+
if param.Name == timeout {
143+
duration, err := time.ParseDuration(param.Value.StringVal)
144+
if err != nil {
145+
logger.Errorf("Invalid timeout parameter value '%s' for Run %s/%s: %v", param.Value.StringVal, run.Namespace, run.Name, err)
146+
run.Status.MarkCustomRunFailed(approvaltaskv1alpha1.ApprovalTaskRunReasonFailedValidation.String(),
147+
fmt.Sprintf("Invalid timeout parameter: %s", err.Error()))
148+
return nil
149+
}
150+
run.Spec.Timeout = &metav1.Duration{Duration: duration}
151+
logger.Infof("Set timeout from parameter to %v for Run %s/%s", duration, run.Namespace, run.Name)
152+
break
153+
}
154+
}
155+
}
156+
138157
// Store the condition before reconcile
139158
beforeCondition := run.Status.GetCondition(apis.ConditionSucceeded)
140159

@@ -214,6 +233,10 @@ func (r *Reconciler) reconcile(ctx context.Context, run *v1beta1.CustomRun, stat
214233
if approvalTask.Status.StartTime != nil {
215234
elapsed := r.clock.Since(approvalTask.Status.StartTime.Time)
216235
waitTime := timeout.Duration - elapsed
236+
// If waitTime is negative or very small, requeue immediately to check timeout
237+
if waitTime <= 0 {
238+
waitTime = time.Second
239+
}
217240
return controller.NewRequeueAfter(waitTime)
218241
}
219242

0 commit comments

Comments
 (0)