Skip to content

Admin API: add missing /v1/cloud_storage/ endpoints #217

Admin API: add missing /v1/cloud_storage/ endpoints

Admin API: add missing /v1/cloud_storage/ endpoints #217

Workflow file for this run

name: Check and deploy API documentation
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
permissions:
contents: read
pull-requests: write
id-token: write
jobs:
determine-doc-ids:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set matrix
id: set-matrix
run: |
DOCS=()
for d in */ ; do
# Exclude shared and .github or any other non-doc folders
if [[ "$d" == "shared/" || "$d" == ".github/" ]]; then
continue
fi
base="${d%/}"
if [[ -f "${base}/${base}.yaml" || -f "${base}/${base}.yml" || -f "${base}/${base}.json" ]]; then
DOCS+=("${base}")
fi
done
if [ ${#DOCS[@]} -eq 0 ]; then
echo "No doc folders found. Exiting workflow."
echo "matrix={\"doc_id\":[]}" >> "$GITHUB_OUTPUT"
exit 0
fi
JSON_ARRAY=$(printf '"%s",' "${DOCS[@]}" | sed 's/,$//')
JSON_MATRIX="{\"doc_id\":[${JSON_ARRAY}]}"
echo "matrix=$JSON_MATRIX" >> "$GITHUB_OUTPUT"
echo "Created matrix: $JSON_MATRIX"
deploy-doc:
if: ${{ github.event_name == 'push' && fromJson(needs.determine-doc-ids.outputs.matrix).doc_id[0] != null }}
needs: determine-doc-ids
name: Deploy API documentation on Bump.sh
runs-on: ubuntu-latest
strategy:
matrix: ${{ fromJson(needs.determine-doc-ids.outputs.matrix) }}
fail-fast: false
steps:
- uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: ${{ vars.RP_AWS_CRED_REGION }}
role-to-assume: arn:aws:iam::${{ secrets.RP_AWS_CRED_ACCOUNT_ID }}:role/${{ vars.RP_AWS_CRED_BASE_ROLE_NAME }}${{ github.event.repository.name }}
- uses: aws-actions/aws-secretsmanager-get-secrets@v2
with:
secret-ids: |
,sdlc/prod/github/bump_api_key
parse-json-secrets: true
- name: Checkout
uses: actions/checkout@v4
# Figure out the file path for non-admin docs
- name: Determine file format (non-admin)
id: format
if: ${{ matrix.doc_id != 'admin' }}
run: |
base="${{ matrix.doc_id }}"
if [ -f "${base}/${base}.yaml" ]; then
echo "file_path=${base}/${base}.yaml" >> "$GITHUB_OUTPUT"
elif [ -f "${base}/${base}.yml" ]; then
echo "file_path=${base}/${base}.yml" >> "$GITHUB_OUTPUT"
elif [ -f "${base}/${base}.json" ]; then
echo "file_path=${base}/${base}.json" >> "$GITHUB_OUTPUT"
else
echo "No API definition file found for ${base}"
exit 1
fi
- name: Determine overlays (non-admin)
id: overlays
if: ${{ matrix.doc_id != 'admin' }}
run: |
OVERLAYS=$(.github/scripts/determine-overlays.sh "${{ matrix.doc_id }}")
echo "overlay_paths=$OVERLAYS" >> "$GITHUB_OUTPUT"
echo "Using overlays: $OVERLAYS"
- name: Determine admin v1 overlays
id: admin-v1-overlays
if: ${{ matrix.doc_id == 'admin' }}
run: |
OVERLAYS=$(.github/scripts/determine-overlays.sh admin v1)
echo "overlay_paths=$OVERLAYS" >> "$GITHUB_OUTPUT"
echo "Using v1 overlays: $OVERLAYS"
- name: Determine admin v2 overlays
id: admin-v2-overlays
if: ${{ matrix.doc_id == 'admin' }}
run: |
OVERLAYS=$(.github/scripts/determine-overlays.sh admin v2)
echo "overlay_paths=$OVERLAYS" >> "$GITHUB_OUTPUT"
echo "Using v2 overlays: $OVERLAYS"
# ---- Admin v1 explicit deploy (only when matrix.doc_id == admin) ----
- name: Deploy API documentation (admin v1)
if: ${{ matrix.doc_id == 'admin' && hashFiles('admin/admin.yaml') != '' }}
uses: bump-sh/github-action@v1
with:
hub: redpanda
doc: admin
token: ${{ env.BUMP_API_KEY }}
file: admin/admin.yaml
overlay: ${{ steps.admin-v1-overlays.outputs.overlay_paths }}
branch: v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# ---- Admin v2 explicit deploy (only when matrix.doc_id == admin) ----
- name: Deploy API documentation (admin v2)
if: ${{ matrix.doc_id == 'admin' && hashFiles('admin/admin-v2.yaml') != '' }}
uses: bump-sh/github-action@v1
with:
hub: redpanda
doc: admin
token: ${{ env.BUMP_API_KEY }}
file: admin/admin-v2.yaml
overlay: ${{ steps.admin-v2-overlays.outputs.overlay_paths }}
branch: v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# ---- Other docs (non-admin) ----
- name: Deploy API documentation (other files)
if: ${{ matrix.doc_id != 'admin' }}
uses: bump-sh/github-action@v1
with:
hub: redpanda
doc: ${{ matrix.doc_id }}
token: ${{ env.BUMP_API_KEY }}
file: ${{ steps.format.outputs.file_path }}
overlay: ${{ steps.overlays.outputs.overlay_paths }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
api-diff:
if: ${{ github.event_name == 'pull_request' && fromJson(needs.determine-doc-ids.outputs.matrix).doc_id[0] != null }}
needs: determine-doc-ids
name: Check diff
runs-on: ubuntu-latest
strategy:
matrix: ${{ fromJson(needs.determine-doc-ids.outputs.matrix) }}
fail-fast: false
steps:
- uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: ${{ vars.RP_AWS_CRED_REGION }}
role-to-assume: arn:aws:iam::${{ secrets.RP_AWS_CRED_ACCOUNT_ID }}:role/${{ vars.RP_AWS_CRED_BASE_ROLE_NAME }}${{ github.event.repository.name }}
- uses: aws-actions/aws-secretsmanager-get-secrets@v2
with:
secret-ids: |
,sdlc/prod/github/bump_api_key
parse-json-secrets: true
- name: Checkout
uses: actions/checkout@v4
# For non-admin docs, resolve file path
- name: Determine file format (non-admin)
id: format
if: ${{ matrix.doc_id != 'admin' }}
run: |
base="${{ matrix.doc_id }}"
if [ -f "${base}/${base}.yaml" ]; then
echo "file_path=${base}/${base}.yaml" >> "$GITHUB_OUTPUT"
elif [ -f "${base}/${base}.yml" ]; then
echo "file_path=${base}/${base}.yml" >> "$GITHUB_OUTPUT"
elif [ -f "${base}/${base}.json" ]; then
echo "file_path=${base}/${base}.json" >> "$GITHUB_OUTPUT"
else
echo "No API definition file found for ${base}"
exit 1
fi
- name: Determine overlays (non-admin)
id: overlays
if: ${{ matrix.doc_id != 'admin' }}
run: |
OVERLAYS=$(.github/scripts/determine-overlays.sh "${{ matrix.doc_id }}")
echo "overlay_paths=$OVERLAYS" >> "$GITHUB_OUTPUT"
echo "Using overlays: $OVERLAYS"
- name: Determine admin v1 overlays
id: admin-v1-overlays
if: ${{ matrix.doc_id == 'admin' }}
run: |
OVERLAYS=$(.github/scripts/determine-overlays.sh admin v1)
echo "overlay_paths=$OVERLAYS" >> "$GITHUB_OUTPUT"
echo "Using v1 overlays: $OVERLAYS"
- name: Determine admin v2 overlays
id: admin-v2-overlays
if: ${{ matrix.doc_id == 'admin' }}
run: |
OVERLAYS=$(.github/scripts/determine-overlays.sh admin v2)
echo "overlay_paths=$OVERLAYS" >> "$GITHUB_OUTPUT"
echo "Using v2 overlays: $OVERLAYS"
# ---- Admin v1 explicit diff ----
- name: Comment PR with API diff (admin v1)
if: ${{ matrix.doc_id == 'admin' && hashFiles('admin/admin.yaml') != '' }}
uses: bump-sh/github-action@v1
with:
hub: redpanda
doc: admin
token: ${{ env.BUMP_API_KEY }}
file: admin/admin.yaml
overlay: ${{ steps.admin-v1-overlays.outputs.overlay_paths }}
command: diff
branch: v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# ---- Admin v2 explicit diff ----
- name: Comment PR with API diff (admin v2)
if: ${{ matrix.doc_id == 'admin' && hashFiles('admin/admin-v2.yaml') != '' }}
uses: bump-sh/github-action@v1
with:
hub: redpanda
doc: admin
token: ${{ env.BUMP_API_KEY }}
file: admin/admin-v2.yaml
overlay: ${{ steps.admin-v2-overlays.outputs.overlay_paths }}
command: diff
branch: v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# ---- Other docs (non-admin) ----
- name: Comment PR with API diff (other files)
if: ${{ matrix.doc_id != 'admin' }}
uses: bump-sh/github-action@v1
with:
hub: redpanda
doc: ${{ matrix.doc_id }}
token: ${{ env.BUMP_API_KEY }}
file: ${{ steps.format.outputs.file_path }}
overlay: ${{ steps.overlays.outputs.overlay_paths }}
command: diff
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}