Skip to content

Latest commit

 

History

History
90 lines (60 loc) · 3.73 KB

enable-branch-rules.md

File metadata and controls

90 lines (60 loc) · 3.73 KB

Enable Required Branch Rules

Contents


Assumptions

The KBase Actions (workflows) are built under the assumption that:

  • All work is performed in feature branches (with names matching JIRA or GitHub issue numbers)
  • Feature branches are merged via pull requests to the develop branch
  • Pre-release code is merged to main/master via a pull request
  • Semantic relesases are created with the GitHub Release process
  • The branch rules below are enabled on the repo to prevent build failures

Preliminary Steps

  1. Confirm that pr_build.yml and release-main.yml exist in the .github/workflows/ directories of all active branches.
  2. See New Repository and Existing Repository for instructions on how to enable these workflows.

Enable Branch Rules

To prevent failed build checks, two branch rules must be enabled on the new repo.

The following steps will allow a repo owner/admin to set up the needed protection rules:

⚠️ These steps can only be performed by a repository owner or admin.

Develop Branch Rules

  1. Navigate to the Settings tab in the repository.
  2. Click the Branches option on the left link under Code and automation.
  3. Verify that the default branch is set to develop.
  4. Under Branch protection rules, click Add rule.
  5. Under Branch name pattern, enter develop.
  6. Check the following boxes under Protect matching branches:
    • Require a pull request before merging
    • Require approvals (1 approver is fine)
    • Require status checks to pass before merging
    • Require branches to be up to date before merging
  7. Click Create.

Main / Master Branch Rules

  1. Repeat steps 1-6 above, setting the Branch name pattern to main.
  2. In addition, check the Include administrators checkbox.
    • This can be safely disabled by an admin during troublehooting, but should remain enabled during normal use.
  3. Click create.

Require status checks

Once a successful Pull Request has been created, and the pr_build.yml workflow has completed, require the following specific status checks:

  • On develop branch rule: build-develop-open / build-image
  • On main branch rule: build-main-open / build-push-image

RequiredStatusChcecks

Branch Rules Demo
Expand For Demo

BranchRulesDemo


Next Steps

Before using these branch rules, please:

  1. Review the Development Workflow and Release Workflow
  2. File a request with the DevOps team (via Jira or Slack) to make any resulting images public.

|| Previous: Existing Repository || Home || Next: Development Workflow ||