Skip to content

TomerG2/zoc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

zoc — OpenShift Shell helpers

Version ShellCheck

  • Shell plugin with aliases and functions to speed up oc logins and token renewal.
  • Works with both Zsh and Bash.

With zoc

with zoc
  • ⏱️ Time: 10 seconds
  • 🖱️ Clicks: 2

Without zoc

without zoc
  • ⏱️ Time: 30 seconds
  • 🖱️ Clicks: 8

Install

For Zsh (Oh My Zsh)

  1. Clone zoc to your plugin directory:
git clone https://github.com/TomerG2/zoc ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zoc
  1. Add to your ~/.zshrc:
plugins+=(zoc)
  1. Restart your shell:
exec zsh

For Bash

  1. Clone zoc to a directory of your choice:
git clone https://github.com/TomerG2/zoc ~/.zoc
  1. Add to your ~/.bashrc or ~/.bash_profile:
source ~/.zoc/zoc.sh
  1. Restart your shell or run:
source ~/.bashrc  # or ~/.bash_profile

For Zsh (without Oh My Zsh)

  1. Clone zoc to a directory of your choice:
git clone https://github.com/TomerG2/zoc ~/.zoc
  1. Add to your ~/.zshrc:
source ~/.zoc/zoc.sh
  1. 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)

  1. Go to Actions > Release > Run workflow
  2. Enter the same version number used in Phase 1
  3. 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.

About

Small Zsh plugin with aliases and functions to speed up `oc` logins and token renewal.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages