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 action 'RecordActionSuccess' fails on 'main' branch #75

Open
ttarczynski opened this issue Jul 15, 2021 · 2 comments
Open

CI action 'RecordActionSuccess' fails on 'main' branch #75

ttarczynski opened this issue Jul 15, 2021 · 2 comments
Labels
CI CI related topics - actions, tooling, scripts, etc.

Comments

@ttarczynski
Copy link
Contributor

See the last CI run: https://github.com/ContainerSolutions/terraform-examples/runs/3074918753?check_suite_focus=true
It's because the main branch is protected now:

To https://github.com/ContainerSolutions/terraform-examples
 ! [remote rejected] main -> main (protected branch hook declined)
error: failed to push some refs to 'https://github.com/ContainerSolutions/terraform-examples'
Error: Invalid status code: 1
    at ChildProcess.<anonymous> (/home/runner/work/_actions/stefanzweifel/git-auto-commit-action/v4/index.js:17:19)
    at ChildProcess.emit (events.js:210:5)
    at maybeClose (internal/child_process.js:1021:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5) {
  code: 1
}
Error: Invalid status code: 1
    at ChildProcess.<anonymous> (/home/runner/work/_actions/stefanzweifel/git-auto-commit-action/v4/index.js:17:19)
    at ChildProcess.emit (events.js:210:5)
    at maybeClose (internal/child_process.js:1021:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
@ttarczynski
Copy link
Contributor Author

There's a discussion about this problem: isaacs/github#1390
It seams that we need to disable the "include administrators" option to allow the Bot to push to main.
Plus make the Bot user an admin.

See the failing action definition:

- name: Commit the updated log
uses: stefanzweifel/git-auto-commit-action@v4
if: steps.isrealcommit.outputs.OUTPUT == '0' && (github.ref == 'refs/heads/main' || env.GITHUB_REF_SLUG == 'integration') # Only run on main or integration, as only these branches run full tests is the reference branch, and don't run if the last commit was a test (isrealcommit).
with:
commit_message: Successful test recorded in log
branch: ${{ github.head_ref }}
commit_options: '--no-verify --signoff'
repository: .
commit_user_name: Terraform Examples Bot
commit_user_email: [email protected]
commit_author: Terraform Examples Bot <[email protected]>

And here are some tips from the git-auto-commit action authors:

@ttarczynski
Copy link
Contributor Author

ttarczynski commented Jul 15, 2021

One more idea: maybe it would be better to change the process here.

The reason of the Bot commits is that we want to record the last successful full CI test run in .test_log.log and then test only the files that have changed.

But instead of that we can use git tags. The process would be simpler and without Bot pushing to main:

  • add two special tags:
    • last_successful_tests_on_main
    • last_successful_tests_on_integration
  • each new commit on main / integration should be compared to the last successful on that branch
  • each successful tests run will move the tag

@ianmiell @sanyer what's your opinion? Should we implement this with git tags?

@melihc1 melihc1 added the CI CI related topics - actions, tooling, scripts, etc. label Aug 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI CI related topics - actions, tooling, scripts, etc.
Projects
None yet
Development

No branches or pull requests

2 participants