Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-71490

oc raw command fails with "flags cannot be placed before plugin name"

XMLWordPrintable

      After upgrade from 1.0.38 to 1.1.0.413.v3023d27e8434, oc raw command in my job is failing with error "flags cannot be placed before plugin name".

      I need to force delete many objects in my job, and I need to pass these flags to oc: --force --grace-period=0 --ignore-not-found. I use oc raw command for this.

      I call oc in job like this:

      objects = openshift.selector('all,pvc,configmap,secret', ['madeby': 'jenkins-dbo-job', 'deployment': deployment_name)
      openshift.raw(['delete', '--force', '--grace-period=0', '--ignore-not-found'] + objects.names()) 

      In new version, it fails with this error (the names of resources are just for example here):

       ERROR: raw command [delete, --force, --grace-period=0, --ignore-not-found, pod/dbo-ul-460-76bdc65858-vtk8t, service/dbo-ul-460, deployment/dbo-ul-460, replicaset/dbo-ul-460-76bdc65858, route/dbo-ul-460-back, route/dbo-ul-460-front, persistentvolumeclaim/pvc-dbo-dbo-ul-460, configmap/dbo-ul-460-filebeat-conf, configmap/dbo-ul-460-log-cleaner, configmap/dbo-ul-460-nginx-addon-uploads-conf, secret/dbo-ul-460] returned an error;
      
       {err=, verb=, cmd=oc --server=https://10.120.14.1:443 --certificate-authority="/var/run/secrets/kubernetes.io/serviceaccount/ca.crt" --namespace=dbo --token=XXXXX  [delete, --force, --grace-period=0, --ignore-not-found, pod/dbo-ul-460-76bdc65858-vtk8t, service/dbo-ul-460, deployment/dbo-ul-460, replicaset/dbo-ul-460-76bdc65858, route/dbo-ul-460-back, route/dbo-ul-460-front, persistentvolumeclaim/pvc-dbo-dbo-ul-460, configmap/dbo-ul-460-filebeat-conf, configmap/dbo-ul-460-log-cleaner, configmap/dbo-ul-460-nginx-addon-uploads-conf, secret/dbo-ul-460] , out=flags cannot be placed before plugin name: --server=https://10.120.14.1:443
       , status=1}
      

      I run job on top of jnlp image based on jenkins/jenkins:3107.v665000b_51092-5-jdk11, with oc version installed 4.8.11 (latest from okd site)

      Downgrade to 1.0.38 helps.

            jupierce Justin Pierce
            nsmirnov Nikita
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: