Skip to content
You're viewing an older version of this GitHub Action. Do you want to see the latest version instead?
redhat-actions

GitHub Action

OpenShift Client Installer

v1.2

OpenShift Client Installer

redhat-actions

OpenShift Client Installer

Install the OpenShift Client (oc) into an action runner

Installation

Copy and paste the following snippet into your .yml file.

              

- name: OpenShift Client Installer

uses: redhat-actions/[email protected]

Learn more about this action in redhat-actions/oc-installer

Choose a version

oc-installer

CI checks oc-installer Versions Test Link checker

tag badge license badge size badge

oc-installer installs the OpenShift Client CLI oc onto your GitHub Action runner.

Note that GitHub's Ubuntu Environments come with oc 4.6 installed. So, if you are using one of those environments and do not require a different oc version, this action is not necessary for your workflow.

Once oc is present, use oc-login to log into the cluster and set up a Kubernetes context.

⚠ Note

This action has been superseded by openshift-tools-installer, which can install oc as well as other CLIs. It has support for caching across multiple workflows, and allows inputting semantic version ranges.

This action can still be used, but points to an old download directory which is no longer updated as of December 2020.

Inputs:

The action has one input: oc_version. If not specified, it defaults to latest.

The oc_version can be:

  • latest (the default) to use the latest stable release.
  • An existing oc version. For example, 4.6 or 3.11.173.
    • The version must exist on our public download site. Refer to the download sites for v3 and v4.
    • This type of version is required to use the caching feature.
  • A URL from which to download oc.

Example

Also see this repository's workflows.

 steps:
    - name: Install oc
      uses: redhat-actions/oc-installer@v1
      with:
        oc_version: '4.6'
  # Now, oc is available for the rest of these steps.

Proxy Support

If you need a self-hosted runner to communicate via a proxy server, you can use one of the following methods as described in the GitHub Actions documentation.

  • Configuring a proxy server using environment variables (HTTPS_PROXY, HTTP_PROXY)
  • Using an .env file to set the proxy configuration

How the Cache Works

oc-installer caches the oc executable to avoid downloading the same executable multiple times when running different jobs.

The cache is only enabled when the version input is specified as a semantic version in the task. If the version is latest, or a URL, the cache is not used.

The oc executable will be cached inside the _work/_tool/oc folder.