openshift-vsts icon indicating copy to clipboard operation
openshift-vsts copied to clipboard

Can't run any oc commands - Unable to determine home directory

Open NadijaKozoriz opened this issue 1 year ago • 1 comments

Hi team, I'm trying to implement a pipeline that would create an OC deployment. However, it fails at any oc command. The pipeline example:

name: $(Build.BuildId)

pool: server

trigger: none
    
jobs:
  - job: OC
    pool: oc-pool
    steps:
    - checkout: none
    - task: oc-cmd@3
      inputs:
        connectionType: 'OpenShift Connection Service'
        openshiftService: 'os-connection'
        cmd: 'oc get projects'

No matter what command is I'm getting same result:

Starting: occmd
==============================================================================
Task         : Execute oc command
Description  : OpenShift execute CLI command.
Version      : 3.0.2
Author       : Red Hat
Help         : See [getting started](https://github.com/redhat-developer/openshift-vsts/blob/master/docs/getting-started.md)
==============================================================================
/opt/azure_agents/_work/12/s/.download/oc login --insecure-skip-tls-verify -u *** -p *** https://api.ocp.company.com:6443/
WARNING: Using insecure TLS client config. Setting this option is not supported!

Login successful.

You have access to 10 projects, the list has been suppressed. You can list all projects with 'oc projects'

Using project "default".
##[error]Unable to determine home directory
Finishing: occmd

Apparently first part of command (login) is executed with no problems. But then something happens.

I tried to run oc get projects under same user that is used to run agent and got proper response.

If, however, instead of using oc-cmd I use bash:

- bash: |
    oc login --insecure-skip-tls-verify -u user -p password https://api.ocp.company.com:6443/
    oc get projects

I get expected result

NadijaKozoriz avatar Feb 16 '24 12:02 NadijaKozoriz

@NadijaKozoriz I am facing the same issue, were you able to find a solution ?

emykamal avatar Mar 17 '24 13:03 emykamal