-
Notifications
You must be signed in to change notification settings - Fork 23
Implemented version switcher for docs the Operators way #392
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
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,63 @@ | ||||||||||||||||||||||
| name: Build Percona Backup for MongoDB docs | ||||||||||||||||||||||
| on: | ||||||||||||||||||||||
| push: | ||||||||||||||||||||||
| branches: | ||||||||||||||||||||||
| - main | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| jobs: | ||||||||||||||||||||||
| build: | ||||||||||||||||||||||
| name: Deploy docs | ||||||||||||||||||||||
| runs-on: ubuntu-latest | ||||||||||||||||||||||
| permissions: | ||||||||||||||||||||||
| contents: write | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| steps: | ||||||||||||||||||||||
| #Pull the latest changes | ||||||||||||||||||||||
| - name: Checkout code | ||||||||||||||||||||||
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | ||||||||||||||||||||||
| with: | ||||||||||||||||||||||
| fetch-depth: 0 # fetch all commits/branches | ||||||||||||||||||||||
| #Prepare the env | ||||||||||||||||||||||
| - name: Set up Python | ||||||||||||||||||||||
| uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0 | ||||||||||||||||||||||
| with: | ||||||||||||||||||||||
| python-version: '3.x' | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| #Configure git | ||||||||||||||||||||||
| - name: Configure git | ||||||||||||||||||||||
| env: | ||||||||||||||||||||||
| ROBOT_TOKEN: ${{ secrets.ROBOT_TOKEN }} | ||||||||||||||||||||||
| run: | | ||||||||||||||||||||||
| git config --global url."https://percona-platform-robot:${ROBOT_TOKEN}@github.com".insteadOf "https://github.com" | ||||||||||||||||||||||
| git config user.name "GitHub Action" | ||||||||||||||||||||||
| git config user.email "github-action@users.noreply.github.com" | ||||||||||||||||||||||
| git config user.password "${ROBOT_TOKEN}" | ||||||||||||||||||||||
| echo "GIT_USER=percona-platform-robot:${ROBOT_TOKEN}" >> $GITHUB_ENV | ||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That action can be removed - I suggested a rewritten step later |
||||||||||||||||||||||
|
|
||||||||||||||||||||||
|
|
||||||||||||||||||||||
| #Extract release from YAML | ||||||||||||||||||||||
| - name: Extract release from variables | ||||||||||||||||||||||
| run: | | ||||||||||||||||||||||
| RELEASE=$(grep '^release:' variables.yml | awk '{print $2}' | tr -d "'") | ||||||||||||||||||||||
| echo "RELEASE=$RELEASE" >> $GITHUB_ENV | ||||||||||||||||||||||
| # PRUNED_VERSION=$(grep '^pruned_version:' variables.yml | awk '{print $2}' | tr -d "'") | ||||||||||||||||||||||
| # echo "PRUNED_VERSION"=$"PRUNED_VERSION" >> $GITHUB_ENV | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
|
|
||||||||||||||||||||||
| #Set up MkDocs | ||||||||||||||||||||||
| - name: Install MkDocs | ||||||||||||||||||||||
| run: | | ||||||||||||||||||||||
| python -m pip install --upgrade pip | ||||||||||||||||||||||
| pip install wheel | ||||||||||||||||||||||
| if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
|
|
||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||||||||||||||||||||||
| # Deploy docs | ||||||||||||||||||||||
| - name: Deploy docs | ||||||||||||||||||||||
| env: | ||||||||||||||||||||||
| MKDOCS_GIT_COMMITTERS_APIKEY: ${{ secrets.ROBOT_TOKEN }} | ||||||||||||||||||||||
| run: | | ||||||||||||||||||||||
| mike deploy $RELEASE -u latest -b publish -p | ||||||||||||||||||||||
| mike set-default latest -b publish -p | ||||||||||||||||||||||
| # mike delete $PRUNED_VERSION -b publish -p | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Explicit cleanup: added a final "Clear git credentials" step (if: always()) that unsets the extraheader as soon as the push is done. |
||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GIT_USER is set but never read anywhere in this repo (checked both main.yaml and vale.yml — no consumer). So lines 34–35 aren't just risky, they're dead code that adds risk for no benefit.
Line 34 — git config user.password "${ROBOT_TOKEN}"
user.password isn't a real git config key (git doesn't read credentials from user.*). It does nothing functionally, but it does write the raw token in plaintext into ~/.gitconfig for the rest of the job. Pure downside, no upside — delete it.
Line 35 — echo "GIT_USER=percona-platform-robot:${ROBOT_TOKEN}" >> $GITHUB_ENV
This writes the token into $GITHUB_ENV, which means every subsequent step in the job gets GIT_USER (containing the raw secret) injected into its environment automatically — a much bigger blast radius than the one step that needs it. GitHub does mask the literal token value in logs, but that doesn't protect against a compromised/malicious dependency in a later step (e.g. something pulled in by pip install -r requirements.txt) reading $GIT_USER from its own env and exfiltrating it. Since nothing downstream even uses GIT_USER, this line should just go.