Comments (8)
So my observation is incorrect. The problem is the arguments to tag
need to be quoted. Should the plugin handle that or do I need to in the pipeline?
Example
openshift.raw("tag",
"\"${openshift.project()}/${env.IMAGE_STREAM_NAME}:${env.GIT_COMMIT}\"",
"\"${openshift.project()}/${env.IMAGE_STREAM_NAME}:${env.VERSION}\"")
from jenkins-client-plugin.
Yeah, I believe it has something to do with the tag args, but the "need to be quoted" doesn't seem right ... perhaps Jenkins is doing something unexpected during the env var substitution, or the last env var has a new line, and the extra quoting somehow mitigates that.
By comparison, I tried this simpler but analogous script:
openshift.withCluster("asdf") {
istag = openshift.selector('istag')
openshift.verbose()
openshift.tag("nodejs-010-centos7:latest", "nodejs-010-centos7:foo")
}
And it puts the insecure flag on the same line:
[Pipeline] _OcAction
Verbose sub-step output:
Command> oc tag nodejs-010-centos7:latest nodejs-010-centos7:foo --insecure-skip-tls-verify --server=https://172.30.0.1:443 --namespace=myproject --loglevel=8 --token=XXXXX
Status> 0
StdOut>Tag nodejs-010-centos7:foo set to nodejs-010-centos7@sha256:bd971b467b08b8dbbbfee26bad80dcaa0110b184e0a8dd6c1b0460a6d6f5d332.
And when I artificially set up some env vars and reference them:
openshift.withCluster("asdf") {
istag = openshift.selector('istag')
script {
env.TAG1 = 'nodejs-010-centos7:latest'
env.TAG2 = 'nodejs-010-centos7:foo'
}
openshift.verbose()
openshift.tag("${env.TAG1}", "${env.TAG2}")
}
it is still single line:
[Pipeline] _OcAction
Verbose sub-step output:
Command> oc tag nodejs-010-centos7:latest nodejs-010-centos7:foo --insecure-skip-tls-verify --server=https://172.30.0.1:443 --namespace=myproject --loglevel=8 --token=XXXXX
Status> 0
StdOut>Tag nodejs-010-centos7:foo set to nodejs-010-centos7@sha256:bd971b467b08b8dbbbfee26bad80dcaa0110b184e0a8dd6c1b0460a6d6f5d332.
@jcpowermac - Can you re-run your test, where prior to the tag operation you attempt to echo your two params on a single line, with some text afterward to confirm, and see if it all displays on 1 line or multiple lines? Again I'm wondering if the specific env var somehow has a new line in it.
thanks
from jenkins-client-plugin.
If it is something related to new line chars, perhaps the plugin should help the user and strip all "\n" and "\r" from supplied args. But short term, certainly that might be something to pursue in the script.
from jenkins-client-plugin.
@gabemontero after I put this issue in I found out that the env.VERSION = readFile('app/VERSION')
had a newline character. I added trim()
yesterday and retested this morning without quotes and its perfectly fine. Interesting that the openshift allowed a newline character in an object name. I had to use skoepo inspect
to find it. Thanks and sorry about the confusion.
from jenkins-client-plugin.
thanks for the confirmation @jcpowermac
glad it is sorted out for you short term
and as I mentioned previously, the plugin probably should look at trimming all args; we did that with the legacy plugin
from jenkins-client-plugin.
btw, I was curious about withCredentials([[$class: 'UsernamePasswordMultiBinding', credentialsId: "registry-api", usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD']])
what you got going on there exactly ?
from jenkins-client-plugin.
@gabemontero the PASSWORD
has a service account token for a remote openshift cluster. I was eventually going to move it to using:
environment {
mycred = credentials('foo')
}
We are syncing the OpenShift secrets to Jenkins via a library until the plugin does that.
from jenkins-client-plugin.
from jenkins-client-plugin.
Related Issues (20)
- Question: What extra steps should i follow if my OCP4 cluster is using a proxy ? HOT 4
- exportable did not work on newer openshift clusters HOT 4
- Stream stdout to console for passthrough operations HOT 5
- Plugin incompatible with new-style clouds configuration. HOT 5
- Error after Warning HOT 7
- Can't get api token from com.openshift.jenkins.plugnis.OpenShiftTokenCredentials in pipeline HOT 5
- List of DSL methods required HOT 3
- Error to parse POM's HOT 4
- 'restart' subcommand is missing for rollout()
- Support current version of oc tool HOT 4
- Plugin installation broke credentials used by other plugins HOT 12
- Argument was classified as an image, image~source, or loaded template reference but should be git repo HOT 7
- Leftover oc processes after wait() calls HOT 7
- Plugin doesn't detect capabilities (--ignore-not-found) from recent OC versions HOT 8
- No credentials shown in cluster configuration dropdown HOT 6
- Job fails if there are spaces in the project name, using raw command HOT 9
- Error flags cannot be placed before plugin name on external Jenkins declarative pipeline HOT 2
- Unable to retrieve object names using kubernetes-plugin sidecar container HOT 5
- java.nio.file.NoSuchFileException after upgrade to 1.0.37 HOT 5
- Certificate options not escaped HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jenkins-client-plugin.