zoc
October 29, 2025 · View on GitHub
- Shell plugin with aliases and functions to speed up
oclogins and token renewal. - Works with both Zsh and Bash.
With zoc
- ⏱️ Time: 10 seconds
- 🖱️ Clicks: 2
Without zoc
- ⏱️ Time: 30 seconds
- 🖱️ Clicks: 8
Install
For Zsh (Oh My Zsh)
- Clone zoc to your plugin directory:
git clone https://github.com/TomerG2/zoc ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zoc
- Add to your
~/.zshrc:
plugins+=(zoc)
- Restart your shell:
exec zsh
For Bash
- Clone zoc to a directory of your choice:
git clone https://github.com/TomerG2/zoc ~/.zoc
- Add to your
~/.bashrcor~/.bash_profile:
source ~/.zoc/zoc.sh
- Restart your shell or run:
source ~/.bashrc # or ~/.bash_profile
For Zsh (without Oh My Zsh)
- Clone zoc to a directory of your choice:
git clone https://github.com/TomerG2/zoc ~/.zoc
- Add to your
~/.zshrc:
source ~/.zoc/zoc.sh
- Restart your shell:
exec zsh
Commands
oclog <alias> <api-server> <namespace>→ logs you in with a short alias and optional namespace.ocen→ checks if your oc login has expired and refreshes the token if it has.ocp→ combines ocensure && oc.
Examples
oclogin dev https://your-openshift-api-server:6443 my-namespace
# Creates a new context with the alias "dev", setting ns to "my-namespace"
ocen
# Check if the token has expired and refreshes it if needed
ocp get pods
# Refreshes token if needed and exec "oc get pods"
Development
Release Process
The release process is split into two phases for better control and transparency:
Phase 1: Version Bump (During PR)
Before merging your changes, bump the version numbers in your PR:
./scripts/bump-version.sh 1.2.0
This updates version numbers in zoc.sh and README.md. Commit these changes as part of your PR so reviewers can see what version is being released.
Phase 2: Create Release (After Merge to Main)
After your PR is merged to main, create the actual release:
Option A: Manual Script
./scripts/create-release.sh 1.2.0 "Added new features"
Option B: GitHub Actions (Recommended)
- Go to Actions > Release > Run workflow
- Enter the same version number used in Phase 1
- The workflow will verify version consistency and create the release automatically
The release process will fail if the version in files doesn't match the requested release version, ensuring consistency.