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 On Tue, Dec 19, 2017 at 6:57 AM, Alan Christie < 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> > 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 > > 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 > http://lists.openshift.redhat.com/openshiftmm/listinfo/dev > >
_______________________________________________ dev mailing list dev@lists.openshift.redhat.com http://lists.openshift.redhat.com/openshiftmm/listinfo/dev