Skip to content

HDDS-11072. Publish user-facing configs to the doc site #6916

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

Draft
wants to merge 17 commits into
base: master
Choose a base branch
from
Draft
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Changed Github Actions user and target path
  • Loading branch information
sarvekshayr committed Aug 28, 2024
commit 7f974cc345b4f3e9ed4fa047a7b5a75ec14352cb
28 changes: 14 additions & 14 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -211,21 +211,18 @@ jobs:
echo "Configurations.md is unchanged, skipping commit and PR creation."
echo "hashes_differ=false" >> $GITHUB_ENV
fi
- name: Configure Git
if: env.hashes_differ == 'true'
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
- name: Commit and push changes to apache/ozone
if: env.hashes_differ == 'true'
run: |
git config --global user.name 'Github Actions'
git config --global user.email '[email protected]'
git add hadoop-hdds/docs/content/tools/Configurations.md
git commit -m "[Auto] Update Configurations.md from $GITHUB_SHA"
git push origin HEAD:master
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is adding the commit directly to master. This should actually go to a source branch based off the latest master with a unique name. In the following PR step, we should explicitly specify the source and target branches for the PR. I think we will have to manually delete the branch when the PR is merged. I'm not sure how to do something like dependabot where the branch gets automatically deleted when the PR is merged.

- name: Create Pull Request in apache/ozone
if: env.hashes_differ == 'true'
env:
token: ${{ secrets.GITHUB_TOKEN }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh pr create --title "[Auto] Update Configurations.md" --body "This is an automated pull request."
- name: Checkout ozone-site repository
Expand All @@ -234,28 +231,31 @@ jobs:
with:
repository: apache/ozone-site
ref: 'HDDS-9225-website-v2'
token: ${{ secrets.GITHUB_TOKEN }}
path: ozone-site
- name: Copy MD file to ozone-site repository
if: env.hashes_differ == 'true'
run: |
TARGET_DIR=$(find ozone-site/docs -type d -name '*-administrative-guide' -exec find {} -type d -name '*-configuration' -print -quit \;)
echo "$TARGET_DIR"
TARGET_DIR=$(find ozone-site/docs -type d -name '*-administrator-guide' -exec find {} -type d -name '*-configuration' -print -quit \;)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need the recursive search provided by find, and it might actually be more predictable to leave it out. I think we can simplify this:

Suggested change
TARGET_DIR=$(find ozone-site/docs -type d -name '*-administrator-guide' -exec find {} -type d -name '*-configuration' -print -quit \;)
TARGET_DIR=$(ls docs/*-administrator-guide/*-configuration)

echo "Target directory: $TARGET_DIR"
if [ -z "$TARGET_DIR" ]; then
echo "Target directory not found."
exit 1
fi
cp hadoop-hdds/docs/content/tools/Configurations.md "$TARGET_DIR/configurations.md"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This page is currently called "Configuration Key Appendix" in the new website. We should name the file <number>-appendix.md. This will give it the URL <domain>/docs/administrator-guide/configuration/appendix. The current set of changes would produce a more confusing URL: <domain>/docs/administrator-guide/configuration/configuration.

The number at the beginning of the name is required by the new website's CI to define an absolute ordering of pages in the sdebar. We probably want this to be the last page in the section always. We could list all the current numbers and add 1 to make it the next, but there is actually no requirement that the numbers are consecutive, they work more like weights. To keep this simple I would suggest naming this file 99-appendix.md so it is always last assuming there are less than 99 immediate children of the configuration directory. This should always be true otherwise the website organization would be a mess, but the PR gives us a change to check this assumption if needed. Let's add a comment to the script here explaining this.

- name: Commit and push changes to apache/ozone-site
if: env.hashes_differ == 'true'
run: |
cd ozone-site
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
cd ..
git add "$TARGET_DIR/configurations.md"
git config --global user.name 'Github Actions'
git config --global user.email 'noreply@github.com'
ADD_FILE=$(find docs -type d -name '*-administrator-guide' -exec find {} -type d -name '*-configuration' -print -quit \;)
Copy link
Contributor

@errose28 errose28 Sep 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should save the absolute path to the file as a variable in the previous step instead of recomputing it.

git add "$ADD_FILE/configurations.md"
git commit -m "[Auto] Update configurations.md page from ozone $GITHUB_SHA"
git push origin HEAD:HDDS-9225-website-v2
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar comment from before about source and target branches applies here as well.

- name: Create Pull Request in apache/ozone-site
if: env.hashes_differ == 'true'
env:
token: ${{ secrets.GITHUB_TOKEN }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
cd ozone-site
gh pr create --title "[Auto] Update configurations.md page" --body "This is an automated pull request from the ozone repository."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar comment about PR description from before applies here as well.

Expand Down