OpenShift Jenkins Pipeline is unable to run oc commands

Solution Verified - Updated -

Issue

When running a Jenkins build that performs tasks using the oc tool, the command is failing with the following output:
error: host must be a URL or a host:port pair: "https://[https://api.<cluster-name>.<domain>.local:6443]:443"

Environment

OpenShift 4.x
Jenkins 2.x

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content