kubernetes-sigs / bom

A utility to generate SPDX-compliant Bill of Materials manifests
https://kubernetes-sigs.github.io/bom/
Apache License 2.0
325 stars 48 forks source link

Trigger docs workflow on changes to workflow config file #358

Closed stmcginnis closed 10 months ago

stmcginnis commented 10 months ago

What type of PR is this?

/kind cleanup /kind documentation

What this PR does / why we need it:

The docs GitHub workflow has been failing for some time with a git error. This updates the workflow file so:

Assuming this shows what the previous failures are from, there may be additional updates needed to correct that root cause. A temporary debugging step has been included to help understand what is happening and will be removed as a follow up.

Which issue(s) this PR fixes:

None

Special notes for your reviewer:

Does this PR introduce a user-facing change?

NONE
stmcginnis commented 10 months ago

Capturing the error here since the GHA logs will eventually go away.

The error appears to be coming from the final "Deploy" step. This needs to do the git push into the gh-pages branch.

Switched to a new branch 'github-pages-deploy-action/bsx8cpf08'
/usr/bin/git commit -m Deploying to gh-pages from @ kubernetes-sigs/bom@f0f5c428e48388f2c93787cd5667e07845fbfc9f 🚀 --quiet --no-verify
Force-pushing changes...
/usr/bin/git push --force ***github.com/kubernetes-sigs/bom.git github-pages-deploy-action/bsx8cpf08:gh-pages
remote: Permission to kubernetes-sigs/bom.git denied to github-actions[bot].
fatal: unable to access 'https://github.com/kubernetes-sigs/bom.git/': The requested URL returned error: 403
Running post deployment cleanup jobs… 🗑️
/usr/bin/git checkout -B github-pages-deploy-action/bsx8cpf08
Reset branch 'github-pages-deploy-action/bsx8cpf08'
/usr/bin/chmod -R +rw github-pages-deploy-action-temp-deployment-folder
/usr/bin/git worktree remove github-pages-deploy-action-temp-deployment-folder --force
Error: The deploy step encountered an error: The process '/usr/bin/git' failed with exit code 128 ❌
Notice: Deployment failed! ❌

It would appear the default GITHUB_TOKEN we have doesn't have the right permissions to do this push.

cpanato commented 10 months ago

Capturing the error here since the GHA logs will eventually go away.

The error appears to be coming from the final "Deploy" step. This needs to do the git push into the gh-pages branch.

Switched to a new branch 'github-pages-deploy-action/bsx8cpf08'
/usr/bin/git commit -m Deploying to gh-pages from @ kubernetes-sigs/bom@f0f5c428e48388f2c93787cd5667e07845fbfc9f 🚀 --quiet --no-verify
Force-pushing changes...
/usr/bin/git push --force ***github.com/kubernetes-sigs/bom.git github-pages-deploy-action/bsx8cpf08:gh-pages
remote: Permission to kubernetes-sigs/bom.git denied to github-actions[bot].
fatal: unable to access 'https://github.com/kubernetes-sigs/bom.git/': The requested URL returned error: 403
Running post deployment cleanup jobs… 🗑️
/usr/bin/git checkout -B github-pages-deploy-action/bsx8cpf08
Reset branch 'github-pages-deploy-action/bsx8cpf08'
/usr/bin/chmod -R +rw github-pages-deploy-action-temp-deployment-folder
/usr/bin/git worktree remove github-pages-deploy-action-temp-deployment-folder --force
Error: The deploy step encountered an error: The process '/usr/bin/git' failed with exit code 128 ❌
Notice: Deployment failed! ❌

It would appear the default GITHUB_TOKEN we have doesn't have the right permissions to do this push.

this is correct, in a pull request, the token does not have the permission required

cpanato commented 10 months ago

/hold

stmcginnis commented 10 months ago

this is correct, in a pull request, the token does not have the permission required

It appears it's the case on the push to main as well, but I guess we would need to actually merge something to get an updated log to see if this failure really is the same failure that previous jobs have run in to.

I will drop the temporary commits so we can merge just the path update. That would be a safe change so we could get the logs we need.

cpanato commented 10 months ago

sgtm

k8s-ci-robot commented 10 months ago

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: cpanato, stmcginnis

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files: - ~~[OWNERS](https://github.com/kubernetes-sigs/bom/blob/main/OWNERS)~~ [cpanato] Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment
cpanato commented 10 months ago

/unhold

cpanato commented 10 months ago

ok, it is working, the issue was the branch was protected and not accepting push from the github action bot, fixed this for now

stmcginnis commented 10 months ago

Great, it looks like whatever was causing the git failure in the past is no longer an issue. This push was actually successful:

Force-pushing changes...
/usr/bin/git push --force ***github.com/kubernetes-sigs/bom.git github-pages-deploy-action/tfavva3ms:gh-pages
To https://github.com/kubernetes-sigs/bom.git
   2bb27c1..a59d639  github-pages-deploy-action/tfavva3ms -> gh-pages
Changes committed to the gh-pages branch… 📦
Running post deployment cleanup jobs… 🗑️
/usr/bin/git checkout -B github-pages-deploy-action/tfavva3ms
Reset branch 'github-pages-deploy-action/tfavva3ms'
/usr/bin/chmod -R +rw github-pages-deploy-action-temp-deployment-folder
/usr/bin/git worktree remove github-pages-deploy-action-temp-deployment-folder --force
Completed deployment successfully! ✅

There have been various GitHub action updates since the last failure, so it's possible one of those corrected whatever the problem was. At least now with the workflow file being included in the triggers, any future updates to any of the actions used should alert to a problem, even if there are no actual doc changes included.

More recent changes are now reflected in the docs site! 🎉

Thanks for the help!