Skip to content

Commit

Permalink
chore: Cherry pick fixes for update of default branch to main (#17200) (
Browse files Browse the repository at this point in the history
#17235)

Signed-off-by: Roger Barker <roger.barker@swirldslabs.com>
Signed-off-by: Jendrik Johannes <jendrik.johannes@gmail.com>
Co-authored-by: Jendrik Johannes <jendrik.johannes@gmail.com>
Co-authored-by: Andrew Brandt <andrew.brandt@hashgraph.com>
Co-authored-by: Thomas Moran <152873392+thomas-swirlds-labs@users.noreply.github.com>
  • Loading branch information
4 people authored Jan 6, 2025
1 parent 67e04a4 commit 4a09f7d
Show file tree
Hide file tree
Showing 27 changed files with 325 additions and 220 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/flow-artifact-determinism.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
##
# Copyright (C) 2023-2024 Hedera Hashgraph, LLC
# Copyright (C) 2023-2025 Hedera Hashgraph, LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -35,7 +35,7 @@ on:
default: "21.0.4"
push:
branches:
- develop
- main
- 'release/**'
tags:
- 'v*.*.*'
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/node-flow-build-application.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
##
# Copyright (C) 2022-2024 Hedera Hashgraph, LLC
# Copyright (C) 2022-2025 Hedera Hashgraph, LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -50,7 +50,6 @@ on:
default: "temurin"
push:
branches:
- develop
- main
- 'release/*'

Expand Down Expand Up @@ -124,7 +123,7 @@ jobs:
with:
workflow: .github/workflows/node-flow-deploy-release-artifact.yaml
repo: hashgraph/hedera-services # ensure we are executing in the hashgraph org
ref: develop # ensure we are always using the workflow definition from the develop branch
ref: main # ensure we are always using the workflow definition from the main branch
token: ${{ secrets.GH_ACCESS_TOKEN }}
inputs: '{
"ref": "${{ steps.workflow-inputs.outputs.input-ref }}",
Expand Down
43 changes: 36 additions & 7 deletions .github/workflows/node-flow-deploy-release-artifact.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
##
# Copyright (C) 2022-2024 Hedera Hashgraph, LLC
# Copyright (C) 2022-2025 Hedera Hashgraph, LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -41,6 +41,11 @@ defaults:
run:
shell: bash

permissions:
id-token: write
contents: read
actions: read

jobs:
prepare-tag-release:
name: Prepare Release [Tag]
Expand Down Expand Up @@ -150,28 +155,52 @@ jobs:
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: '0'
ref: develop
ref: main
token: ${{ secrets.GH_ACCESS_TOKEN }}

- name: Trigger ZXF Prepare Extended Test Suite
- name: Check Prep XTS Job State
id: check-xts-job
if: ${{ needs.release-branch.result == 'success' }}
env:
GH_TOKEN: ${{ github.token }}
run: |
JOB_ENABLED="true"
JOB_STATE=$(gh workflow list --all --json name,state | jq -r '.[]|select(.name=="ZXF: Prepare Extended Test Suite")|.state')
[[ "${JOB_STATE}" == "disabled_manually" ]] && JOB_ENABLED="false"
echo "enabled=${JOB_ENABLED}" >> $GITHUB_OUTPUT
- name: Trigger ZXF Prepare Extended Test Suite
if: ${{ needs.release-branch.result == 'success' && steps.check-xts-job.outputs.enabled == 'true' }}
uses: step-security/workflow-dispatch@4d1049025980f72b1327cbfdeecb07fe7a20f577 # v1.2.4
with:
workflow: .github/workflows/zxf-prepare-extended-test-suite.yaml
repo: hashgraph/hedera-services # ensure we are executing in the hashgraph org
ref: develop # ensure we are always using the workflow definition from the develop branch
ref: main # ensure we are always using the workflow definition from the main branch
token: ${{ secrets.GH_ACCESS_TOKEN }}
inputs: '{ "ref": "${{ inputs.ref }}" }'

- name: Trigger ZXF Deploy Integration
- name: Check Integration Job State
id: check-integration-job
if: ${{ needs.release-branch.result == 'success' &&
(inputs.author != '' && inputs.msg != '' && inputs.sha != '') &&
!cancelled() }}
env:
GH_TOKEN: ${{ github.token }}
run: |
JOB_ENABLED="true"
JOB_STATE=$(gh workflow list --all --json name,state | jq -r '.[]|select(.name=="ZXF: [Node] Deploy Integration Network Release")|.state')
[[ "${JOB_STATE}" == "disabled_manually" ]] && JOB_ENABLED="false"
echo "enabled=${JOB_ENABLED}" >> $GITHUB_OUTPUT
- name: Trigger ZXF Deploy Integration
if: ${{ needs.release-branch.result == 'success' && steps.check-integration-job.outputs.enabled == 'true' &&
(inputs.author != '' && inputs.msg != '' && inputs.sha != '') &&
!cancelled() }}
uses: step-security/workflow-dispatch@4d1049025980f72b1327cbfdeecb07fe7a20f577 # v1.2.4
with:
workflow: .github/workflows/node-zxf-deploy-integration.yaml
repo: hashgraph/hedera-services # ensure we are executing in the hashgraph org
ref: develop # ensure we are always using the workflow definition from the develop branch
ref: main # ensure we are always using the workflow definition from the main branch
token: ${{ secrets.GH_ACCESS_TOKEN }}
inputs: '{
"ref": "${{ inputs.ref }}",
Expand All @@ -195,7 +224,7 @@ jobs:
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
token: ${{ secrets.GH_ACCESS_TOKEN }}
ref: develop
ref: main
fetch-depth: '0'

- name: Checkout Hedera Protobufs Code
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
##
# Copyright (C) 2022-2024 Hedera Hashgraph, LLC
# Copyright (C) 2022-2025 Hedera Hashgraph, LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -14,7 +14,7 @@
# limitations under the License.
##

name: "ZXCron: [Node] Develop JRS Tests"
name: "ZXCron: [Node] Main JRS Tests"
on:
workflow_dispatch:

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/node-zxf-snyk-monitor.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
##
# Copyright (C) 2023-2024 Hedera Hashgraph, LLC
# Copyright (C) 2023-2025 Hedera Hashgraph, LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -19,7 +19,7 @@ name: "ZXF: Snyk Monitor"
on:
push:
branches:
- develop
- main
workflow_dispatch:

permissions:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
##
# Copyright (C) 2022-2024 Hedera Hashgraph, LLC
# Copyright (C) 2022-2025 Hedera Hashgraph, LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -14,7 +14,7 @@
# limitations under the License.
##

name: "ZXCron: [Platform] Develop JRS Regression"
name: "ZXCron: [Platform] Main JRS Regression"
on:
schedule:
- cron: '30 5 * * *'
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/zxc-jrs-regression.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
##
# Copyright (C) 2022-2024 Hedera Hashgraph, LLC
# Copyright (C) 2022-2025 Hedera Hashgraph, LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -490,8 +490,8 @@ jobs:
fi
if [[ -n "${HEDERA_TESTS_ENABLED}" && "${HEDERA_TESTS_ENABLED}" = true ]]; then
# Override for the develop branch
if [[ "${SLACK_BRANCH}" != "develop" ]]; then
# Override for the main branch
if [[ "${SLACK_BRANCH}" != "main" ]]; then
SLACK_SUMMARY="hedera-gcp-${SLACK_BRANCH}-summary"
SLACK_RESULTS="hedera-gcp-${SLACK_BRANCH}-regression"
else
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/zxcron-extended-test-suite.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
##
# Copyright (C) 2023-2024 Hedera Hashgraph, LLC
# Copyright (C) 2023-2025 Hedera Hashgraph, LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -57,12 +57,12 @@ jobs:
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: '0'
ref: develop
ref: main
token: ${{ secrets.GH_ACCESS_TOKEN }}

# Check if the xts-candidate tag exists
# the command git branch --contains xts-tag-commit | grep --quiet <default branch>
# will return an exit code of 1 if the tagged commit is not found on the develop
# will return an exit code of 1 if the tagged commit is not found on the main
# branch.
- name: Check for tags
id: check-tags-exist
Expand Down Expand Up @@ -93,17 +93,17 @@ jobs:
gh run cancel ${{ github.run_id }}
fi
# Check if the tag exists on the develop branch
# Check if the tag exists on the main branch
set +e
git branch --contains "${XTS_COMMIT}" | grep --quiet develop >/dev/null 2>&1
git branch --contains "${XTS_COMMIT}" | grep --quiet main >/dev/null 2>&1
BRANCH_ON_DEVELOP="${?}"
set -e
# Get commit author
AUTHOR_NAME=$(git log -1 --format='%an' "${XTS_COMMIT}")
AUTHOR_EMAIL=$(git log -1 --format='%ae' "${XTS_COMMIT}")
# If the tag exists on the Develop Branch set the output variables as appropriate
# If the tag exists on the Main Branch set the output variables as appropriate
# Otherwise cancel out
if [[ "${BRANCH_ON_DEVELOP}" -eq 0 ]]; then
echo "xts-tag-exists=true" >> $GITHUB_OUTPUT
Expand Down Expand Up @@ -259,7 +259,7 @@ jobs:
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: '0'
ref: develop
ref: main
token: ${{ secrets.GH_ACCESS_TOKEN }}

- name: Collect run logs in a log file
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/zxcron-promote-build-candidate.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
##
# Copyright (C) 2023-2024 Hedera Hashgraph, LLC
# Copyright (C) 2023-2025 Hedera Hashgraph, LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -52,7 +52,7 @@ jobs:
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: '0'
ref: develop
ref: main
token: ${{ secrets.GH_ACCESS_TOKEN }}

- name: Find Build Candidates
Expand All @@ -74,8 +74,8 @@ jobs:
gh run cancel ${{ github.run_id }}
fi
# Verify the commit is on develop and continue
if git branch --contains "${CANDIDATE_COMMIT}" | grep --quiet develop >/dev/null 2>&1; then
# Verify the commit is on main and continue
if git branch --contains "${CANDIDATE_COMMIT}" | grep --quiet main >/dev/null 2>&1; then
git push --delete origin $(git tag --list "${TAG_PATTERN}")
git tag --delete $(git tag --list "${TAG_PATTERN}")
echo "build-candidate-exists=true" >> "${GITHUB_OUTPUT}"
Expand Down
72 changes: 72 additions & 0 deletions .github/workflows/zxf-collect-workflow-logs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
##
# Copyright (C) 2023-2025 Hedera Hashgraph, LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
##

name: "ZXF: Collect Workflow Run Logs"
on:
workflow_dispatch:
inputs:
workflow_id:
description: "ID of the workflow run to collect logs from (example: #123456789)"
required: true

defaults:
run:
shell: bash

jobs:
collect-logs:
name: Collect Workflow Run Logs
runs-on: network-node-linux-medium
steps:
- name: Harden Runner
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
with:
egress-policy: audit

- name: Get run ID from run number
env:
GH_TOKEN: ${{ secrets.GH_ACCESS_TOKEN }}
id: run_id
run: |
RUN_ID=$(gh api -H "Accept: application/vnd.github+json" \
/repos/hashgraph/hedera-services/actions/workflows/zxcron-extended-test-suite.yaml/runs \
--jq '.workflow_runs[] | select(.run_number == ${{ inputs.workflow_id }}) | .id')
echo "::set-output name=value::$RUN_ID"
- name: Checkout Code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: '0'
ref: main
token: ${{ secrets.GH_ACCESS_TOKEN }}

- name: Get run logs
env:
GH_TOKEN: ${{ secrets.GH_ACCESS_TOKEN }}
run: gh run view ${{ steps.run_id.outputs.value }} --log >> workflow-run.log

- name: Upload log as artifact
id: upload-log
uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0
with:
path: workflow-run.log

- name: Share log information
run: |
echo "### Logs Collected for Workflow:" >> $GITHUB_STEP_SUMMARY
echo "Workflow run ID: ${{ inputs.workflow_id }}" >> $GITHUB_STEP_SUMMARY
echo "Workflow URL: https://github.com/hashgraph/hedera-services/actions/runs/${{ steps.run_id.outputs.value }}" >> $GITHUB_STEP_SUMMARY
echo "Log file download URL: ${{ steps.upload-log.outputs.artifact-url }}" >> $GITHUB_STEP_SUMMARY
8 changes: 4 additions & 4 deletions .github/workflows/zxf-prepare-extended-test-suite.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
##
# Copyright (C) 2023-2024 Hedera Hashgraph, LLC
# Copyright (C) 2023-2025 Hedera Hashgraph, LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -50,18 +50,18 @@ jobs:
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: '0'
ref: 'develop'
ref: 'main'
token: ${{ secrets.GH_ACCESS_TOKEN }}

- name: Validate Input Ref
id: validate-input
env:
COMMIT_ID: ${{ inputs.ref }}
run: |
if git merge-base --is-ancestor "${COMMIT_ID}" develop >/dev/null 2>&1; then
if git merge-base --is-ancestor "${COMMIT_ID}" main >/dev/null 2>&1; then
echo "commit_on_dev=true" >> $GITHUB_OUTPUT
else
echo "::error title=Branch Alignment::The provided commit (${COMMIT_ID}) is not present on the develop branch."
echo "::error title=Branch Alignment::The provided commit (${COMMIT_ID}) is not present on the main branch."
exit 1
fi
Expand Down
9 changes: 5 additions & 4 deletions docs/branch-naming-conventions.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,19 @@ naming standard.

### Permanent & Default Branches

The repository will contain two permanent branches as per the GitFlow Workflow `main` and `develop`
branches.
The repository will contain one permanent branch, `main`, per the Hashgraph Continuous Integration
Test and Release workflow

**Default Branches**

The default branch for a repository will be `develop` as per the branching workflow.
The default branch for a repository will be `main` as per the Hashgraph Continuous Integration
Test and Release workflow.

### Branch to Issue Relationship

Aside from the permanent or release branches, no short-lived (feature, hotfix, bugfix) branch should
be created without being associated to an issue number. No short-lived branch should be merged into
`develop` or `main` without an associated and approved pull request.
`main` without an associated and approved pull request.

### Feature Branch Naming

Expand Down
Loading

0 comments on commit 4a09f7d

Please sign in to comment.