Skip to content
Merged
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
10 changes: 10 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,16 @@ jobs:
with:
sha: ${{ needs.build-info.outputs.sha }}

update-ozone-site-config-doc:
needs:
- generate-config-doc
if: |
github.event_name == 'push' &&
github.repository == 'apache/ozone' &&
github.ref_name == 'master'
uses: ./.github/workflows/update-ozone-site-config-doc.yml
secrets: inherit

compile:
needs:
- build-info
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/generate-config-doc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ on:
required: true

jobs:
generate:
generate-config-doc:
runs-on: ubuntu-24.04
steps:
- name: Checkout project
Expand Down
46 changes: 17 additions & 29 deletions .github/workflows/update-ozone-site-config-doc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,39 +15,32 @@

name: update-ozone-site-config-doc
on:
workflow_run:
workflows: ["build-branch"]
types: [completed]
branches: [master]
workflow_call:

env:
BRANCH_NAME: automated-config-doc-update

jobs:
update-ozone-site-config-doc:
if: |
github.event.workflow_run.conclusion == 'success' &&
github.repository == 'apache/ozone' &&
!startsWith(github.event.workflow_run.head_commit.message, '[Auto]')
runs-on: ubuntu-24.04
steps:
- name: Download generated documentation
uses: actions/download-artifact@v4
with:
name: config-documentation
path: .
run-id: ${{ github.event.workflow_run.id }}
github-token: ${{ secrets.GITHUB_TOKEN }}


- name: Check if ozone-site repository exists
id: check-site-repo
run: |
REPO_OWNER="${{ github.repository_owner }}"
if gh repo view "$REPO_OWNER/ozone-site" >/dev/null 2>&1; then
echo "exists=true" >> $GITHUB_OUTPUT
else
echo "exists=false" >> $GITHUB_OUTPUT
echo "ozone-site repository not found for $REPO_OWNER, skipping"
fi
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPO_OWNER: "${{ github.repository_owner }}"

- name: Checkout ozone-site repository
if: steps.check-site-repo.outputs.exists == 'true'
Expand All @@ -58,12 +51,12 @@ jobs:

git clone --depth=1 --branch=master https://github.com/${{ github.repository_owner }}/ozone-site.git ozone-site

# Check if automated-config-doc-update branch exists remotely
# Check if $BRANCH_NAME branch exists remotely
cd ozone-site
if git ls-remote --heads origin automated-config-doc-update | grep -q automated-config-doc-update; then
if git ls-remote --heads origin $BRANCH_NAME | grep -q $BRANCH_NAME; then
echo "PR branch exists, checking it out for comparison"
git fetch --depth=1 origin automated-config-doc-update
git checkout -B automated-config-doc-update FETCH_HEAD
git fetch --depth=1 origin $BRANCH_NAME
git checkout -B $BRANCH_NAME FETCH_HEAD
else
echo "PR branch does not exist, staying on master for comparison"
fi
Expand Down Expand Up @@ -103,15 +96,15 @@ jobs:
if: steps.check-changes.outputs.changed == 'true'
uses: actions/checkout@v4
with:
ref: ${{ github.event.workflow_run.head_sha }}
ref: ${{ github.sha }}
path: ozone-repo

- name: Extract JIRA ID from commit message
if: steps.check-changes.outputs.changed == 'true'
id: extract-jira
run: |
cd ozone-repo
COMMIT_MSG=$(git log -1 --format='%s' ${{ github.event.workflow_run.head_sha }})
COMMIT_MSG=$(git log -1 --format='%s' ${{ github.sha }})
echo "Commit message: $COMMIT_MSG"

JIRA_ID=$(echo "$COMMIT_MSG" | grep -oE '(HDDS|OZONE)-[0-9]+' | head -1 || echo "")
Expand All @@ -129,9 +122,6 @@ jobs:
run: |
cd ozone-site

# Use single branch name
BRANCH_NAME="automated-config-doc-update"

echo "Current branch: $(git branch --show-current)"
echo "Current commit: $(git rev-parse HEAD)"

Expand All @@ -144,7 +134,7 @@ jobs:

# Build commit message with JIRA ID if available
JIRA_ID="${{ steps.extract-jira.outputs.jira_id }}"
COMMIT_MSG="[Auto] Update configuration documentation from ozone ${{ github.event.workflow_run.head_sha }}"
COMMIT_MSG="[Auto] Update configuration documentation from ozone ${{ github.sha }}"
if [ -n "$JIRA_ID" ]; then
COMMIT_MSG="$JIRA_ID. $COMMIT_MSG"
fi
Expand All @@ -158,20 +148,18 @@ jobs:
if: steps.check-changes.outputs.changed == 'true' && github.repository == 'apache/ozone'
env:
GH_TOKEN: ${{ secrets.OZONE_WEBSITE_BUILD }}
JIRA_ID: ${{ steps.extract-jira.outputs.jira_id }}
REPO: ${{ github.repository }}
run: |
cd ozone-site

BRANCH_NAME="automated-config-doc-update"
REPO="${{ github.repository }}"
JIRA_ID="${{ steps.extract-jira.outputs.jira_id }}"

# Generate PR body
../ozone-repo/dev-support/ci/pr_body_config_doc.sh \
"$REPO" \
"${{ github.workflow }}" \
"${{ github.run_id }}" \
"${{ github.event.workflow_run.head_branch }}" \
"${{ github.event.workflow_run.head_sha }}" \
"${{ github.ref_name }}" \
"${{ github.sha }}" \
"$JIRA_ID" > pr_body.txt

# Check if PR already exists
Expand Down