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

ci(check-ci-skip): fix commitMessagesMetadata.forEach is not a function #3614

Open
petermetz opened this issue Nov 4, 2024 · 3 comments · May be fixed by #3618
Open

ci(check-ci-skip): fix commitMessagesMetadata.forEach is not a function #3614

petermetz opened this issue Nov 4, 2024 · 3 comments · May be fixed by #3618
Assignees
Labels
bug Something isn't working P1 Priority 1: Highest Tests Anything related to tests be that automatic or manual, integration or unit, etc.
Milestone

Comments

@petermetz
Copy link
Contributor

petermetz commented Nov 4, 2024

The new CI skip check job destroyed the CI completely. It crashes by default and then skips all the tests by default which allows merging pull requests without ANY test coverage.

@jagpreetsinghsasan Let's prioritize this as an urgent one please. The easiest and quickest fix I see for now is to just roll back the pull request entirely and put the task back in the backlog for the team.

https://github.com/hyperledger-cacti/cacti/actions/runs/11657574657/job/32455341799?pr=3604

2024-11-04T03:29:45.6943136Z Current runner version: '2.320.0'
2024-11-04T03:29:45.6965919Z ##[group]Operating System
2024-11-04T03:29:45.6966551Z Ubuntu
2024-11-04T03:29:45.6966897Z 22.04.5
2024-11-04T03:29:45.6967302Z LTS
2024-11-04T03:29:45.6967647Z ##[endgroup]
2024-11-04T03:29:45.6968029Z ##[group]Runner Image
2024-11-04T03:29:45.6968505Z Image: ubuntu-22.04
2024-11-04T03:29:45.6968925Z Version: 20241015.1.0
2024-11-04T03:29:45.6969931Z Included Software: https://github.com/actions/runner-images/blob/ubuntu22/20241015.1/images/ubuntu/Ubuntu2204-Readme.md
2024-11-04T03:29:45.6971404Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu22%2F20241015.1
2024-11-04T03:29:45.6972225Z ##[endgroup]
2024-11-04T03:29:45.6972639Z ##[group]Runner Image Provisioner
2024-11-04T03:29:45.6973527Z 2.0.384.1
2024-11-04T03:29:45.6973881Z ##[endgroup]
2024-11-04T03:29:45.6989397Z ##[group]GITHUB_TOKEN Permissions
2024-11-04T03:29:45.6991039Z Actions: read
2024-11-04T03:29:45.6991803Z Attestations: read
2024-11-04T03:29:45.6992267Z Checks: read
2024-11-04T03:29:45.6992699Z Contents: read
2024-11-04T03:29:45.6993105Z Deployments: read
2024-11-04T03:29:45.6993470Z Discussions: read
2024-11-04T03:29:45.6993925Z Issues: read
2024-11-04T03:29:45.6994295Z Metadata: read
2024-11-04T03:29:45.6994626Z Packages: read
2024-11-04T03:29:45.6995065Z Pages: read
2024-11-04T03:29:45.6995425Z PullRequests: read
2024-11-04T03:29:45.6995808Z RepositoryProjects: read
2024-11-04T03:29:45.6996325Z SecurityEvents: read
2024-11-04T03:29:45.6996730Z Statuses: read
2024-11-04T03:29:45.6997069Z ##[endgroup]
2024-11-04T03:29:45.6999981Z Secret source: None
2024-11-04T03:29:45.7000550Z Prepare workflow directory
2024-11-04T03:29:45.7714220Z Prepare all required actions
2024-11-04T03:29:45.7868430Z Getting action download info
2024-11-04T03:29:45.9795413Z Download action repository 'actions/[email protected]' (SHA:692973e3d937129bcbf40652eb9f2f61becf3332)
2024-11-04T03:29:46.1596959Z Complete job name: check-ci-skip
2024-11-04T03:29:46.2498800Z ##[group]Run actions/[email protected]
2024-11-04T03:29:46.2499497Z with:
2024-11-04T03:29:46.2499914Z   repository: hyperledger-cacti/cacti
2024-11-04T03:29:46.2500663Z   token: ***
2024-11-04T03:29:46.2501105Z   ssh-strict: true
2024-11-04T03:29:46.2501501Z   ssh-user: git
2024-11-04T03:29:46.2501923Z   persist-credentials: true
2024-11-04T03:29:46.2502424Z   clean: true
2024-11-04T03:29:46.2502842Z   sparse-checkout-cone-mode: true
2024-11-04T03:29:46.2503369Z   fetch-depth: 1
2024-11-04T03:29:46.2503781Z   fetch-tags: false
2024-11-04T03:29:46.2504190Z   show-progress: true
2024-11-04T03:29:46.2504608Z   lfs: false
2024-11-04T03:29:46.2504994Z   submodules: false
2024-11-04T03:29:46.2505416Z   set-safe-directory: true
2024-11-04T03:29:46.2505863Z env:
2024-11-04T03:29:46.2506240Z   NODEJS_VERSION: v18.18.2
2024-11-04T03:29:46.2506694Z   RUN_TRIVY_SCAN: true
2024-11-04T03:29:46.2507119Z   RUN_CODE_COVERAGE: true
2024-11-04T03:29:46.2507580Z ##[endgroup]
2024-11-04T03:29:46.4468985Z Syncing repository: hyperledger-cacti/cacti
2024-11-04T03:29:46.4470979Z ##[group]Getting Git version info
2024-11-04T03:29:46.4472152Z Working directory is '/home/runner/work/cacti/cacti'
2024-11-04T03:29:46.4473560Z [command]/usr/bin/git version
2024-11-04T03:29:46.4474314Z git version 2.47.0
2024-11-04T03:29:46.4476987Z ##[endgroup]
2024-11-04T03:29:46.4489957Z Temporarily overriding HOME='/home/runner/work/_temp/8467916e-4872-4059-9a26-c69964f65622' before making global git config changes
2024-11-04T03:29:46.4491773Z Adding repository directory to the temporary git global config as a safe directory
2024-11-04T03:29:46.4494527Z [command]/usr/bin/git config --global --add safe.directory /home/runner/work/cacti/cacti
2024-11-04T03:29:46.4529274Z Deleting the contents of '/home/runner/work/cacti/cacti'
2024-11-04T03:29:46.4532833Z ##[group]Initializing the repository
2024-11-04T03:29:46.4536682Z [command]/usr/bin/git init /home/runner/work/cacti/cacti
2024-11-04T03:29:46.4595445Z hint: Using 'master' as the name for the initial branch. This default branch name
2024-11-04T03:29:46.4597590Z hint: is subject to change. To configure the initial branch name to use in all
2024-11-04T03:29:46.4598852Z hint: of your new repositories, which will suppress this warning, call:
2024-11-04T03:29:46.4600042Z hint:
2024-11-04T03:29:46.4600768Z hint: 	git config --global init.defaultBranch <name>
2024-11-04T03:29:46.4601846Z hint:
2024-11-04T03:29:46.4603001Z hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and
2024-11-04T03:29:46.4605135Z hint: 'development'. The just-created branch can be renamed via this command:
2024-11-04T03:29:46.4606519Z hint:
2024-11-04T03:29:46.4607282Z hint: 	git branch -m <name>
2024-11-04T03:29:46.4608720Z Initialized empty Git repository in /home/runner/work/cacti/cacti/.git/
2024-11-04T03:29:46.4614066Z [command]/usr/bin/git remote add origin https://github.com/hyperledger-cacti/cacti
2024-11-04T03:29:46.4646797Z ##[endgroup]
2024-11-04T03:29:46.4647704Z ##[group]Disabling automatic garbage collection
2024-11-04T03:29:46.4650479Z [command]/usr/bin/git config --local gc.auto 0
2024-11-04T03:29:46.4680201Z ##[endgroup]
2024-11-04T03:29:46.4680967Z ##[group]Setting up auth
2024-11-04T03:29:46.4686876Z [command]/usr/bin/git config --local --name-only --get-regexp core\.sshCommand
2024-11-04T03:29:46.4718893Z [command]/usr/bin/git submodule foreach --recursive sh -c "git config --local --name-only --get-regexp 'core\.sshCommand' && git config --local --unset-all 'core.sshCommand' || :"
2024-11-04T03:29:46.5003717Z [command]/usr/bin/git config --local --name-only --get-regexp http\.https\:\/\/github\.com\/\.extraheader
2024-11-04T03:29:46.5033382Z [command]/usr/bin/git submodule foreach --recursive sh -c "git config --local --name-only --get-regexp 'http\.https\:\/\/github\.com\/\.extraheader' && git config --local --unset-all 'http.https://github.com/.extraheader' || :"
2024-11-04T03:29:46.5266612Z [command]/usr/bin/git config --local http.https://github.com/.extraheader AUTHORIZATION: basic ***
2024-11-04T03:29:46.5302335Z ##[endgroup]
2024-11-04T03:29:46.5303350Z ##[group]Fetching the repository
2024-11-04T03:29:46.5310971Z [command]/usr/bin/git -c protocol.version=2 fetch --no-tags --prune --no-recurse-submodules --depth=1 origin +c0243efdb3c5a3fbe3c65d60d766f6ffca300c5f:refs/remotes/pull/3604/merge
2024-11-04T03:29:47.8832873Z From https://github.com/hyperledger-cacti/cacti
2024-11-04T03:29:47.8834413Z  * [new ref]         c0243efdb3c5a3fbe3c65d60d766f6ffca300c5f -> pull/3604/merge
2024-11-04T03:29:47.8859775Z ##[endgroup]
2024-11-04T03:29:47.8860914Z ##[group]Determining the checkout info
2024-11-04T03:29:47.8862236Z ##[endgroup]
2024-11-04T03:29:47.8867899Z [command]/usr/bin/git sparse-checkout disable
2024-11-04T03:29:47.8909134Z [command]/usr/bin/git config --local --unset-all extensions.worktreeConfig
2024-11-04T03:29:47.8941476Z ##[group]Checking out the ref
2024-11-04T03:29:47.8946109Z [command]/usr/bin/git checkout --progress --force refs/remotes/pull/3604/merge
2024-11-04T03:29:48.5020888Z Note: switching to 'refs/remotes/pull/3604/merge'.
2024-11-04T03:29:48.5021651Z 
2024-11-04T03:29:48.5022286Z You are in 'detached HEAD' state. You can look around, make experimental
2024-11-04T03:29:48.5023718Z changes and commit them, and you can discard any commits you make in this
2024-11-04T03:29:48.5024879Z state without impacting any branches by switching back to a branch.
2024-11-04T03:29:48.5025598Z 
2024-11-04T03:29:48.5026079Z If you want to create a new branch to retain commits you create, you may
2024-11-04T03:29:48.5027404Z do so (now or later) by using -c with the switch command. Example:
2024-11-04T03:29:48.5028049Z 
2024-11-04T03:29:48.5028357Z   git switch -c <new-branch-name>
2024-11-04T03:29:48.5028804Z 
2024-11-04T03:29:48.5029017Z Or undo this operation with:
2024-11-04T03:29:48.5029494Z 
2024-11-04T03:29:48.5029744Z   git switch -
2024-11-04T03:29:48.5030018Z 
2024-11-04T03:29:48.5030813Z Turn off this advice by setting config variable advice.detachedHead to false
2024-11-04T03:29:48.5031619Z 
2024-11-04T03:29:48.5032406Z HEAD is now at c0243ef Merge 554d1df2debe845fd260432a61cdfda11844f8d9 into 35f31fa0163c50982484857051e438e49ecb207f
2024-11-04T03:29:48.5058124Z ##[endgroup]
2024-11-04T03:29:48.5101429Z [command]/usr/bin/git log -1 --format='%H'
2024-11-04T03:29:48.5126190Z 'c0243efdb3c5a3fbe3c65d60d766f6ffca300c5f'
2024-11-04T03:29:48.5465495Z ##[group]Run node tools/ci-skip-for-maintainers.js https://api.github.com/repos/hyperledger-cacti/cacti/pulls/3604 Udhayakumari
2024-11-04T03:29:48.5466876Z �[36;1mnode tools/ci-skip-for-maintainers.js https://api.github.com/repos/hyperledger-cacti/cacti/pulls/3604 Udhayakumari�[0m
2024-11-04T03:29:48.5549215Z shell: /usr/bin/bash -e {0}
2024-11-04T03:29:48.5549728Z env:
2024-11-04T03:29:48.5550078Z   NODEJS_VERSION: v18.18.2
2024-11-04T03:29:48.5550436Z   RUN_TRIVY_SCAN: true
2024-11-04T03:29:48.5550861Z   RUN_CODE_COVERAGE: true
2024-11-04T03:29:48.5551270Z ##[endgroup]
2024-11-04T03:29:48.7905019Z file:///home/runner/work/cacti/cacti/tools/ci-skip-for-maintainers.js:36
2024-11-04T03:29:48.7906463Z   commitMessagesMetadata.forEach((commitMessageMetadata) => {
2024-11-04T03:29:48.7907432Z                          ^
2024-11-04T03:29:48.7907814Z 
2024-11-04T03:29:48.7908250Z TypeError: commitMessagesMetadata.forEach is not a function
2024-11-04T03:29:48.7909822Z     at main (file:///home/runner/work/cacti/cacti/tools/ci-skip-for-maintainers.js:36:26)
2024-11-04T03:29:48.7910677Z     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
2024-11-04T03:29:48.7911172Z 
2024-11-04T03:29:48.7911386Z Node.js v18.20.4
2024-11-04T03:29:48.8485838Z ##[error]Process completed with exit code 1.
2024-11-04T03:29:48.8591493Z Post job cleanup.
2024-11-04T03:29:48.9503916Z [command]/usr/bin/git version
2024-11-04T03:29:48.9539114Z git version 2.47.0
2024-11-04T03:29:48.9586020Z Temporarily overriding HOME='/home/runner/work/_temp/5acadf7c-07c3-4430-aef2-9bae6899c8d3' before making global git config changes
2024-11-04T03:29:48.9587291Z Adding repository directory to the temporary git global config as a safe directory
2024-11-04T03:29:48.9591110Z [command]/usr/bin/git config --global --add safe.directory /home/runner/work/cacti/cacti
2024-11-04T03:29:48.9623750Z [command]/usr/bin/git config --local --name-only --get-regexp core\.sshCommand
2024-11-04T03:29:48.9654366Z [command]/usr/bin/git submodule foreach --recursive sh -c "git config --local --name-only --get-regexp 'core\.sshCommand' && git config --local --unset-all 'core.sshCommand' || :"
2024-11-04T03:29:48.9900226Z [command]/usr/bin/git config --local --name-only --get-regexp http\.https\:\/\/github\.com\/\.extraheader
2024-11-04T03:29:48.9920138Z http.https://github.com/.extraheader
2024-11-04T03:29:48.9931765Z [command]/usr/bin/git config --local --unset-all http.https://github.com/.extraheader
2024-11-04T03:29:48.9963670Z [command]/usr/bin/git submodule foreach --recursive sh -c "git config --local --name-only --get-regexp 'http\.https\:\/\/github\.com\/\.extraheader' && git config --local --unset-all 'http.https://github.com/.extraheader' || :"
2024-11-04T03:29:49.0415599Z Cleaning up orphan processes
@petermetz petermetz added bug Something isn't working Tests Anything related to tests be that automatic or manual, integration or unit, etc. labels Nov 4, 2024
@petermetz petermetz added this to the v2.1.0 milestone Nov 4, 2024
@petermetz petermetz added the P4 Priority 4: Low label Nov 4, 2024
@petermetz petermetz modified the milestones: v2.1.0, vT.B.D Nov 4, 2024
@petermetz petermetz added P1 Priority 1: Highest and removed P4 Priority 4: Low labels Nov 4, 2024
@jagpreetsinghsasan
Copy link
Contributor

@petermetz just from looking at the title, I think it failed due to the github api being rate limited and thus the variable commitMessagesMetadata seems to be null (thus forEach not being defined for it). But I will have a deeper look and we will fix it asap. (In no way, the skip shall happen)
CC @zondervancalvez

@jagpreetsinghsasan
Copy link
Contributor

jagpreetsinghsasan commented Nov 4, 2024

I ran it again @petermetz and it seems to work fine now. Most likely either a rate limit issue or github api endpoint intermittent issue (But yes, we will update the code so that it doesn't skip anyway)
https://github.com/hyperledger-cacti/cacti/actions/runs/11657574657/job/32455943052?pr=3604

zondervancalvez added a commit to zondervancalvez/cactus that referenced this issue Nov 5, 2024
Primary Changes
----------------
1. Added condition to commitMessagesMetadata
to check if commit message is array or not.

Fixes hyperledger-cacti#3614

Signed-off-by: bado <[email protected]>
zondervancalvez added a commit to zondervancalvez/cactus that referenced this issue Nov 5, 2024
Primary Changes
----------------
1. Added condition to commitMessagesMetadata
to check if commit message is array or not.

Fixes hyperledger-cacti#3614

Signed-off-by: bado <[email protected]>
zondervancalvez added a commit to zondervancalvez/cactus that referenced this issue Nov 5, 2024
Primary Changes
----------------
1. Added condition to commitMessagesMetadata
to check if commit message is array or not.

Fixes hyperledger-cacti#3614

Signed-off-by: bado <[email protected]>
zondervancalvez added a commit to zondervancalvez/cactus that referenced this issue Nov 5, 2024
Primary Changes
----------------
1. Added condition to commitMessagesMetadata
to check if commit message is array or not.

Fixes hyperledger-cacti#3614

Signed-off-by: bado <[email protected]>
zondervancalvez added a commit to zondervancalvez/cactus that referenced this issue Nov 5, 2024
Primary Changes
----------------
1. Added condition to commitMessagesMetadata
to check if commit message is array or not.

Fixes hyperledger-cacti#3614

Signed-off-by: bado <[email protected]>
@petermetz
Copy link
Contributor Author

@jagpreetsinghsasan If it's intermittently failing due to rate limits then we either have to call it quits on this (which is acceptable to me, at least we tried) or refactor it in a way that it does not depend on the GitHub API (see my earlier idea about using the local git installation to determine the commit metadata).

Reasoning/general thoughts: If the check is not stable/reliable due to rate limits, then it's going to block PRs by mistake (false negatives) and people will get confused about what to do or how to fix it and we'll just spend a lot of time explaining it to them and sending messages back and forth even for simple contributions.
As the number of pull requests is increasing with community growth, the problem will get exponentially worse.
If we decide to use the GitHub API for other jobs as well, it will be even worse so the bottleneck of the GitHub API, even if right now is an only an occasional problem, longer term it will be worse.

zondervancalvez added a commit to zondervancalvez/cactus that referenced this issue Nov 8, 2024
Primary Changes
----------------
1. Changed the method in getting the commit
message from GitHub API to shell command to avoid
the rate limits in calling the API.
2. Same goes for the author of commit message,
we use shell command to fetch the username.

Fixes hyperledger-cacti#3614

Signed-off-by: bado <[email protected]>
zondervancalvez added a commit to zondervancalvez/cactus that referenced this issue Nov 8, 2024
Primary Changes
----------------
1. Changed the method in getting the commit
message from GitHub API to shell command to avoid
the rate limits in calling the API.
2. Same goes for the author of commit message,
we use shell command to fetch the username.

Fixes hyperledger-cacti#3614

Signed-off-by: bado <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working P1 Priority 1: Highest Tests Anything related to tests be that automatic or manual, integration or unit, etc.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants