Thanks, issue created…

https://github.com/openshift/jenkins-client-plugin/issues/96 
<https://github.com/openshift/jenkins-client-plugin/issues/96>

For now the work-around gets me out of the hole. Cheers.

Alan.

> On 19 Dec 2017, at 14:26, Justin Pierce <jupie...@redhat.com> wrote:
> 
> The plugin tries to simplify namespace handling for the majority of cases. In 
> your particular case, that attempt to help is detrimental. 
> 
> An issue would probably be appreciated. I've copied Gabe, the active 
> maintainer. 
> 
> On Tue, Dec 19, 2017 at 9:20 AM, Alan Christie 
> <achris...@informaticsmatters.com <mailto:achris...@informaticsmatters.com>> 
> wrote:
> Thanks Justin,
> 
> Is it of interest that the plugin’s create() behaves differently to the 
> command-line? It just doesn't _feel_ right. I could create an issue in the 
> client plugin GitHub project if the consensus is that the behaviour is wrong. 
> After all, why does create() care? Its command-line-cousin doesn’t.
> 
> At the moment my work-around (inspecting the namespace) and iterating through 
> the objects feels more pleasant than using raw.
> 
> Alan.
> 
> 
>> On 19 Dec 2017, at 14:09, Justin Pierce <jupie...@redhat.com 
>> <mailto:jupie...@redhat.com>> wrote:
>> 
>> Alan - This might be a use case for the openshift.raw API [1]. It will 
>> simply pass through any arguments you give it. 
>> 
>> Best Regards,
>> Justin
>> [1] https://github.com/openshift/jenkins-client-plugin#i-need-more 
>> <https://github.com/openshift/jenkins-client-plugin#i-need-more>
>> 
>> On Tue, Dec 19, 2017 at 6:57 AM, Alan Christie 
>> <achris...@informaticsmatters.com <mailto:achris...@informaticsmatters.com>> 
>> wrote:
>> I appear to be able to work-around the problem by iterating through the 
>> objects created by the call to process() and conditionally setting the 
>> namespace, i.e. by doing this…
>> 
>>      def objs = openshift.process('—filename=<template-file>’)
>>      for (obj in objs) {
>>              if (obj.metadata.namespace == “X") {
>>                      openshift.create(obj, "—namespace=X")
>>                 } else {
>>                              openshift.create(obj)
>>                      }
>>      }
>>              
>> 
>> But this is not ideal and just creates noise. Ideally I simply want create() 
>> in the pipeline to be able to reproduce create() on the command-line.
>> 
>> 
>> 
>>> On 19 Dec 2017, at 11:26, Alan Christie <achris...@informaticsmatters.com 
>>> <mailto:achris...@informaticsmatters.com>> wrote:
>>> 
>>> Hi guys,
>>> 
>>> I have a template that can be successfully processed and the objects 
>>> created using oc from the command-line. The template is supposed to run in 
>>> one namespace (let’s call it Y) but it creates secrets that are placed in 
>>> another namespace/project (let’s call that X). The namespaces are managed 
>>> the same user. Both namespaces exist and the following command when run on 
>>> the command-line is valid and is successful:
>>> 
>>>     oc process -f <template-file> | oc create -f -
>>> 
>>> The act of processing and creating templates works in the Jenkins pipeline 
>>> except when the template creates objects in different namespaces. When I 
>>> try and reproduce these actions from within a Jenkins pipeline job that is 
>>> using the OpenShift Jenkins Pipeline (DSL) Plugin, i.e. when I do something 
>>> like this…
>>> 
>>>     openshift.withCluster("${CLUSTER}") {
>>>             openshift.withProject(“${Y}") {
>>>                     def objs = 
>>> openshift.process('—filename=<template-file>’)
>>>                     openshift.create(objs)
>>>             }
>>>     }
>>> 
>>> I get the following error reported in the Jenkins Job output:
>>> 
>>>     err=error: the namespace from the provided object “X" does not match 
>>> the namespace “Y". You must pass '—namespace=X' to perform this operation., 
>>> verb=create
>>> 
>>> How do replicate the actions that appear to be legitimate from the 
>>> command-line but using the Pipeline Plugin? Its error does not make sense. 
>>> Instead the plugin appears to assume that the objects created form the 
>>> template must reside in the namespace in which I am running and therefore 
>>> insists on it.
>>> 
>>> Should I raise an issue on the Plugin project?
>>> 
>>>     https://github.com/openshift/jenkins-client-plugin 
>>> <https://github.com/openshift/jenkins-client-plugin>
>>> 
>>> Thank you in advance of any help but, in the meantime I will continue to 
>>> search for a solution.
>>> 
>>> Alan Christie
>>> Informatics Matters
>>> 
>>> 
>> 
>> 
>> _______________________________________________
>> dev mailing list
>> dev@lists.openshift.redhat.com <mailto:dev@lists.openshift.redhat.com>
>> http://lists.openshift.redhat.com/openshiftmm/listinfo/dev 
>> <http://lists.openshift.redhat.com/openshiftmm/listinfo/dev>
>> 
>> 
> 
> 

_______________________________________________
dev mailing list
dev@lists.openshift.redhat.com
http://lists.openshift.redhat.com/openshiftmm/listinfo/dev

Reply via email to