Skip to content

Commit

Permalink
Create a balena/main branch for customizations
Browse files Browse the repository at this point in the history
Signed-off-by: Kyle Harding <[email protected]>
  • Loading branch information
klutchell committed Dec 19, 2024
1 parent acddf25 commit b11453e
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 0 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/sync-fork.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Sync fork with upstream

on:
schedule:
# Run every 8 hours at 42 minutes
- cron: '42 */8 * * *'
# Allow manual triggers
workflow_dispatch:

jobs:
sync-fork:
runs-on: ubuntu-latest
name: Sync fork

steps:
# https://github.com/actions/checkout
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with:
persist-credentials: false
token: ${{ secrets.SYNC_FORK_TOKEN }}

# https://github.com/repo-sync/github-sync
- name: GitHub Sync
uses: repo-sync/github-sync@3832fe8e2be32372e1b3970bbae8e7079edeec88 # v2.3.0
with:
source_repo: https://github.com/github/safe-settings.git
source_branch: "*" # Sync all branches
destination_branch: "*" # Sync all branches
github_token: ${{ secrets.SYNC_FORK_TOKEN }}
sync_tags: "true"
27 changes: 27 additions & 0 deletions BALENA.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Maintaining a fork of safe-settings for balena

## Goals

Maintain a fork of safe-settings that allows both ease of testing, and streamlined contributions upstream.

The fork branches and tags should always mirror upstream for ease of development.

The fork should hide its customizations so we do not need to constantly rebase, or accidentally contribute these customizations upstream.

The fork should be able to generate tagged images from development branches, and include the upstream version + feature branch identifier.

## Sync fork with upstream

We retain a `balena/main` branch with customizations as the default branch of the fork.

A scheduled workflow in this branch includes a sync fork job to force sync all upstream branches and tags with origin. Branches that exist in the fork but do not exist upstream are ignored. Local changes to branches that exist upstream are removed!

See: <https://github.com/repo-sync/github-sync>

To ensure `balena/main` is up-to-date with upstream + customizations we should occasionally merge the changes from upstream `enterprise-main` into `balena/main`. DO NOT DELETE THE LOCAL COMMITS. This should be a merge commit and this branch does not need to retain linear history. This can be done from the UI via `Sync fork -> Update branch`.

## Contributing

1. Create a `balena/feature-x` or `balena/fix-x` branch or similar based on `main-enterprise` for testing changes. Do not open a pull request at this time, just work on the branch.
2. When ready, use the existing workflow dispatch jobs to create an image. This build should include the latest versioning tags from upstream automatically if tags were synced.
3. Once changes are tested, a PR can be opened against the upstream `main-enterprise` branch. Do not open a PR where the base is the fork, it serves no purpose and will not be merged.

0 comments on commit b11453e

Please sign in to comment.