Comments (12)
For a proxy between jenkins and openshift, I believe this falls under: https://wiki.jenkins-ci.org/display/JENKINS/JenkinsBehindProxy
And it lists which plugins support proxies. If I am correct, jenkins-client-plugin will need to be updated. Need to investigate more ... looks like a trello card.
@bparees - thoughts?
Also, just for completeness, while this particular issue would appear to be orthogonal to a proxy between openshift and the internet, per https://docs.openshift.org/latest/install_config/http_proxies.html, I am mentioning it here in case @GolanTrevize10 had not yet read about that and might be affected by it.
from jenkins-client-plugin.
Since the openshift client plugin is ultimately just invoking the oc binary, this is really a question of "how do i use the oc client binary when i need to go through a proxy". For which i don't know the answer but i'd hope that the oc client binary respects the HTTP_PROXY env var, so in theory if you set that var in your jenkins job environment, it should "just work", assuming the shell that we invoke the oc binary in, inherits the job environment.
from jenkins-client-plugin.
from jenkins-client-plugin.
I was also curious as to how exactly these other plugins gained "citation" by jenkins as supporting http proxy (that was part of the card/research)
from jenkins-client-plugin.
But yes, understanding how oc
in general deals with or is immune to (unlikely I suppose) proxies is still fundamentally the question (and the crux of an "research").
from jenkins-client-plugin.
Thanks for your answers. If I run oc client from command line I have to set https_proxy env variable. But in Jenkins it seems it is not working. Does the jenkins client plugin use env variables defined in Jenkins?
from jenkins-client-plugin.
I believe the assumption is the shell provided when org.jenkinsci.plugins.durabletask.BourneShellScript would inherit any env vars defined in Jenkins. But after poking around the durable task plugin some, I'm not so sure.
@jupierce - do you recall any specifics during your initial development?
Perhaps we can look at GlobalVariable
and/or GlobalVariableSet
and explicitly set all name/value pairs on the durable task invocation. I'd want to research that some more before committing to such an approach.
from jenkins-client-plugin.
@gabemontero I would expect oc to be executed in an environment with variables:
(1) Inherited by the Jenkins global configuration for environment variables
(2) Variables set in the Jenkinsfile itself (e.g. env.MY_VARIABLE=5
)
i.e. It should be identical to those available to sh/bat steps.
However, I did not do any testing specific to this area.
from jenkins-client-plugin.
Thanks for the background @jupierce
I've run through a few tests with a debug version of the plugin and a test script to help clarify.
First, when using env.HTTPS_PROXY='foo'
, env.https_proxy='foo'
, env.http_proxy='foo'
, or env.HTTP_PROXY='foo'
, I see the env var processed, and the goproxy code consuming the variable and attempting to leverage the proxy on connection (of course I gave it a bogus URL so it fails):
Caught: hudson.AbortException: Error during describe;
{reference={}, err=Unable to connect to the server: http: error connecting to proxy http://foo: dial tcp: lookup foo: no such host, verb=describe, cmd=oc describe serviceaccount --server=https://172.30.0.1:443 --namespace=myproject --token=XXXXX , out=, status=1}
The same holds if I define those as job parameters and execute the job via "build with parameters"
And the same holds if I define them via 'Manage Jenkins' -> 'Configure Jenkins' -> 'Global Properties' -> 'Environment variables'. The proxy env vars are consumed, and the goproxy code attempts to connect.
So, assuming either HTTPS_PROXY, HTTP_PROXY, https_proxy, or http_proxy is set, we are at the point of needing to debug the actual setting and what if any results from the goproxy connection.
@GolanTrevize10 - could you insert a openshift.loglevel(10)
in your script prior to any other uses of openshift
and provide the output to us? Thanks.
from jenkins-client-plugin.
@GolanTrevize10 - I did some more experimenting with this today. Based on my results, I suspect that there is a difference between the server URL used when running oc
from your command line vs. the server URL used within Jenkins.
I had to change my server URL configuration for the plugin (i.e. create a new cluster like is documented at https://github.com/openshift/jenkins-client-plugin#configuring-an-openshift-cluster ) to something accessible to the proxy. And I had to start openshift with a public hostname accessible to the proxy (i.e. oc cluster up --version=latest --public-hostname=<accessible hostname>
), where that hostname was part of the server url for this plugin's cluster configuration.
Can you compare these items:
- the server URLs used for the command line run of
oc
vs. what is configured for the plugin? - the /etc/hosts on the system for your command line run of
oc
vs. the one for the jenkins pod (oc rsh <jenkins pod name> cat /etc/hosts
should display it) - the /etc/resolv.conf on the system for you command line run of
oc
vs. the one for the jenkins pod (oc rsh <jenkins pod name> cat /etc/resolv.conf
should display it)
I suspect there will be differences that will explain why the behavior is different.
Also, if you could supply the precise error message, that might provide some clues.
thanks
from jenkins-client-plugin.
Hi, even with log level 10 it is not giving more information, so I decided to reinstall Jenkins from scratch and now it is working. I have to set https_proxy variable though. Don't know why it was not working before. However, it would be a good idea to take Jenkins proxy configuration in the plugin
Thanks.
from jenkins-client-plugin.
Glad you can get it running @GolanTrevize10
Yes, currently the setting of either https_proxy, HTTPS_PROXY, http_proxy, HTTP_PROXY, is required.
And with respect to plugins using the proxy setting for the plugin manager Jenkins, there is some debate in the Jenkins community whether that was a good approach. Or at least that plugins should allow that setting to be overridden by env vars in pipeline scripts.
An approach where we inspect the jenkins plugin manager setting if those expected env vars are not present does at least warrant consideration where we explore the pros/cons, etc.
Per my team's process, I have opened https://trello.com/c/lAJ0rmCa/1241-various-jenkins-plugins-inspect-jenkins-plugin-manager-proxy-setting-along-with-env-vars-jenkinsintegration on our trello planning board to track resolution of this request, and am closing this issue out.
Thanks.
from jenkins-client-plugin.
Related Issues (20)
- 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
- stdout and stderr not correctly splited when running with kubernetes plugin
- Future Release Branches Frozen For Merging | branch:release-4.16 branch:release-4.17
- stdout and stderr not correctly splitted when running with kubernetes plugin (2)
- DeploymentConfig is deprecated
- Selector.startBuild() returns non-build objects from stdout and resulting selector sometimes doesn't contain any build object
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.