oc-auth
БесплатноЗапускает вложенные скриптыНе проверенHelper skill to retrieve OAuth tokens from the correct OpenShift cluster context when multiple clusters are configured
Об этом скилле
OC Authentication Helper
This skill provides a centralized way to retrieve OAuth tokens from specific OpenShift clusters when multiple cluster contexts are configured in the user's kubeconfig.
When to Use This Skill
Use this skill whenever you need to:
- Get an OAuth token for API authentication from a specific OpenShift cluster
- Verify authentication to a specific cluster
- Work with multiple OpenShift cluster contexts simultaneously
This skill is used by all commands that need to authenticate with OpenShift clusters:
trigger-periodic,trigger-postsubmit,trigger-presubmitcommands (app.ci cluster)query-job-statuscommand (app.ci cluster)
The skill provides a single curl_with_token.sh script that wraps curl and automatically handles OAuth token retrieval and injection, preventing accidental token exposure.
Due to a known Claude Code bug with git-installed marketplace plugins:
When referencing files from this skill (scripts, configuration files, etc.), you MUST:
- Always use the "Base directory" path provided at the top of this skill prompt
- Never assume skills are located in
~/.claude/plugins/ - Construct full absolute paths by combining the base directory with the relative file path
Example:
- ❌ WRONG:
~/.claude/plugins/ci/skills/oc-auth/curl_with_token.sh - ✅ CORRECT: Use the base directory shown above +
/curl_with_token.sh
If you see "no such file or directory" errors, verify you're using the base directory path, not the assumed marketplace cache location.
Prerequisites
oc CLI Installation
- Check if installed:
which oc - If not installed, provide instructions for the user's platform
- Installation guide: https://docs.openshift.com/container-platform/latest/cli_reference/openshift_cli/getting-started-cli.html
- Check if installed:
User Authentication
- User must be logged in to the target cluster via browser-based authentication
- Each
oc logincreates a new context in the kubeconfig
How It Works
The oc CLI maintains multiple cluster contexts in ~/.kube/config. When a user runs oc login to different clusters, each login creates a separate context. This skill:
- Lists all available contexts
- Searches for the context matching the target cluster by API server URL
- Retrieves the OAuth token from that specific context
- Returns the token for use in API calls
Common Clusters
Here are commonly used OpenShift clusters:
1. app.ci - OpenShift CI Cluster
- Console URL: https://console-openshift-console.apps.ci.l2s4.p1.openshiftapps.com/
- API Server: https://api.ci.l2s4.p1.openshiftapps.com:6443
- Used by: trigger-periodic, trigger-postsubmit, trigger-presubmit, query-job-status
2. dpcr - DPCR Cluster
- Console URL: https://console-openshift-console.apps.cr.j7t7.p1.openshiftapps.com/
- API Server: https://api.cr.j7t7.p1.openshiftapps.com:6443
Note: The skill supports any OpenShift cluster - simply provide the cluster's API server URL.
Usage
Script: curl_with_token.sh
A curl wrapper that automatically retrieves the OAuth token and adds it to the request, preventing token exposure.
curl_with_token.sh <cluster_api_url> [curl arguments...]
Parameters:
<cluster_api_url>: Full cluster API server URL (e.g.,https://api.ci.l2s4.p1.openshiftapps.com:6443)[curl arguments...]: All standard curl arguments (URL, headers, data, etc.)
How it works:
- Finds the oc context matching the specified cluster API URL
- Retrieves OAuth token from that cluster context
- Adds
Authorization: Bearer <token>header automatically - Executes curl with all provided arguments
- Token never appears in output or command history
Exit Codes:
0: Success1: Invalid cluster_id or missing arguments2: No context found for the specified cluster3: Failed to retrieve token from context- Other: curl exit codes
Example Usage in Commands
Use the curl wrapper instead of regular curl for authenticated requests:
# Query app.ci API
curl_with_token.sh https://api.ci.l2s4.p1.openshiftapps.com:6443 -X POST \
-d '{"job_name": "my-job", "job_execution_type": "1"}' \
https://gangway-ci.apps.ci.l2s4.p1.openshiftapps.com/v1/executions
# Query any other OpenShift cluster API
curl_with_token.sh https://api.your-cluster.example.com:6443 -X GET \
https://your-api.example.com/endpoint
Benefits:
- Token never exposed in logs or output
- Automatic authentication error handling
- Same curl arguments you're already familiar with
- Works with any curl flags (-v, -s, -X, -H, -d, etc.)
Error Handling
The script provides clear error messages for common scenarios:
Missing or invalid arguments
- Error: "Usage: curl_with_token.sh
[curl arguments...]" - Shows example usage
- Error: "Usage: curl_with_token.sh
No context found
- Error: "No oc context found for cluster with API server: {url}"
- Provides authentication
Установить oc-auth в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл oc-auth?
Helper skill to retrieve OAuth tokens from the correct OpenShift cluster context when multiple clusters are configured
Как установить скилл oc-auth?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл oc-auth запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
ci-review
The scan that the plugin's GitHub Action runs.
от Anthropicazure-static-web-apps
Helps create, configure, and deploy Azure Static Web Apps using the SWA CLI. Use when deploying static sites to Azure, setting up SWA local development…
от GitHubai-ready
Make any repo AI-ready — analyzes your codebase and generates AGENTS.md, copilot-instructions.md, CI workflows, issue templates, and more. Mines your PR…
от GitHubaws-cdk-python-setup
Setup and initialization guide for developing AWS CDK (Cloud Development Kit) applications in Python. This skill enables users to configure environment…
от GitHub