Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement startupGracePeriod in wait-list #821

Merged
merged 60 commits into from
Jun 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
075a3fc
Rename
kachick May 28, 2024
12e829c
Remove unused code
kachick May 28, 2024
a50edd6
Add E2E CI
kachick May 28, 2024
39585e1
Adjust waiting
kachick May 28, 2024
728d186
Guilty of copy and paste GH-771 product
kachick May 28, 2024
104e073
Revert "Adjust waiting"
kachick May 28, 2024
6140a17
Fix ignoring logic
kachick May 28, 2024
c40c522
Perfectly forgotten my codebase
kachick May 28, 2024
efc2703
Better CI experience
kachick May 28, 2024
2d7b34e
We can set as this
kachick May 28, 2024
128d789
continue-on-error and no skip-list CI is a hardthing
kachick May 28, 2024
dfe854f
Revert "continue-on-error and no skip-list CI is a hardthing"
kachick May 28, 2024
fbf6830
Add ugly but reasonable workaround
kachick May 28, 2024
a89274b
Retire to realize whole E2E CI in PRs
kachick May 28, 2024
f1d6e70
Standardize to measure with performance API for durations
kachick May 29, 2024
c464691
Better debug logger to get snapshots
kachick May 29, 2024
eba8002
Temporary enable failing jobs to make snapshots
kachick May 29, 2024
e4ade4a
Clarify which job needs debug logging
kachick May 29, 2024
8c14d2a
Revert "Clarify which job needs debug logging"
kachick May 29, 2024
831aeaf
Add snapshot tests
kachick May 29, 2024
0e2505c
`makers check`
kachick May 29, 2024
81ae5cd
Refine reporting interface
kachick May 29, 2024
7b1d264
Skip failing CI again
kachick May 29, 2024
9e75bc3
Rename s/marginOfStartingSeconds/startupGracePeriod/
kachick May 29, 2024
2992f25
`pnpm install temporal-polyfill`
kachick May 29, 2024
03c5201
Use Temporal.Duration from this feature
kachick May 29, 2024
5148adf
Update needless renamed assign
kachick May 29, 2024
2610290
Follow renamed feature in workflow name
kachick May 29, 2024
a5f284a
Use rawdata for schema layer for now
kachick May 29, 2024
77e6d5a
Keep shorter workflow name
kachick May 29, 2024
bb756f3
Fix use of Duration.compare()
kachick May 29, 2024
02f652a
Refactor some test with sub testing
kachick May 29, 2024
faac3e1
No need to cast here
kachick May 29, 2024
c24381c
Clarify same triggers
kachick May 29, 2024
36c07bc
Print unstarted state in the log
kachick May 29, 2024
61900d1
Print elapsed time for each folded log header
kachick May 29, 2024
371a65e
Make depend only on intermediate table for generateReport to make tes…
kachick May 30, 2024
e1b6914
Refine reporting with the structured loggers
kachick May 31, 2024
62341ee
Highlight with green for happy path again
kachick May 31, 2024
142fcd0
Do not color for debug object
kachick May 31, 2024
e973b27
Do not print undefined
kachick May 31, 2024
60aad86
Success message only be displayed after last polling
kachick May 31, 2024
5a5f356
Fix wording
kachick May 31, 2024
28629bf
Better logger for each summary
kachick May 31, 2024
0f14e46
Update unit tests
kachick May 31, 2024
30e5b0a
Fix dropped code around early exit
kachick May 31, 2024
10474da
Clarify this timestamp is the beginning
kachick May 31, 2024
b99943c
Squash GH-771 E2E CI to single file
kachick Jun 2, 2024
cfd2acc
Gathers the logged resources
kachick Jun 2, 2024
8b24796
Logging resources only in nortable events
kachick Jun 2, 2024
9936cda
Fix a typo
kachick Jun 2, 2024
4903383
Restrict groupBy typing
kachick Jun 2, 2024
71dd127
Remove unused code
kachick Jun 2, 2024
83c1a0a
Improve readability for a unit test
kachick Jun 2, 2024
b21255c
Update CHANGELOG
kachick Jun 2, 2024
31bb186
Refine updated README
kachick Jun 2, 2024
47682d0
Make sure the failing pattern again
kachick Jun 2, 2024
18c7c4a
Revert "Make sure the failing pattern again"
kachick Jun 2, 2024
1cb1542
Clarify this feature is not released
kachick Jun 2, 2024
1055234
Rename log folder
kachick Jun 2, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: GH-771 - Wait
name: GH-771 - Event Name
on:
push:
paths:
Expand All @@ -16,6 +16,15 @@ on:
permissions: {}

jobs:
echo:
runs-on: ubuntu-24.04
if: ${{ github.actor != 'dependabot[bot]' && github.actor != 'renovate[bot]' }}
timeout-minutes: 5
steps:
- name: Print note
run: |
echo 'Triggered by ${{ github.event_name }} event'
echo 'See https://github.com/kachick/wait-other-jobs/issues/771 for the detail'
wait:
runs-on: ubuntu-24.04
if: ${{ github.actor != 'dependabot[bot]' && github.actor != 'renovate[bot]' }}
Expand All @@ -30,10 +39,12 @@ jobs:
retry-method: 'equal_intervals'
min-interval-seconds: 5
attempt-limits: 30
skip-same-workflow: 'false'
wait-list: |
[
{
"workflowFile": "GH-771-targets.yml",
"workflowFile": "GH-771-eventname.yml",
"jobName": "echo",
"eventName": "${{ github.event_name }}"
}
]
27 changes: 0 additions & 27 deletions .github/workflows/GH-771-targets.yml

This file was deleted.

97 changes: 97 additions & 0 deletions .github/workflows/GH-820-graceperiod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
name: GH-820 - Grace Period
on:
push:
branches: [main]
paths:
- '**GH-820**'
- 'action.yml'
- 'dist/**'
pull_request:
paths:
- '**GH-820**'
- 'action.yml'
- 'dist/**'
workflow_dispatch:

# Disable all permissions in workflow global as to setup clean room
# However PRs will have read permissions because this project is on a public repository
permissions: {}

jobs:
quickstarter-success:
runs-on: ubuntu-24.04
timeout-minutes: 5
steps:
- run: echo ':)'
intermediate:
runs-on: ubuntu-24.04
timeout-minutes: 5
steps:
- run: sleep 15
slowstarter-success:
runs-on: ubuntu-24.04
timeout-minutes: 5
needs: [intermediate]
steps:
- run: echo ':)'
slowstarter-fail:
if: github.event_name == 'workflow_dispatch'
runs-on: ubuntu-24.04
timeout-minutes: 5
needs: [intermediate]
steps:
- run: |
echo ':<'
false
wait-success:
runs-on: ubuntu-24.04
timeout-minutes: 15
steps:
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
- uses: ./
with:
retry-method: 'equal_intervals'
wait-seconds-before-first-polling: '0'
min-interval-seconds: '5'
attempt-limits: '100'
wait-list: |
[
{
"workflowFile": "GH-820-graceperiod.yml",
"optional": false,
"jobName": "quickstarter-success"
},
{
"workflowFile": "GH-820-graceperiod.yml",
"optional": false,
"jobName": "slowstarter-success",
"startupGracePeriod": { "seconds": 60 }
}
]
wait-fail:
if: github.event_name == 'workflow_dispatch'
runs-on: ubuntu-24.04
timeout-minutes: 15
steps:
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
- uses: ./
with:
retry-method: 'equal_intervals'
wait-seconds-before-first-polling: '0'
min-interval-seconds: '5'
attempt-limits: '100'
wait-list: |
[
{
"workflowFile": "GH-820-graceperiod.yml",
"optional": false,
"jobName": "quickstarter-success"
},
{
"workflowFile": "GH-820-graceperiod.yml",
"optional": false,
"jobName": "slowstarter-fail",
"startupGracePeriod": { "seconds": 60 }
}
]

26 changes: 23 additions & 3 deletions .github/workflows/itself.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,11 @@ on:
branches: [main]
paths:
- '.github/workflows/itself.yml'
- '.github/workflows/GH-771-echo.yml'
- 'action.yml'
- 'dist/**'
pull_request:
paths:
- '.github/workflows/itself.yml'
- '.github/workflows/GH-771-echo.yml'
- 'action.yml'
- 'dist/**'
schedule:
Expand All @@ -32,8 +30,15 @@ jobs:
timeout-minutes: 10
steps:
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
# Do NOT specify any options here to make sure zero config may work
# Do NOT specify options except non omittable skip-list to make sure zero config may work
- uses: ./
with:
skip-list: |
[
{
"workflowFile": "GH-820-graceperiod.yml"
}
]
validation_example_basic_errors_allow_failure:
runs-on: ubuntu-24.04
if: ${{ github.actor != 'dependabot[bot]' && github.actor != 'renovate[bot]' }}
Expand Down Expand Up @@ -91,6 +96,12 @@ jobs:
min-interval-seconds: 2
attempt-limits: 2
skip-same-workflow: 'true'
skip-list: |
[
{
"workflowFile": "GH-820-graceperiod.yml"
}
]
equal_intervals:
runs-on: ubuntu-24.04
if: ${{ github.actor != 'dependabot[bot]' && github.actor != 'renovate[bot]' }}
Expand All @@ -105,6 +116,12 @@ jobs:
min-interval-seconds: 10
attempt-limits: 60
skip-same-workflow: 'true'
skip-list: |
[
{
"workflowFile": "GH-820-graceperiod.yml"
}
]
wait-list:
runs-on: ubuntu-24.04
if: ${{ github.actor != 'dependabot[bot]' && github.actor != 'renovate[bot]' }}
Expand Down Expand Up @@ -158,5 +175,8 @@ jobs:
{
"workflowFile": "merge-bot-pr.yml",
"jobName": "dependabot"
},
{
"workflowFile": "GH-820-graceperiod.yml"
}
]
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ yarn-debug.log*
yarn-error.log*
lerna-debug.log*

tmp

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

Expand Down
5 changes: 5 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,10 @@
}
}
},
"search.exclude": {
"dist/**": true,
"node_modules/**": true,
".direnv/**": true
},
"deno.enable": false
}
8 changes: 4 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
This file only records notable changes. Not synchronized with all releases and tags.

- main - not yet released
- Nothing
- Add `startupGracePeriod` option in wait-list: [#820](https://github.com/kachick/wait-other-jobs/issues/820)
- v3.2.0
- Add option to specify the event in `wait-list`: [#771](https://github.com/kachick/wait-other-jobs/issues/771)
- Add `eventName` option in wait-list: [#771](https://github.com/kachick/wait-other-jobs/issues/771)
- v3.1.0
- Add option to disable validations for `wait-list` and missing checkRun: [#762](https://github.com/kachick/wait-other-jobs/pull/762)
- Add `optional` option in wait-list: [#762](https://github.com/kachick/wait-other-jobs/pull/762)
- Refine inputs validations and the messages: [#766](https://github.com/kachick/wait-other-jobs/pull/766)
- v3.0.0
- Wait other jobs which defined in same workflow by default: [#754](https://github.com/kachick/wait-other-jobs/issues/754)\
You can change this behavior with new option `skip-same-workflow: 'true'`
- Validate if the checkRun for the `wait-list` specified name is not found: [#760](https://github.com/kachick/wait-other-jobs/issues/760)
- Validate if the checkRun for the wait-list specified name is not found: [#760](https://github.com/kachick/wait-other-jobs/issues/760)
- v2.0.2
- Allow some neutral patterns: [93299c](https://github.com/kachick/wait-other-jobs/commit/93299c2fa22fd463db31668eba54b34b58270696)
- v2.0.0
Expand Down
37 changes: 32 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ with:
# - If no jobName is specified, all the jobs in the workflow will be targeted.
# - wait-list:
# - If the checkRun for the specified name is not found, this action raise errors by default.
# You can disable this validation with `"optional": true`.
# You can disable this validation with `"optional": true` or use the `startupGracePeriod` that described in following section
# - Wait for all event types by default, you can change with `"eventName": "EVENT_NAME_AS_push"`.
wait-list: |
[
Expand Down Expand Up @@ -117,11 +117,38 @@ See the [docs](docs/examples.md) for further detail.
```
Similar problems should be considered in matrix jobs. See [#761](https://github.com/kachick/wait-other-jobs/issues/761) for further detail

## Limitations
## Startup grace period - Since v3.3.0

Judge whether the checkRun state at the moment.\
When some jobs are triggered late after this action, we need to use the following configurations.

An example of using a `wait-list`.

```yaml
with:
wait-list: |
[
{
"workflowFile": "might_be_triggered_after_0-4_minutes.yml",
"optional": false,
"startupGracePeriod": { "minutes": 5 }
}
]
```

- Judge OK or Bad with the checkRun state at the moment.\
When some jobs will be triggered after this action with `needs: [distant-first]`, it might be unaccurate.\
(I didn't see actual example yet)
This action starts immediately but ignores the job missing in the first 5 minutes.

- No need to extend `wait-seconds-before-first-polling`
- Disable `optional`, because it is needed to check
- Set enough value for `startupGracePeriod` for this purpose.\
It should be parsible with [Temporal.Duration.from()](https://github.com/tc39/proposal-temporal)\
e.g
- `"PT1M"` # ISO8601 duration format
- `{ "minutes": 3, "seconds": 20 }` # key-value for each unit

If not using wait-list, this pattern should be considered in your `wait-seconds-before-first-polling`.

## Limitations

- If any workflow starts many jobs as 100+, this action does not support it.\
Because of nested paging in GraphQL makes complex. See [related docs](https://github.com/octokit/plugin-paginate-graphql.js/blob/a6b12e867466b0c583b002acd1cb1ed90b11841f/README.md#L184-L218) for further detail.
Expand Down
Loading
Loading