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

Release Version '1.12.1' into 'master' Branch #152

Closed
wants to merge 15 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
132 changes: 132 additions & 0 deletions .github/workflows/auto-prod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
#############################
## Merge Release in Master ##
#############################

# Triggered on tag 'auto-prod' push

# export tt='auto-prod'
# git tag -d "$tt"; git push --delete origin "$tt"; git tag "$tt" && git push origin "$tt"

#### Does the following:
# 1. Triggers 'Release' Stress Tests
# 2. if Tests and Code Review OK
# 3. Merge PR 'release' --> 'Master'
####

on:
push:
tags:
- auto-prod

jobs:
merge_release_in_master:
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RELEASE: 'release'
MAIN_BR: 'master'
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # 0 indicates all history for all branches and tags.
set-safe-directory: '' # `git config --global --add safe.directory <path>`
token: '${{ secrets.GH_TOKEN }}'

- run: git branch --track "${{ env.RELEASE }}" "origin/${{ env.RELEASE }}"

- name: "Check if tag is on '${{ env.RELEASE }}' branch"
uses: rickstaa/action-contains-tag@v1
id: tag_on_release
with:
tag: "${{ github.ref }}"
reference: "${{ env.RELEASE }}" # the branch to check if the tag is on

# REQUIRE Tag to be on Release Branch, else Exit with Error
- if: ${{ steps.tag_on_release.outputs.retval == 'false' }}
name: "Exit if '${{ github.ref }}' NOT on '${{ env.RELEASE }}' branch"
run: echo "Tag '${{ github.ref }}' on '${{ env.RELEASE }}' = ${{ steps.tag_on_release.outputs.retval }}" && exit 1

- run: git checkout "${{ env.RELEASE }}"

# Derive PROD Sem Ver
- run: echo SEMVER=$(grep -E -o '^version\s*=\s*\".*\"' pyproject.toml | cut -d'"' -f2) >> $GITHUB_OUTPUT
id: sem_ver

# Derive RC Sem Ver Tag
- run: 'echo RC_VER="${{ steps.sem_ver.outputs.SEMVER }}-rc" >> $GITHUB_OUTPUT'
id: rc_sem_ver

# Update Source Sem Ver to Release Candidate Sem Ver
- name: Mark Sem Ver in source as '-rc', Release Candidate
shell: bash
run: sh ./scripts/distro-sem-ver-bump.sh "${{ steps.rc_sem_ver.outputs.RC_VER }}"

- run: git status

- name: Set text of commit message (aka subject), to use for RC (-rc) Sem Ver update
id: rc_msg
run: "echo RC_MSG=\"chore(rc): mark source code Sem Ver as '-rc', Release Candidate\" >> $GITHUB_OUTPUT"

# ENABLE GIT COMMITS
- name: Enable Git Commits, by setting git user.name and user.email
run: |
git config --global user.name "Konstantinos Lampridis"
git config --global user.email "[email protected]"

# COMMIT Source Sem Ver
- name: "Commit Source Sem Ver, as Release Candidate"
run: git commit -am "${{ steps.rc_msg.outputs.RC_MSG }}"

## Trigger (gitops) Release Candidate 'Stress Tests' ##
- name: "Trigger Release Candidate - Stress Tests"
env:
rc_tag: 'v${{ steps.rc_sem_ver.outputs.RC_VER }}'
run: |
echo "[STEP]: Tag Commit: ${rc_tag}"
git tag -d "$rc_tag"; git push --delete origin "$rc_tag"; git tag "$rc_tag" && git push origin "$rc_tag"
echo
echo " -> Pushed tag $rc_tag"
echo
echo "## TRIGGERED RELEASE CANDIDATE - TESTS ##"
echo

## Update Source Sem Ver to Prod Release Sem Ver

# COMMIT Revert operation, for Production Sem Ver
- name: "Revert to Production Sem Ver, from Release Candidate, '-rc"
run: |
git revert "$(git rev-parse HEAD)" --no-commit
git commit -m "revert: ${{ steps.rc_msg.outputs.RC_MSG }}\n\nThis reverts commit ${COMMIT_SHA}."

# Push Release Branch
- run: git push

### Open PR ###
- name: "Open PR 'head': ${{ env.RELEASE }} --> 'base': ${{ env.MAIN_BR }}"
run: |
gh pr create --head "${{ env.RELEASE }}" --base "${{ env.MAIN_BR }}" \
--title "Release Version '${{ steps.sem_ver.outputs.SEMVER }}' into '${{ env.MAIN_BR }}' Branch" \
--body "## :rocket: Release '${{ steps.sem_ver.outputs.SEMVER }}' into '${{ env.MAIN_BR }}' Branch :rocket:

This PR marks a pivotal moment in our deployment cycle, signaling that all changes on the **Release** branch are deemed ready for production. It represents the collective decision of our developers that the changes bundled in the Release are suitable to be released together.

### What's Happening in This PR?

- We are merging the '${{ env.RELEASE }}' branch into the '${{ env.MAIN_BR }}' branch.
- This action is a critical step, transitioning us from the release phase to the production phase.

### :white_check_mark: Automatic Merging Upon CI Checks :white_check_mark:

This PR will be automatically merged into the '${{ env.MAIN_BR }}' branch, if the following conditions are met:

- All CI Checks pass
- Code Review is approved by at least one developer

### :warning: Manual Merging Upon CI Checks and Code Review :warning:

If the above conditions are not met, this PR will be manually merged into the '${{ env.MAIN_BR }}' branch, by a developer.
"

### Merge PR, when CI Pass + Human Review OK ###
- name: "Merge PR 'head': ${{ env.RELEASE }} --> 'base': ${{ env.MAIN_BR }}"
run: gh pr merge "${{ env.RELEASE }}" --auto --delete-branch --squash
3 changes: 2 additions & 1 deletion .github/workflows/labeler.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: "Pull Request Labeler"

on:
- pull_request_target
- pull_request_target

jobs:
triage:
Expand Down
143 changes: 143 additions & 0 deletions .github/workflows/load-to-rt.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
###########################
## Onboard Release Train ##
###########################

# PR: HEAD --> release-train

### TRIGGER event ###

# export tt='board-rt'
# OR
# export tt='boarding-n-auto-release'
# for Automatically merging Release Train in Release

# git tag -d "$tt"; git push --delete origin "$tt"; git tag "$tt" && git push origin "$tt"

on:
push:
tags:
# on tag with name 'board-rt' only
- board-rt
- auto-release

jobs:
board_release_train:
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TRAIN: 'release-train'
BOARDING: ${{ github.event.ref == 'refs/tags/auto-release' && 'boarding-n-auto-release' || 'boarding' }}
MAIN_BRANCH: 'master'
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # 0 indicates all history for all branches and tags.
set-safe-directory: '' # `git config --global --add safe.directory <path>`
token: '${{ secrets.GH_TOKEN }}'

- run: git log --graph --decorate --color --all --stat

- name: Discover User's Branch Name
id: user_branch
run: |
name=$(git branch -a --contains "$(git rev-parse HEAD)" | sed -n '2p' | sed 's/.*remotes\///')

echo "NAME:" $name

echo USER_BRANCH=$name >> $GITHUB_OUTPUT

### Put User Branch on Boarding Branch to Test before merging to Release Train

- run: git checkout ${{ env.MAIN_BRANCH }}
- run: git checkout -b ${{ env.BOARDING }}

- run: git config --global user.email "[email protected]"
- run: git config --global user.name "Konstantinos Lampridis"

- name: 'Merge ${{ steps.user_branch.outputs.USER_BRANCH }} --> ${{ env.BOARDING }}'
run: git merge "${{ steps.user_branch.outputs.USER_BRANCH }}" --no-edit --no-ff -m "${MERGE_MSG}"
env:
MERGE_MSG: "Carry User's Code, and do Boarding CI Tests" # triggers Boarding CI Tests
# MERGE_MSG: "Carry User's Code" # skip Boarding CI Tests

# Push Boarding and Trigger CI Tests on the 'CI/CD Pipeline'
- run: git push -u origin HEAD

### Release Train - Setup ###
- run: echo UPSTREAM_TRAIN="$(git ls-remote --heads origin '${{ env.TRAIN }}')" >> $GITHUB_ENV
- id: remote_train
run: |
if [[ -z "${{ env.UPSTREAM_TRAIN }}" ]]; then
echo TRAIN_EXISTS=false >> $GITHUB_OUTPUT
echo "[INFO] TRAIN DOES NOT EXIST"
else
echo TRAIN_EXISTS=true >> $GITHUB_OUTPUT
echo "[INFO] TRAIN EXISTS"
fi

- run: git branch -a

# if Release Train does not exist, create it
- name: If Upstream Release Train branch does not exist, create it
if: ${{ steps.remote_train.outputs.TRAIN_EXISTS != 'true' }}
run: |
git checkout ${{ env.MAIN_BRANCH }}
git checkout -b ${{ env.TRAIN }}
git push -u origin HEAD

# if Release Train exists, pull it
- name: If Upstream Release Train branch exists, pull it
if: ${{ steps.remote_train.outputs.TRAIN_EXISTS == 'true' }}
run: |
git branch --track "${{ env.TRAIN }}" "origin/${{ env.TRAIN }}"
git checkout ${{ env.TRAIN }}

### Release Train - Check ###
- name: "Verify 'release-train' is found in list of local branches"
run: |
git branch --list
git branch --list | grep ${{ env.TRAIN }}
if [[ $? -ne 0 ]]; then
echo "[ERROR] Failed to setup Release Train !"
exit 1
fi

- run: git log --graph --decorate --color --all --stat

############## PR ##############
- name: 'Create PR ${{ env.BOARDING }} --> ${{ env.TRAIN }}'
# --head is the branch where the changes were developed
# --base is the branch you want to merge the changes into
run: |
gh pr create --head "${{ env.BOARDING }}" --base "${{ env.TRAIN }}" \
--title "Boarding '${{ steps.user_branch.outputs.USER_BRANCH }}' on Release Train - Merging into ${{ env.TRAIN }} Branch" \
--body "## :train: Boarding onto the Release Train :train:

This PR is automatically generated by a GitHub Action workflow. It's part of the process of boarding changes onto the **Release Train** branch, setting the stage for the next steps in our GitOps journey.

### What's Happening Here?

- We're merging changes from `${{ steps.user_branch.outputs.USER_BRANCH }}` into the `${{ env.TRAIN }}` branch.
- This is a critical step in our process, moving us closer to launching the Release Train.

### Next Steps: Launching and Opening the Doors

- Once this PR is merged, we're set to **launch the Release Train**.
- After the launch, our next goal is to **open the doors** of the Release Train, making these changes available in our release.

### :white_check_mark: Automatic Merging :white_check_mark:

- This PR is designed to **automatically merge** once all CI checks pass.
- The CI checks include our GitHub Actions workflows and RTD integration.

### :warning: A Note to Maintainers :warning:

- Please **do not close this PR manually**.
- If there are any issues or required manual interventions, reach out to the development team.
"

############## Merge ##############
- name: 'Merge PR ${{ env.BOARDING }} --> ${{ env.TRAIN }}'
run: gh pr merge "${{ env.BOARDING }}" --auto --delete-branch --squash

# HEAD is now at ${{ env.TRAIN }}
86 changes: 86 additions & 0 deletions .github/workflows/merge-rt-in-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
############################
## Merge Train in Release ##
############################

# Triggered when PR from 'auto-release' merges into 'release-train'

# 1. PR: release-train --> release
# 2. Test
# 3. Merge

# Release Train (RT) has All changes needed for Release
# We Test RT, and do auto merge if CI Checks Pass

on:
pull_request:
types: [closed]
# push:
# tags:
# - merge-rt-in-release

jobs:
merge_rt_in_release:
# When 'boarding-n-auto-release --> 'release-train' PR is merged
if: ${{ github.event.pull_request.merged == true &&
github.event.pull_request.head.ref == 'boarding-n-auto-release' && \
github.event.pull_request.base.ref == 'release-train' }}
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TRAIN: 'release-train'
RELEASE_BR: 'release'
MAIN_BR: 'master'
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # 0 indicates all history for all branches and tags.
set-safe-directory: '' # `git config --global --add safe.directory <path>`
token: '${{ secrets.GH_TOKEN }}'

# Track the remote branches
- run: git branch --track "${{ env.TRAIN }}" "origin/${{ env.TRAIN }}"
- run: git branch --track "${{ env.RELEASE_BR }}" "origin/${{ env.RELEASE_BR }}"

############## PR ##############
- name: "Create PR 'head': ${{ env.TRAIN }} --> 'base': ${{ env.RELEASE_BR }}"
run: |
gh pr create --head "${{ env.TRAIN }}" --base "${{ env.RELEASE_BR }}" \
--title "Initiate Release Process - Merging '${{ env.TRAIN }}' in '${{ env.RELEASE_BR }}'" \
--body "## :rocket: Initiating Release Process :rocket:

This PR marks a pivotal moment in our deployment cycle, signaling that all changes on the **Release Train (RT)** are deemed ready for release. It represents the collective decision of our developers that the changes bundled in the RT are suitable to be released together.

### What's Happening in This PR?

- We are merging the `${{ env.TRAIN }}` branch into the `${{ env.RELEASE_BR }}` branch.
- This action is a critical step, transitioning us from the development phase to the release phase.

### :white_check_mark: Automatic Merging Upon CI Checks :white_check_mark:

- This PR is configured to **automatically merge** once all CI checks successfully pass.
- These checks include running our comprehensive test suite on the RT branch to ensure a minimum standard of quality, covering sanity checks, QA, and unit tests.

### Ensuring Quality and Preparing for Release:

- Our focus now shifts to **stress testing** and executing a CI job matrix to rigorously evaluate our changes under varied conditions.
- We'll also handle essential chores, like **semantic versioning bumps** across source/distribution files and updating the changelog with details of the imminent release.

### :bulb: Next Steps in Our Journey:

- Following the successful merge of this PR, we'll initiate the next phase, which involves merging the `${{ env.RELEASE_BR }}` into the **Main/Master** branch.
- This next PR will continue the narrative we're building here, ensuring a smooth transition and a consistent story from development to final release.

### :handshake: Collaborative Efforts:

- Your reviews, insights, and contributions have brought us to this stage. Let's keep up the momentum as we move closer to our goal.
- Please coordinate for any final adjustments or critical issues that need addressing before the merge.

### :hourglass_flowing_sand: Looking Ahead:

- Once merged, our changes are set for the final stage of release preparation.
- The team should be prepared to monitor and address any issues in the subsequent phase of merging into the Main/Master branch.
"

############## Merge ##############
- name: 'Merge PR ${{ env.TRAIN }} --> ${{ env.RELEASE_BR }}'
run: gh pr merge "${{ env.TRAIN }}" --auto --delete-branch --squash
Loading
Loading