Contents
- Prerequisites
- Summary
- Process Details
The KBase Development workflow requires the following:
- Three branches must exist, named:
main
ormaster
develop
inbox
- The
pr_build.yml
andprod_release.yml
workflows described in the New Repository and Existing Repository sections must be present in the repo. - The branch rules discussed in Enable Branch Rules must be enabled.
- All work is performed in feature branches or personal forks
- Branches should matching any JIRA or GitHub issue numbers
- Feature branches are merged via pull requests to the
develop
branch- A test image named
{REPONAME}-develop
is automatically created with a tag that matches the pull request number (e.g.{REPONAME}-develop:pr-42
)
- A test image named
- Once a pull request is merged to
develop
, the image created above is automatically tagged aslatest
- Images must initially be made public by an administrator
- Once the code in the
develop
branch is ready for release, the Release Workflow is used to create the production image
Before proceeding, please confirm that all prerequisites above are met.
To start development, first create a feature branch off of develop
, either in the KBase repo, or in a personal fork.
Expand For Instructions
If you have write access to a repo in the github.com/kbase organization, you can create a feature branch directly in the repo. Simply:
- Ensure you're currently viewing the
develop
branch. - Create a feature branch from
develop
(not main!), giving it the same name as the relevant Jira or GitHub issue (e.g.PTV-510
).
Expand For Instructions
If you don't have write access to a repo in the github.com/kbase organization, or if you prefer working in a personal fork, do the following:
- Create or update a personal fork of the KBase repo in question.
- Ensure the
develop
branch is up to date with the original KBase repo. - Create a feature branch from
develop
(not main!), giving it the same name as the relevant Jira or GitHub issue (e.g.PTV-510
).
Perform any development work in the feature branch created above. Commit early and commit often!
When any changes in the feature branch are ready for testing and merging to the develop
branch, create a pull request using one of the following techniques:
Expand For Instructions
If you're using a feature branch in the original github.com/kbase repo, simply:
- Create a pull request from your feature branch, to the
develop
branch. - Review the newly created pull request, and update your feature branch if requested.
Expand For Instructions
If you're using a personal fork:
- Create a pull request from the feature branch in your fork to the
inbox
branch in the original github.com/kbase repo. - Review the newly created pull request, and update your feature branch if requested.
- Request that a developer with write access to the original repo review the pull request to
inbox
. - Once merged to
inbox
, request that a developer with write access to the original repo create a pull request frominbox
todevelop
.
ℹ️ Why We Use inbox With Forks |
---|
Due to a security feature in GitHub Actions, pull requests from a fork can't make use of automated build scripts in the original repository. Pull requests from forks must be merged to inbox first, to ensure no malicious code has been added to the workflow code. Once merged to inbox , the build scripts will work normally via a pull request from inbox to develop . |
When a pull request to develop
is created or updated, the pr_build.yml
workflow will automatically start building a test image. To utilize this image for testing in non-prod environments:
Expand For Instructions
- Allow the
pull_request
job in theBueild & Tage Image on PR
workflow to complete.- The status of of the build will be visible in the
Checks
section of the pull request - The status can also be viewed from the
Actions
tab.
- The status of of the build will be visible in the
- Once the build completes successfully, click the
Code
tab in the repo. - Navigate to the
Packages
section on the right of the screen, and click{REPONAME}-develop
. - In the packages view, confirm that an image matching the pull request number exists (e.g.
{REPONAME}-develop:pr-42
). - Test this image, and optionally deploy to a non-production environment.
If the {REPONAME}-develop image doesn't appear under the Code tab under Packages , ask a KBase administrator to make the image public & link the package to the repo. |
Expand For Demo
Demonstrates:
- The automatic build process
- How to view builds in the pull request
- How to view builds in the Actions tab
- Location of the
{REPONAME}-develop
images - How image tags match their respective pull request numbers
Once all builds pass, and the images have been tested in a non-production enviroment, request a pull request review from another developer with access to the repo in question.
After approving and merging the pull request, please delete the source branch (unless the source branch is inbox
, due to the forking workflow)
After the pull request is merged, the Build & Tag Image on PR
workflow will trigger the tag_on_merge
job, which automatically tags the image created above as latest
. This image is now ready to be deployed to CI
or other non-production environments.
🎬 Coming Soon - Continuous Delivery |
---|
Once all non-production environments are migrated to Rancher 2, developers will have the option to automatically deploy the latest image to a development cluster when a pull request is merged! |
|| Previous: Enable Branch Rules || Home || Next: Release Workflow ||