Giter VIP home page Giter VIP logo

jenkins-plugin's Issues

NullPointerException at com.openshift.jenkins.plugins.pipeline.OpenShiftCreator.makeRESTCall(OpenShiftCreator.java:96)

`
Started by user admin
Building in workspace /var/lib/jenkins/jobs/2/workspace

Auth authToken len 13
inspectBuildEnvAndOverrideFields class name com.openshift.jenkins.plugins.pipeline.OpenShiftCreator
inspectBuildEnvAndOverrideFields found field jsonyaml with current value {
"apiVersion": "extensions/v1beta1",
"kind": "Job",
"metadata": {
"name": "pi"
},
"spec": {
"selector": {
"matchLabels": {
"app": "pi"
}
},
"parallelism": 1,
"completions": 1,
"template": {
"metadata": {
"name": "pi",
"labels": {
"app": "pi"
}
},
"spec": {
"containers": [
{
"name": "pi",
"image": "perl",
"command": [
"perl",
"-Mbignum=bpi",
"-wle",
"print bpi(2000)"
]
}
],
"restartPolicy": "Never"
}
}
}
}
inspectBuildEnvAndOverrideFields for field jsonyaml got val from build env null
inspectBuildEnvAndOverrideFields found field apiURL with current value https://openshift-master1.livelace.ru
inspectBuildEnvAndOverrideFields for field apiURL got val from build env null
inspectBuildEnvAndOverrideFields found field namespace with current value test
inspectBuildEnvAndOverrideFields for field namespace got val from build env null
inspectBuildEnvAndOverrideFields found field authToken with current value 1111111111111
inspectBuildEnvAndOverrideFields for field authToken got val from build env null
inspectBuildEnvAndOverrideFields found field verbose with current value true
inspectBuildEnvAndOverrideFields for field verbose got val from build env null
inspectBuildEnvAndOverrideFields found field bearerToken with current value com.openshift.restclient.authorization.TokenAuthorizationStrategy@1f
inspectBuildEnvAndOverrideFields found field auth with current value com.openshift.jenkins.plugins.pipeline.Auth@1c9d92bb

BUILD STEP: OpenShiftCreator in perform on namespace test
ERROR: Build step failed with exception
java.lang.NullPointerException
at com.openshift.jenkins.plugins.pipeline.OpenShiftCreator.makeRESTCall(OpenShiftCreator.java:96)
at com.openshift.jenkins.plugins.pipeline.OpenShiftCreator.coreLogic(OpenShiftCreator.java:150)
at com.openshift.jenkins.plugins.pipeline.OpenShiftBaseStep.perform(OpenShiftBaseStep.java:147)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:782)
at hudson.model.Build$BuildExecution.build(Build.java:205)
at hudson.model.Build$BuildExecution.doRun(Build.java:162)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:534)
at hudson.model.Run.execute(Run.java:1738)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:410)
Build step 'Create resource(s) in OpenShift' marked build as failure
Finished: FAILURE
`

Set variables after completed OpenShift Jenkins Build Step

Would be useful if the OpenShift Jenkins plugin could set environment variables after a completed jenkins "Build Step".

For instance after triggering a new build it would be useful if the build instance number/name in OSE or the hash of the resulting image in OpenShift would be available as environment variables in Jenkins.

Similar other "Build Steps" such as "Verify Deployment" could extract information about the resource queried and add these to the environment.

build success but no tag has been created

I use the build step Tag an image in OpenShift

The build is successful but I don't the tag with oc get istag

Here is the log

Started by user Jenkins Admin
Building in workspace /var/lib/jenkins/jobs/foobar-deployer/workspace
Auth - cert file exists



Auth authToken len 1104
inspectBuildEnvAndOverrideFields class name com.openshift.jenkins.plugins.pipeline.OpenShiftImageTagger
inspectBuildEnvAndOverrideFields found field testTag with current value latest
inspectBuildEnvAndOverrideFields for field testTag got val from build env null
inspectBuildEnvAndOverrideFields found field prodTag with current value prod
inspectBuildEnvAndOverrideFields for field prodTag got val from build env null
inspectBuildEnvAndOverrideFields found field apiURL with current value https://<…>:8443
inspectBuildEnvAndOverrideFields for field apiURL got val from build env null
inspectBuildEnvAndOverrideFields found field namespace with current value alep-int
inspectBuildEnvAndOverrideFields for field namespace got val from build env null
inspectBuildEnvAndOverrideFields found field authToken with current value ZXlKaGJHY2lP<...>
inspectBuildEnvAndOverrideFields for field authToken got val from build env null
inspectBuildEnvAndOverrideFields found field verbose with current value true
inspectBuildEnvAndOverrideFields for field verbose got val from build env null
inspectBuildEnvAndOverrideFields found field bearerToken with current value com.openshift.restclient.authorization.TokenAuthorizationStrategy@350c8b87
inspectBuildEnvAndOverrideFields found field auth with current value com.openshift.jenkins.plugins.pipeline.Auth@7cb78f44


BUILD STEP:  OpenShiftImageTagger in perform on namespace foobar-int


BUILD STEP EXIT:  OpenShiftImageTagger image stream now has tags: latest, prod
Finished: SUCCESS

Add support for "Delete OpenShift Resource(s)"

At the moment there is support for creating resources in the plugin (oc create -f), but there is no support for deleting resources (oc delete -f).
It would be nice to have this command also available.

Can't delete objects by labels

I tried to delete this deployment configuration:

apiVersion: "v1"
kind: "DeploymentConfig"
metadata:
name: "test"
spec:
template:
metadata:
labels:
name: "test"

With Jenkins step:

The type(s) of OpenShift resource(s) to delete: DeploymentConfig
The key(s) of labels on the OpenShift resource(s) to delete: name
The value(s) of labels on the OpenShift resource(s) to delete: test

Logs:

Exiting "Delete OpenShift Resource(s) using Labels" successfully, with 0 resource(s) deleted.
Finished: SUCCESS

Make methods easier to call from Jenkinsfile pipeline build

Most steps in a Jenkinsfile take named parameters and use a syntax that is very readable. See the following examples:

https://github.com/jenkinsci/pipeline-plugin/blob/master/TUTORIAL.md#understanding-syntax

Is it possible to make it that easy to call OpenShift plugin methods? Today the calls are verbose.

node('agent') {
stage 'build'
def builder = new com.openshift.jenkins.plugins.pipeline.OpenShiftBuilder("", "ruby-sample-build", "myproject", "", "", "", "", "true", "", "")
step builder
stage 'deploy'
def deployer = new com.openshift.jenkins.plugins.pipeline.OpenShiftDeployer("","frontend","myproject","","")
step deployer
}

I want to write something like this

openShiftBuilder buildConfig: 'ruby-sample-build', namespace: 'myproject'

with appropriate defaults for params I leave out. Since end users will need to write Jenkinsfiles, we should make it as easy as possible.

@bparees @gabemontero @sspeiche @jwforres

Build trigger fails waiting for logs

this is the jenkins console output. @bparees to provide color.

OpenShift Build myproject/sample-pipeline-1
[Pipeline] node
Still waiting to schedule task
584400d9638 is offline
Running on 6a00e94b7c7 in /tmp/workspace/sample-pipeline
[Pipeline] {
[Pipeline] stage (build)
Entering stage build
Proceeding
[Pipeline] openshiftBuild


Starting the "Trigger OpenShift Build" step with build config "ruby-sample-build" from the project "myproject".
  Started build "ruby-sample-build-1" and waiting for build completion ...


Exiting "Trigger OpenShift Build" unsuccessfully; build "ruby-sample-build-1" has completed with status:  [null].
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
ERROR: "Trigger OpenShift Build" failed
Finished: FAILURE

OpenShiftCreator assumes /oapi/v1 endpoints

OpenShiftCreator.java sets up the target URL endpoint using a /oapi/vi/ path string:

url = new URL(apiURL + "/oapi/v1/namespaces/" + namespace + "/" + path + "s");

However, when parsing a JSON List that contains a "Service" item, this undefined endpoint cannot be resolved (404) using /oapi/v1/namespaces/[namespace]/services (OpenShift).

The endpoint can be resolved using the Kubernetes (/api/v1) API endpoint: /api/v1/namespaces/[namespace]/services

Question..

Should there be a 'services' endpoint exposed in oapi/v1 or should this code use the api/v1 endpoint for "Service" requests?

Build stage runs for a long time, marked successful after build fails

ruby-sample-build-4 was kicked off by sample-pipeline-4. The s2i build failed after one second, but the pipeline stage ran for ~5 minutes.

openshift_web_console

Much later the pipeline stage was marked as successful even when the build failed.

openshift_web_console

Here is how I'm running the build from my Jenkinsfile

  final project = 'myproject'
  final bc = 'ruby-sample-build'
  final dc = 'frontend'

  stage 'Build'
  def builder = new com.openshift.jenkins.plugins.pipeline.OpenShiftBuilder("", bc, project, "", "", "", "", "true", "", "")
  step builder

I can see the build was failed in the Jenkins log.

Exiting "Trigger OpenShift Build" unsuccessfully; build "ruby-sample-build-4" has completed with status: [Failed].

@gabemontero Will the DSL changes correctly mark the stage as failed when the build fails? https://trello.com/c/jOEuMkze

/cc @bparees @jwforres

FR: Command execution inside specific pod

Hello. What I need in my QA work:

Workflow:

  1. Build image.
  2. Deploy replication controllers with services (HTTP, FTP, SMTP etc.)
  3. Run specific Pod with my application inside. I want to exec commands inside this Pod, which will be test my application for establishing a connection with services (step 2). And pipe output back to jenkins.

Maybe execution should be attached to Pod labels and execute command on bunch of Pods.

Pipeline DSL documentation

The documentation for the new Jenkins 2.x documentation is all over the place.

There is this blog post, which is now wrong and outdated: https://blog.openshift.com/pipelines-with-jenkins-2-on-openshift/

This lists bldCfg as the parameter for openshiftBuild but your README references buildConfig
https://jenkins.io/doc/pipeline/steps/openshift-pipeline/

Which one is correct?

In the RedHat OpenShift Workshop it says the best practice is to build the image then run your tests inside the image to control for environment changes, and the workshop shows that process with the OpenShift plugin running in Jenkins 1.x not using pipelines but I see no way to do that with the new 2.x pipeline DSL

Is there any good examples or documentation to how to best apply the OpenShift specific DSL?

FR: Support for cross-project tag

Subject. At this moment we can create new tag inside one project but can't do this between projects. Use case: dedicated projects for building images.

Builds are end with timeout error

See http://openshift-master1.i.drweb.ru:8080/job/images/job/base/76/


Started by upstream project "images/base-meta" build number 25
originally caused by:
Started by user admin
Running as admin
[EnvInject] - Loading node environment variables.
Building remotely on openshift-node2 in workspace http://openshift-master1.i.drweb.ru:8080/job/images/job/base/ws/

Starting the "Trigger OpenShift Build" step with build config "ubuntu-base" from the project "images".
Started build "ubuntu-base-36" and waiting for build completion followed by a new deployment ...
ERROR: Build step failed with exception
com.openshift.internal.restclient.http.HttpClientException: {"kind":"Status","apiVersion":"v1","metadata":{},"status":"Failure","message":"Timeout: timed out waiting for build ubuntu-base-36 to start after 10s","reason":"Timeout","details":{"retryAfterSeconds":1},"code":504}

at com.openshift.internal.restclient.http.UrlConnectionHttpClient.createException(UrlConnectionHttpClient.java:278)
at com.openshift.internal.restclient.http.UrlConnectionHttpClient.request(UrlConnectionHttpClient.java:211)
at com.openshift.internal.restclient.http.UrlConnectionHttpClient.request(UrlConnectionHttpClient.java:187)
at com.openshift.internal.restclient.http.UrlConnectionHttpClient.get(UrlConnectionHttpClient.java:149)
at com.openshift.jenkins.plugins.pipeline.model.IOpenShiftBuilder.dumpLogs(IOpenShiftBuilder.java:173)
at com.openshift.jenkins.plugins.pipeline.model.IOpenShiftBuilder.waitOnBuild(IOpenShiftBuilder.java:121)
at com.openshift.jenkins.plugins.pipeline.model.IOpenShiftBuilder.coreLogic(IOpenShiftBuilder.java:270)
at com.openshift.jenkins.plugins.pipeline.model.IOpenShiftPlugin.doItCore(IOpenShiftPlugin.java:241)
at com.openshift.jenkins.plugins.pipeline.model.IOpenShiftPlugin.doIt(IOpenShiftPlugin.java:254)
at com.openshift.jenkins.plugins.pipeline.OpenShiftBaseStep.perform(OpenShiftBaseStep.java:91)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:782)
at hudson.model.Build$BuildExecution.build(Build.java:205)
at hudson.model.Build$BuildExecution.doRun(Build.java:162)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:534)
at hudson.model.Run.execute(Run.java:1738)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:410)

Caused by: java.io.IOException: Server returned HTTP response code: 504 for URL: https://openshift-master1.i.drweb.ru:8443/oapi/v1/namespaces/images/builds/ubuntu-base-36/log
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1840)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1441)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:254)
at com.openshift.internal.restclient.http.UrlConnectionHttpClient.request(UrlConnectionHttpClient.java:207)
... 17 more
Build step 'Trigger OpenShift Build' marked build as failure

OpenShiftDeploymentVerifier build step fails with false positive.

I have a build job with a OpenShiftDeploymentVerifier build step. It is configured to verify if there is one pod running after build set. Even though I have one pod running this steps fails hence, my build job fails.

For this test following image has been used.
docker.io/openshift/jenkins-1-centos7 latest 212bac2225d0 6 days ago 655.4 MB

Below you can find the relevant log extract.

OpenShiftDeploymentVerifier rc current count 1 rc desired count 1 step verification amount 1 current state Running
Auth - allowCertificate with incoming chain of len 2
Auth - allowCertificate returning true

OpenShiftDeploymentVerifier latest version: 19
Auth - allowCertificate with incoming chain of len 2
Auth - allowCertificate returning true

OpenShiftDeploymentVerifier current rc {
"kind" : "ReplicationController",
"apiVersion" : "v1",
"metadata" : {
"name" : "cakephp-example-19",
"namespace" : "xyz",
"selfLink" : "/api/v1/namespaces/xyz/replicationcontrollers/cakephp-example-19",
"uid" : "49a7a46a-af9e-11e5-8b2c-fa163ef5b9d0",
"resourceVersion" : "4043011",
"generation" : 2,
"creationTimestamp" : "2015-12-31T09:10:08Z",
"labels" : {
"openshift.io/deployment-config.name" : "cakephp-example",
"template" : "cakephp-example"
},
"annotations" : {
"kubectl.kubernetes.io/desired-replicas" : "0",
"kubectl.kubernetes.io/update-source-id" : "cakephp-example-1:fb35e105-ae32-11e5-8b2c-fa163ef5b9d0",
"openshift.io/deployer-pod.name" : "cakephp-example-19-deploy",
"openshift.io/deployment-config.latest-version" : "19",
"openshift.io/deployment-config.name" : "cakephp-example",
"openshift.io/deployment.phase" : "Running",
"openshift.io/encoded-deployment-config" : "{"kind":"DeploymentConfig","apiVersion":"v1","metadata":{"name":"cakephp-example","namespace":"xyz","selfLink":"/oapi/v1/namespaces/xyz/deploymentconfigs/cakephp-example","uid":"3833352c-ae32-11e5-8b2c-fa163ef5b9d0","resourceVersion":"4042975","creationTimestamp":"2015-12-29T13:44:01Z","labels":{"template":"cakephp-example"},"annotations":{"description":"Defines how to deploy the application server"}},"spec":{"strategy":{"type":"Rolling","rollingParams":{"updatePeriodSeconds":1,"intervalSeconds":1,"timeoutSeconds":600,"maxUnavailable":"25%","maxSurge":"25%"},"resources":{}},"triggers":[{"type":"ImageChange","imageChangeParams":{"automatic":true,"containerNames":["cakephp-example"],"from":{"kind":"ImageStreamTag","name":"cakephp-example:latest"},"lastTriggeredImage":"172.30.209.107:5000/xyz/cakephp-example@sha256:0a8132be3ff05f61d47bf5751b6dd1cb38054f7b208cfe6442821e3651f71cac"}},{"type":"ConfigChange"}],"replicas":1,"selector":{"name":"cakephp-example"},"template":{"metadata":{"name":"cakephp-example","creationTimestamp":null,"labels":{"name":"cakephp-example"}},"spec":{"containers":[{"name":"cakephp-example","image":"172.30.209.107:5000/xyz/cakephp-example@sha256:0a8132be3ff05f61d47bf5751b6dd1cb38054f7b208cfe6442821e3651f71cac","ports":[{"containerPort":8080,"protocol":"TCP"}],"env":[{"name":"DATABASE_SERVICE_NAME"},{"name":"DATABASE_ENGINE"},{"name":"DATABASE_NAME"},{"name":"DATABASE_USER"},{"name":"DATABASE_PASSWORD"},{"name":"CAKEPHP_SECRET_TOKEN","value":"H3N7w8isnMAK6eNeTG8wSU7Fu3xoD6wbmWVEUZ68WkeVKNsrtU"},{"name":"CAKEPHP_SECURITY_SALT","value":"seE36hj8kjfTtKmAeVs8qvtcv2BBQl2sAPmkDwwY"},{"name":"CAKEPHP_SECURITY_CIPHER_SEED","value":"368014367837282015085010621150"},{"name":"OPCACHE_REVALIDATE_FREQ","value":"2"}],"resources":{},"terminationMessagePath":"/dev/termination-log","imagePullPolicy":"IfNotPresent"}],"restartPolicy":"Always","terminationGracePeriodSeconds":30,"dnsPolicy":"ClusterFirst","securityContext":{}}}},"status":{"latestVersion":19,"details":{"causes":[{"type":"ImageChange","imageTrigger":{"from":{"kind":"DockerImage","name":"172.30.209.107:5000/xyz/cakephp-example:latest"}}}]}}}\n"
}
},
"spec" : {
"replicas" : 1,
"selector" : {
"deployment" : "cakephp-example-19",
"deploymentconfig" : "cakephp-example",
"name" : "cakephp-example"
},
"template" : {
"metadata" : {
"labels" : {
"deployment" : "cakephp-example-19",
"deploymentconfig" : "cakephp-example",
"name" : "cakephp-example"
},
"annotations" : {
"openshift.io/deployment-config.latest-version" : "19",
"openshift.io/deployment-config.name" : "cakephp-example",
"openshift.io/deployment.name" : "cakephp-example-19"
}
},
"spec" : {
"containers" : [{
"name" : "cakephp-example",
"image" : "172.30.209.107:5000/xyz/cakephp-example@sha256:0a8132be3ff05f61d47bf5751b6dd1cb38054f7b208cfe6442821e3651f71cac",
"ports" : [{
"containerPort" : 8080,
"protocol" : "TCP"
}],
"env" : [
{"name" : "DATABASE_SERVICE_NAME"},
{"name" : "DATABASE_ENGINE"},
{"name" : "DATABASE_NAME"},
{"name" : "DATABASE_USER"},
{"name" : "DATABASE_PASSWORD"},
{
"name" : "CAKEPHP_SECRET_TOKEN",
"value" : "H3N7w8isnMAK6eNeTG8wSU7Fu3xoD6wbmWVEUZ68WkeVKNsrtU"
},
{
"name" : "CAKEPHP_SECURITY_SALT",
"value" : "seE36hj8kjfTtKmAeVs8qvtcv2BBQl2sAPmkDwwY"
},
{
"name" : "CAKEPHP_SECURITY_CIPHER_SEED",
"value" : "368014367837282015085010621150"
},
{
"name" : "OPCACHE_REVALIDATE_FREQ",
"value" : "2"
}
],
"terminationMessagePath" : "/dev/termination-log",
"imagePullPolicy" : "IfNotPresent"
}],
"restartPolicy" : "Always",
"terminationGracePeriodSeconds" : 30,
"dnsPolicy" : "ClusterFirst"
}
}
},
"status" : {
"replicas" : 1,
"observedGeneration" : 2
}
}

OpenShiftDeploymentVerifier rc current count 1 rc desired count 1 step verification amount 1 current state Running
Auth - allowCertificate with incoming chain of len 2
Auth - allowCertificate returning true

OpenShiftDeploymentVerifier latest version: 19
Auth - allowCertificate with incoming chain of len 2
Auth - allowCertificate returning true

OpenShiftDeploymentVerifier current rc {
"kind" : "ReplicationController",
"apiVersion" : "v1",
"metadata" : {
"name" : "cakephp-example-19",
"namespace" : "xyz",
"selfLink" : "/api/v1/namespaces/xyz/replicationcontrollers/cakephp-example-19",
"uid" : "49a7a46a-af9e-11e5-8b2c-fa163ef5b9d0",
"resourceVersion" : "4043020",
"generation" : 3,
"creationTimestamp" : "2015-12-31T09:10:08Z",
"labels" : {
"openshift.io/deployment-config.name" : "cakephp-example",
"template" : "cakephp-example"
},
"annotations" : {
"kubectl.kubernetes.io/desired-replicas" : "0",
"kubectl.kubernetes.io/update-source-id" : "cakephp-example-1:fb35e105-ae32-11e5-8b2c-fa163ef5b9d0",
"openshift.io/deployer-pod.name" : "cakephp-example-19-deploy",
"openshift.io/deployment-config.latest-version" : "19",
"openshift.io/deployment-config.name" : "cakephp-example",
"openshift.io/deployment.phase" : "Failed",
"openshift.io/encoded-deployment-config" : "{"kind":"DeploymentConfig","apiVersion":"v1","metadata":{"name":"cakephp-example","namespace":"xyz","selfLink":"/oapi/v1/namespaces/xyz/deploymentconfigs/cakephp-example","uid":"3833352c-ae32-11e5-8b2c-fa163ef5b9d0","resourceVersion":"4042975","creationTimestamp":"2015-12-29T13:44:01Z","labels":{"template":"cakephp-example"},"annotations":{"description":"Defines how to deploy the application server"}},"spec":{"strategy":{"type":"Rolling","rollingParams":{"updatePeriodSeconds":1,"intervalSeconds":1,"timeoutSeconds":600,"maxUnavailable":"25%","maxSurge":"25%"},"resources":{}},"triggers":[{"type":"ImageChange","imageChangeParams":{"automatic":true,"containerNames":["cakephp-example"],"from":{"kind":"ImageStreamTag","name":"cakephp-example:latest"},"lastTriggeredImage":"172.30.209.107:5000/xyz/cakephp-example@sha256:0a8132be3ff05f61d47bf5751b6dd1cb38054f7b208cfe6442821e3651f71cac"}},{"type":"ConfigChange"}],"replicas":1,"selector":{"name":"cakephp-example"},"template":{"metadata":{"name":"cakephp-example","creationTimestamp":null,"labels":{"name":"cakephp-example"}},"spec":{"containers":[{"name":"cakephp-example","image":"172.30.209.107:5000/xyz/cakephp-example@sha256:0a8132be3ff05f61d47bf5751b6dd1cb38054f7b208cfe6442821e3651f71cac","ports":[{"containerPort":8080,"protocol":"TCP"}],"env":[{"name":"DATABASE_SERVICE_NAME"},{"name":"DATABASE_ENGINE"},{"name":"DATABASE_NAME"},{"name":"DATABASE_USER"},{"name":"DATABASE_PASSWORD"},{"name":"CAKEPHP_SECRET_TOKEN","value":"H3N7w8isnMAK6eNeTG8wSU7Fu3xoD6wbmWVEUZ68WkeVKNsrtU"},{"name":"CAKEPHP_SECURITY_SALT","value":"seE36hj8kjfTtKmAeVs8qvtcv2BBQl2sAPmkDwwY"},{"name":"CAKEPHP_SECURITY_CIPHER_SEED","value":"368014367837282015085010621150"},{"name":"OPCACHE_REVALIDATE_FREQ","value":"2"}],"resources":{},"terminationMessagePath":"/dev/termination-log","imagePullPolicy":"IfNotPresent"}],"restartPolicy":"Always","terminationGracePeriodSeconds":30,"dnsPolicy":"ClusterFirst","securityContext":{}}}},"status":{"latestVersion":19,"details":{"causes":[{"type":"ImageChange","imageTrigger":{"from":{"kind":"DockerImage","name":"172.30.209.107:5000/xyz/cakephp-example:latest"}}}]}}}\n"
}
},
"spec" : {
"replicas" : 0,
"selector" : {
"deployment" : "cakephp-example-19",
"deploymentconfig" : "cakephp-example",
"name" : "cakephp-example"
},
"template" : {
"metadata" : {
"labels" : {
"deployment" : "cakephp-example-19",
"deploymentconfig" : "cakephp-example",
"name" : "cakephp-example"
},
"annotations" : {
"openshift.io/deployment-config.latest-version" : "19",
"openshift.io/deployment-config.name" : "cakephp-example",
"openshift.io/deployment.name" : "cakephp-example-19"
}
},
"spec" : {
"containers" : [{
"name" : "cakephp-example",
"image" : "172.30.209.107:5000/xyz/cakephp-example@sha256:0a8132be3ff05f61d47bf5751b6dd1cb38054f7b208cfe6442821e3651f71cac",
"ports" : [{
"containerPort" : 8080,
"protocol" : "TCP"
}],
"env" : [
{"name" : "DATABASE_SERVICE_NAME"},
{"name" : "DATABASE_ENGINE"},
{"name" : "DATABASE_NAME"},
{"name" : "DATABASE_USER"},
{"name" : "DATABASE_PASSWORD"},
{
"name" : "CAKEPHP_SECRET_TOKEN",
"value" : "H3N7w8isnMAK6eNeTG8wSU7Fu3xoD6wbmWVEUZ68WkeVKNsrtU"
},
{
"name" : "CAKEPHP_SECURITY_SALT",
"value" : "seE36hj8kjfTtKmAeVs8qvtcv2BBQl2sAPmkDwwY"
},
{
"name" : "CAKEPHP_SECURITY_CIPHER_SEED",
"value" : "368014367837282015085010621150"
},
{
"name" : "OPCACHE_REVALIDATE_FREQ",
"value" : "2"
}
],
"terminationMessagePath" : "/dev/termination-log",
"imagePullPolicy" : "IfNotPresent"
}],
"restartPolicy" : "Always",
"terminationGracePeriodSeconds" : 30,
"dnsPolicy" : "ClusterFirst"
}
}
},
"status" : {
"replicas" : 0,
"observedGeneration" : 3
}
}

BUILD STEP EXIT: OpenShiftDeploymentVerifier deployment cakephp-example-19 failed
Build step 'Check Deployment Success in OpenShift' marked build as failure

Finished: FAILURE

Add option to ignore SSL errors

I tried using these plugins for Dev -> Test -> Prod process flow. They fail if the OSE cluster has self signed certs. It would be fixed eg. by having checkbox to pass "--insecure-skip-tls-verify" option to oc command in each plugin.

"As a user, I would like to have option to ignore SSL errors in each plugin."

ERROR: Build step failed with exception
com.openshift.restclient.OpenShiftException: javax.net.ssl.SSLHandshakeException while trying to get an authorization context for server https://xxx.ose-demo.xxxxdemo.com:8443

Doesn't detect build error before expiry timeout

What happen:

  1. Set global timeout - 3 hours.
  2. Launch build.
  3. The build ended with error.
  4. Jenkins is waiting 3 hours, to detect error.

Can we detect errors at once, don't wait timeout expiration ?

[jenkins workflow] NPE OpenShiftBuilder.inspectBuildEnvAndOverrideFields(OpenShiftBuilder.java:110)

Using plugin v1.0.3

I've got a simple workflow however one thing I noticed is that in the help it suggested an API server name of https://openshift.default.svc.cluster.local where as I dont have an openshift service but a kubernetes one instead, I'm using OpenShift Origin v1.1.0.1

node ('kubernetes'){

  step([$class: 'com.openshift.jenkins.plugins.pipeline.OpenShiftBuilder', apiURL:'https://kubernetes.default', bldCfg:'node-app', namespace:'default', authToken:'blahblah', verbose:'true', commitID:'', buildName:'', showBuildLogs:'true'])

}

which throws this error when run..

Started by user anonymous
[Workflow] Allocate node : Start
Running on 1e01b838afcd5 in /home/jenkins/workspace/workspace/s2i-build
[Workflow] node {
[Workflow] step
[Workflow] } //node
[Workflow] Allocate node : End
[Workflow] End of Workflow
java.lang.NullPointerException
    at com.openshift.jenkins.plugins.pipeline.OpenShiftBuilder.inspectBuildEnvAndOverrideFields(OpenShiftBuilder.java:110)
    at com.openshift.jenkins.plugins.pipeline.OpenShiftBuilder.coreBuildLogic(OpenShiftBuilder.java:168)
    at com.openshift.jenkins.plugins.pipeline.OpenShiftBuilder.perform(OpenShiftBuilder.java:404)
    at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:68)
    at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:59)
    at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1$1.call(AbstractSynchronousNonBlockingStepExecution.java:49)
    at hudson.security.ACL.impersonate(ACL.java:213)
    at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1.run(AbstractSynchronousNonBlockingStepExecution.java:47)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Finished: FAILURE

NullPointerException in com.openshift.jenkins.plugins.pipeline.Auth.allowCertificate(Auth.java:86)

Started by user ha:AAAAlx+LCAAAAAAAAP9b85aBtbiIQTGjNKU4P08vOT+vOD8nVc83PyU1x6OyILUoJzMv2y+/JJUBAhiZGBgqihhk0NSjKDWzXb3RdlLBUSYGJk8GtpzUvPSSDB8G5tKinBIGIZ+sxLJE/ZzEvHT94JKizLx0a6BxUmjGOUNodHsLgAzeEgZu/dLi1CL9xJTczDwACG0V4sAAAAA=Jenkins Admin
Building in workspace /var/lib/jenkins/jobs/OpenShift Sample/workspace

BUILD STEP: OpenShiftScaler in perform for frontend wanting to get to replica count 0 on namespace test
ERROR: Build step failed with exception
ha:AAAAWB+LCAAAAAAAAP9b85aBtbiIQSmjNKU4P08vOT+vOD8nVc8DzHWtSE4tKMnMz/PLL0ldFVf2c+b/lb5MDAwVRQxSaBqcITRIIQMEMIIUFgAAckCEiWAAAAA=com.openshift.restclient.OpenShiftException: Could not get resource frontend in namespace test: javax.net.ssl.SSLException: java.lang.NullPointerException
at com.openshift.internal.restclient.DefaultClient.createOpenShiftException(DefaultClient.java:480)
at com.openshift.internal.restclient.DefaultClient.get(DefaultClient.java:303)
at com.openshift.jenkins.plugins.pipeline.OpenShiftScaler.coreLogic(OpenShiftScaler.java:74)
at com.openshift.jenkins.plugins.pipeline.OpenShiftBaseStep.perform(OpenShiftBaseStep.java:143)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:785)
at hudson.model.Build$BuildExecution.build(Build.java:205)
at hudson.model.Build$BuildExecution.doRun(Build.java:162)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:537)
at hudson.model.Run.execute(Run.java:1741)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:408)
Caused by: com.openshift.internal.restclient.http.HttpClientException: javax.net.ssl.SSLException: java.lang.NullPointerException
at com.openshift.internal.restclient.http.UrlConnectionHttpClient.createException(UrlConnectionHttpClient.java:230)
at com.openshift.internal.restclient.http.UrlConnectionHttpClient.request(UrlConnectionHttpClient.java:161)
at com.openshift.internal.restclient.http.UrlConnectionHttpClient.request(UrlConnectionHttpClient.java:140)
at com.openshift.internal.restclient.http.UrlConnectionHttpClient.get(UrlConnectionHttpClient.java:102)
at com.openshift.internal.restclient.DefaultClient.getVersion(DefaultClient.java:371)
at com.openshift.internal.restclient.DefaultClient.getOpenShiftVersions(DefaultClient.java:345)
at com.openshift.internal.restclient.DefaultClient.getOpenShiftAPIVersion(DefaultClient.java:361)
at com.openshift.internal.restclient.DefaultClient.getTypeMappings(DefaultClient.java:405)
at com.openshift.internal.restclient.DefaultClient.getTypeMappings(DefaultClient.java:400)
at com.openshift.internal.restclient.DefaultClient.get(DefaultClient.java:294)
... 11 more
Caused by: javax.net.ssl.SSLException: java.lang.NullPointerException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
at sun.net.www.protocol.http.HttpURLConnection$10.run(HttpURLConnection.java:1890)
at sun.net.www.protocol.http.HttpURLConnection$10.run(HttpURLConnection.java:1885)
at java.security.AccessController.doPrivileged(Native Method)
at sun.net.www.protocol.http.HttpURLConnection.getChainedException(HttpURLConnection.java:1884)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1457)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1441)
at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:480)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:338)
at com.openshift.internal.restclient.http.UrlConnectionHttpClient.createException(UrlConnectionHttpClient.java:213)
... 20 more
Caused by: javax.net.ssl.SSLException: java.lang.NullPointerException
at sun.security.ssl.Alerts.getSSLException(Alerts.java:208)
at sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1949)
at sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1906)
at sun.security.ssl.SSLSocketImpl.handleException(SSLSocketImpl.java:1889)
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1410)
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1387)
at sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:559)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:185)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1513)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1441)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:254)
at com.openshift.internal.restclient.http.UrlConnectionHttpClient.request(UrlConnectionHttpClient.java:157)
... 19 more
Caused by: java.lang.NullPointerException
at com.openshift.jenkins.plugins.pipeline.Auth.allowCertificate(Auth.java:86)
at com.openshift.internal.restclient.http.UrlConnectionHttpClient$CallbackTrustManager.checkServerTrusted(UrlConnectionHttpClient.java:449)
at sun.security.ssl.AbstractTrustManagerWrapper.checkServerTrusted(SSLContextImpl.java:922)
at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1491)
at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:216)
at sun.security.ssl.Handshaker.processLoop(Handshaker.java:979)
at sun.security.ssl.Handshaker.process_record(Handshaker.java:914)
at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1062)
at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1375)
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1403)
... 26 more
Build step 'Scale deployments in OpenShift' marked build as failure
Finished: FAILURE

Concurrent builds with differing parameters from environment variables are not possible

When a build is started with an OpenShift build step, it reads the parameters assigned in the job configuration. Then, it checks to see if any of the values correspond to environment variables. If they do, it uses the values of the environment variables instead of the value in the job config. This is all fine. The problem is that the way it does this is to actually change the values in the job configuration itself, run the build step, and then change them back. As a side effect, attempting to run the same build multiple times concurrently (or, sometimes, just multiple times sequentially with minimal delay between them) with differing values for the environment variables will result in the build step using the first parameters twice.

To illustrate the issue, here is a build step:

before a build

And here is that same build step during a build:

during a build

Any additional builds invoked while the first build is in progress will get those values, rather than the ones passed as parameters.

BuildConfig field for 'Perform builds in OpenShift' build step in Jenkins configure Job form is populated with default value of 'frontend' instead of actual stored value.

Description of problem:

Jenkins job configuration page doesn't present the actual value stored for buildConfig field of a 'Perform builds in OpenShift' build step.

Version-Release number of selected component (if applicable):
OSE v3.1

docker.io/openshift/jenkins-1-centos7 latest 212bac2225d0 6 days ago 655.4 MB

How reproducible:

  • Create a Jenkins Build Job with 'Perform builds in OpenShift'
  • Set BuildConfig value other than 'frontend' and save the build job
  • Click on Configure job link.

Actual results:

BuilConfig filed will be populated with 'frontend' value

Expected results:

BuildConfig form field populated with the actual value

Additional info:

Builds using a build config with a different name than 'frontend' is working hence, it is just a form population issue.

Does not detect build failure ?

 ---> 6073f754f5be
Removing intermediate container 08ba9ce0ddef
Successfully built 6073f754f5be
I0719 05:35:47.252709       1 docker.go:118] Pushing image 172.30.208.158:5000/images/ready-drweb-fss-samba-3.4.0-rpm:11.0 ...

F0719 05:39:36.462583       1 builder.go:204] Error: build error: Failed to push image: Received unexpected HTTP status: 500 Internal Server Error

Jenkins task stays running. 1.0.21-SNAPSHOT (private-a1131ed0-ec2-user)

UP. Task ended with error according to global build timeout:

Exiting "Trigger OpenShift Build" unsuccessfully; build "ready-11.0-drweb-fss-samba-3.4.0-rpm-8" did not complete successfully within the configured timeout of "7200000" ms; last reported status:  [NotStarted].
ERROR: "Trigger OpenShift Build" failed

FR: The dedicated timeout for deployment verification

@gabemontero

At first, big thanks 👍 "Verify Deployment Configuration" detects the "postStart" failure situation (regardless of the replica counter)! I checked twice!

For now, we need the simple timeout parameter for the verification of deployment. It allows us to control each deployment (deployment in whole + postStart hook) configuration inside complex configuration.

Improve the "oc new-app" build task

Add the possibility to create new resources based on a preinstalled template or image just as you can do with

oc new-app https://github.com/openshift/cakephp-ex.git --template=cakephp-example --name=mycake

The build error at the beginning

Starting "Create OpenShift Resource(s)" with the project "drweb-netcheck".
ERROR: Build step failed with exception
java.lang.NullPointerException: trustManager == null
at okhttp3.OkHttpClient$Builder.sslSocketFactory(OkHttpClient.java:639)
at com.openshift.jenkins.plugins.pipeline.model.IOpenShiftPlugin.httpGet(IOpenShiftPlugin.java:676)
at com.openshift.jenkins.plugins.pipeline.model.IOpenShiftApiObjHandler.fetchApiJsonFromApiServer(IOpenShiftApiObjHandler.java:23)
at com.openshift.jenkins.plugins.pipeline.model.IOpenShiftApiObjHandler.updateApiTypes(IOpenShiftApiObjHandler.java:66)
at com.openshift.jenkins.plugins.pipeline.model.IOpenShiftCreator.coreLogic(IOpenShiftCreator.java:69)
at com.openshift.jenkins.plugins.pipeline.model.IOpenShiftPlugin.doItCore(IOpenShiftPlugin.java:310)
at com.openshift.jenkins.plugins.pipeline.model.IOpenShiftPlugin.doIt(IOpenShiftPlugin.java:323)
at com.openshift.jenkins.plugins.pipeline.OpenShiftBaseStep.perform(OpenShiftBaseStep.java:91)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:782)
at hudson.model.Build$BuildExecution.build(Build.java:205)
at hudson.model.Build$BuildExecution.doRun(Build.java:162)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:534)
at hudson.model.Run.execute(Run.java:1738)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:410)
Build step 'Create OpenShift Resource(s)' marked build as failure

1.0.22-SNAPSHOT (private-8a31bd9b-ec2-user)

FR: Delete objects with confirmation

Case:

  1. We create objects and they are working.
  2. We send command to delete all objects. Not all objects (Pods) can be deleted immediately and some still are working and they are writing data(until their death). But we already reported about deletion and a next Jenkins task begins started, which want that data will not be changed. It's the problem.

Better messages in Jenkins job logs

BUILD STEP: OpenShiftScaler in perform for frontend wanting to get to replica count 0 on namespace test

Should be something like "Scaling deployment 'frontend' in namespace 'test' to 0 replicas"

BUILD STEP EXIT: OpenShiftScaler got the scale request through

Dunno what this means :-)

BUILD STEP: OpenShiftBuilder in perform for ruby-sample-build on namespace test

Should be "Starting build #number for 'ruby-sample-build' in namespace 'test'". Alternatively, when the deployment check is in place we can add " and waiting for deployment to succeed".

BUILD STEP: OpenShiftDeploymentVerifier in perform checking for frontend wanting to confirm we are at least at replica count 0 on namespace test

Should be "Waiting for the 'frontend' to reach number of replicas to be 0"

...
I think we need to cleanup this :-) I think the EXIT steps are not necessary. We should try to be less verbose and don't use something like "OpenShiftDeploymentVerifier" as users (and me) have no idea what that is :-)

Also can we show links to OpenShift console so users can follow the build (to watch logs/cancel/etc)?

tag needs to refer to Image Stream Pull Spec

i think in the change to allow cross project/namespace tags,

it has broken a normal ":promote" type workflow from the ":latest" tag

this change/commented out piece:

https://github.com/openshift/jenkins-plugin/blob/master/src/main/java/com/openshift/jenkins/plugins/pipeline/OpenShiftImageTagger.java#L201

means that if you set up to tag ":latest" with say, ":promote" - you get

$ oc describe is helloworld-mvn

Tag Spec
latest
promote helloworld-mvn:latest

the ":promote" tag should point to the pull spec

promote helloworld-mvn@a01e0a1230c22236fa6d0d03e56356d4ddbef66653b693cee687b80d78673a0c

otherwise promote always equals latest ... not ideal ?

default the namespace for the openshift plugin operations when we're executing in a pipeline that has a namespace associated

Some background from @bparees

just because your pipeline buildconfig is defined in one project, doesn't mean that the builds that pipeline triggers are going to reside in the same project.  So while it might be a nicer default to assume it is, the reality is there will still be cases where people are going cross-namespace.

what you really have is 3 namespaces:

1) namespace where jenkins is running
2) namespace where the pipeline buildconfig is defined
3) namespace(s) where the "real" build(s) are defined

any of which could be the same or different.

Today we behave/default to assume that 1+3 are the same.  You're asking us to assume 2+3 are the same.  Which i agree is a slight improvement for some cases, again assuming it's even technically possible for us to hand that information between the sync plugin and the openshift plugin. Gabe would know more about that.

and from @jimmidyson

The sync plugin already attaches info about the OS build to the
Jenkins build cause so you could get the info from there quite easily.

There is also an internal write up from @siamaksade on his attempts to set up pipeline project with an external jenkins.

Create OpenShift Resource throws exception even when SKIP_TLS=1

The operation succeeds, but an exception is thrown during fetchApiJsonFromApiServer

Logs:

Started by user admin
Building in workspace /var/jenkins_home/workspace/creator
build env vars:  {=, BUILD_DISPLAY_NAME=#1, BUILD_ID=1, BUILD_NUMBER=1, BUILD_TAG=jenkins-creator-1, BUILD_URL=http://localhost:49001/job/creator/1/, CA_CERTIFICATES_JAVA_VERSION=20140324, CLASSPATH=, COPY_REFERENCE_FILE_LOG=/var/jenkins_home/copy_reference_file.log, EXECUTOR_NUMBER=1, HOME=/var/jenkins_home, HOSTNAME=ac60e305051e, HUDSON_HOME=/var/jenkins_home, HUDSON_SERVER_COOKIE=e9cef694bbb24663, HUDSON_URL=http://localhost:49001/, JAVA_DEBIAN_VERSION=8u102-b14.1-1~bpo8+1, JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64, JAVA_VERSION=8u102, JENKINS_HOME=/var/jenkins_home, JENKINS_SERVER_COOKIE=e9cef694bbb24663, JENKINS_SLAVE_AGENT_PORT=50000, JENKINS_UC=https://updates.jenkins.io, JENKINS_URL=http://localhost:49001/, JENKINS_VERSION=2.7.4, JOB_BASE_NAME=creator, JOB_NAME=creator, JOB_URL=http://localhost:49001/job/creator/, LANG=C.UTF-8, NODE_LABELS=master, NODE_NAME=master, PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin, PWD=/, SHLVL=0, SKIP_TLS=1, TERM=xterm, TINI_SHA=fa23d1e20732501c3bb8eeeca423c89ac80ed452, TINI_VERSION=0.9.0, WORKSPACE=/var/jenkins_home/workspace/creator}
computer env vars:  {CA_CERTIFICATES_JAVA_VERSION=20140324, COPY_REFERENCE_FILE_LOG=/var/jenkins_home/copy_reference_file.log, HOME=/var/jenkins_home, HOSTNAME=ac60e305051e, JAVA_DEBIAN_VERSION=8u102-b14.1-1~bpo8+1, JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64, JAVA_VERSION=8u102, JENKINS_HOME=/var/jenkins_home, JENKINS_SLAVE_AGENT_PORT=50000, JENKINS_UC=https://updates.jenkins.io, JENKINS_VERSION=2.7.4, LANG=C.UTF-8, PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin, PWD=/, SHLVL=0, TERM=xterm, TINI_SHA=fa23d1e20732501c3bb8eeeca423c89ac80ed452, TINI_VERSION=0.9.0}
Creating new auth instance with SKIP_TLS=true


OpenShift Pipeline Plugin: env vars for this job:  {=, BUILD_DISPLAY_NAME=#1, BUILD_ID=1, BUILD_NUMBER=1, BUILD_TAG=jenkins-creator-1, BUILD_URL=http://localhost:49001/job/creator/1/, CA_CERTIFICATES_JAVA_VERSION=20140324, CLASSPATH=, COPY_REFERENCE_FILE_LOG=/var/jenkins_home/copy_reference_file.log, EXECUTOR_NUMBER=1, HOME=/var/jenkins_home, HOSTNAME=ac60e305051e, HUDSON_HOME=/var/jenkins_home, HUDSON_SERVER_COOKIE=e9cef694bbb24663, HUDSON_URL=http://localhost:49001/, JAVA_DEBIAN_VERSION=8u102-b14.1-1~bpo8+1, JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64, JAVA_VERSION=8u102, JENKINS_HOME=/var/jenkins_home, JENKINS_SERVER_COOKIE=e9cef694bbb24663, JENKINS_SLAVE_AGENT_PORT=50000, JENKINS_UC=https://updates.jenkins.io, JENKINS_URL=http://localhost:49001/, JENKINS_VERSION=2.7.4, JOB_BASE_NAME=creator, JOB_NAME=creator, JOB_URL=http://localhost:49001/job/creator/, LANG=C.UTF-8, NODE_LABELS=master, NODE_NAME=master, PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin, PWD=/, SHLVL=0, SKIP_TLS=1, TERM=xterm, TINI_SHA=fa23d1e20732501c3bb8eeeca423c89ac80ed452, TINI_VERSION=0.9.0, WORKSPACE=/var/jenkins_home/workspace/creator}


Starting "Create OpenShift Resource(s)" with the project "myproject".
javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
    at sun.security.ssl.Alerts.getSSLException(Alerts.java:192)
    at sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1949)
    at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:302)
    at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:296)
    at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1509)
    at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:216)
    at sun.security.ssl.Handshaker.processLoop(Handshaker.java:979)
    at sun.security.ssl.Handshaker.process_record(Handshaker.java:914)
    at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1062)
    at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1375)
    at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1403)
    at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1387)
    at okhttp3.internal.connection.RealConnection.connectTls(RealConnection.java:241)
    at okhttp3.internal.connection.RealConnection.establishProtocol(RealConnection.java:198)
    at okhttp3.internal.connection.RealConnection.buildConnection(RealConnection.java:174)
    at okhttp3.internal.connection.RealConnection.connect(RealConnection.java:114)
    at okhttp3.internal.connection.StreamAllocation.findConnection(StreamAllocation.java:193)
    at okhttp3.internal.connection.StreamAllocation.findHealthyConnection(StreamAllocation.java:129)
    at okhttp3.internal.connection.StreamAllocation.newStream(StreamAllocation.java:98)
    at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:42)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
    at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:109)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
    at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
    at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:124)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
    at com.openshift.internal.restclient.okhttp.ResponseCodeInterceptor.intercept(ResponseCodeInterceptor.java:54)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
    at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:170)
    at okhttp3.RealCall.execute(RealCall.java:60)
    at com.openshift.jenkins.plugins.pipeline.model.IOpenShiftPlugin.httpGet(IOpenShiftPlugin.java:686)
    at com.openshift.jenkins.plugins.pipeline.model.IOpenShiftApiObjHandler.fetchApiJsonFromApiServer(IOpenShiftApiObjHandler.java:23)
    at com.openshift.jenkins.plugins.pipeline.model.IOpenShiftApiObjHandler.updateApiTypes(IOpenShiftApiObjHandler.java:66)
    at com.openshift.jenkins.plugins.pipeline.model.IOpenShiftCreator.coreLogic(IOpenShiftCreator.java:68)
    at com.openshift.jenkins.plugins.pipeline.model.IOpenShiftPlugin.doItCore(IOpenShiftPlugin.java:309)
    at com.openshift.jenkins.plugins.pipeline.model.IOpenShiftPlugin.doIt(IOpenShiftPlugin.java:322)
    at com.openshift.jenkins.plugins.pipeline.OpenShiftBaseStep.perform(OpenShiftBaseStep.java:91)
    at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
    at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:779)
    at hudson.model.Build$BuildExecution.build(Build.java:205)
    at hudson.model.Build$BuildExecution.doRun(Build.java:162)
    at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:534)
    at hudson.model.Run.execute(Run.java:1741)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
    at hudson.model.ResourceController.execute(ResourceController.java:98)
    at hudson.model.Executor.run(Executor.java:410)
Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
    at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:387)
    at sun.security.validator.PKIXValidator.engineValidate(PKIXValidator.java:292)
    at sun.security.validator.Validator.validate(Validator.java:260)
    at sun.security.ssl.X509TrustManagerImpl.validate(X509TrustManagerImpl.java:324)
    at sun.security.ssl.X509TrustManagerImpl.checkTrusted(X509TrustManagerImpl.java:229)
    at sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:124)
    at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1491)
    ... 46 more
Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
    at sun.security.provider.certpath.SunCertPathBuilder.build(SunCertPathBuilder.java:141)
    at sun.security.provider.certpath.SunCertPathBuilder.engineBuild(SunCertPathBuilder.java:126)
    at java.security.cert.CertPathBuilder.build(CertPathBuilder.java:280)
    at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:382)
    ... 52 more
javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
    at sun.security.ssl.Alerts.getSSLException(Alerts.java:192)
    at sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1949)
    at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:302)
    at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:296)
    at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1509)
    at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:216)
    at sun.security.ssl.Handshaker.processLoop(Handshaker.java:979)
    at sun.security.ssl.Handshaker.process_record(Handshaker.java:914)
    at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1062)
    at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1375)
    at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1403)
    at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1387)
    at okhttp3.internal.connection.RealConnection.connectTls(RealConnection.java:241)
    at okhttp3.internal.connection.RealConnection.establishProtocol(RealConnection.java:198)
    at okhttp3.internal.connection.RealConnection.buildConnection(RealConnection.java:174)
    at okhttp3.internal.connection.RealConnection.connect(RealConnection.java:114)
    at okhttp3.internal.connection.StreamAllocation.findConnection(StreamAllocation.java:193)
    at okhttp3.internal.connection.StreamAllocation.findHealthyConnection(StreamAllocation.java:129)
    at okhttp3.internal.connection.StreamAllocation.newStream(StreamAllocation.java:98)
    at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:42)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
    at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:109)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
    at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
    at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:124)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
    at com.openshift.internal.restclient.okhttp.ResponseCodeInterceptor.intercept(ResponseCodeInterceptor.java:54)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
    at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:170)
    at okhttp3.RealCall.execute(RealCall.java:60)
    at com.openshift.jenkins.plugins.pipeline.model.IOpenShiftPlugin.httpGet(IOpenShiftPlugin.java:686)
    at com.openshift.jenkins.plugins.pipeline.model.IOpenShiftApiObjHandler.fetchApiJsonFromApiServer(IOpenShiftApiObjHandler.java:23)
    at com.openshift.jenkins.plugins.pipeline.model.IOpenShiftApiObjHandler.updateApiTypes(IOpenShiftApiObjHandler.java:67)
    at com.openshift.jenkins.plugins.pipeline.model.IOpenShiftCreator.coreLogic(IOpenShiftCreator.java:68)
    at com.openshift.jenkins.plugins.pipeline.model.IOpenShiftPlugin.doItCore(IOpenShiftPlugin.java:309)
    at com.openshift.jenkins.plugins.pipeline.model.IOpenShiftPlugin.doIt(IOpenShiftPlugin.java:322)
    at com.openshift.jenkins.plugins.pipeline.OpenShiftBaseStep.perform(OpenShiftBaseStep.java:91)
    at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
    at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:779)
    at hudson.model.Build$BuildExecution.build(Build.java:205)
    at hudson.model.Build$BuildExecution.doRun(Build.java:162)
    at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:534)
    at hudson.model.Run.execute(Run.java:1741)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
    at hudson.model.ResourceController.execute(ResourceController.java:98)
    at hudson.model.Executor.run(Executor.java:410)
Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
    at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:387)
    at sun.security.validator.PKIXValidator.engineValidate(PKIXValidator.java:292)
    at sun.security.validator.Validator.validate(Validator.java:260)
    at sun.security.ssl.X509TrustManagerImpl.validate(X509TrustManagerImpl.java:324)
    at sun.security.ssl.X509TrustManagerImpl.checkTrusted(X509TrustManagerImpl.java:229)
    at sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:124)
    at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1491)
    ... 46 more
Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
    at sun.security.provider.certpath.SunCertPathBuilder.build(SunCertPathBuilder.java:141)
    at sun.security.provider.certpath.SunCertPathBuilder.engineBuild(SunCertPathBuilder.java:126)
    at java.security.cert.CertPathBuilder.build(CertPathBuilder.java:280)
    at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:382)
    ... 52 more

OpenShiftCreator calling create on for type imagestreams and resource {
    "apiVersion" : "v1",
    "kind" : "ImageStream",
    "metadata" : {"name" : "c1"},
    "spec" : {"tags" : [{
        "from" : {
            "kind" : "DockerImage",
            "name" : "172.30.5.151:5000/myproject/ruby-hello-world:latest"
        },
        "importPolicy" : {},
        "name" : "latest"
    }]},
    "status" : {"dockerImageRepository" : ""}
}
Auth - allowCertificate with incoming chain of len  2
Auth - in skip tls mode, returning true
  Created a "ImageStream"


Exiting "Create OpenShift Resource(s)" successfully, with 1 resource(s) created.
Finished: SUCCESS

Following build logs creates 1 socket/second & duplicate log data

If you create a start-build step & specify that build logs should be streamed, you will see in the Jenkins console that each build log message is appended to the console log multiple times.

In IOpenShiftBuilder.java, you can see why:

        while (System.currentTimeMillis() < (startTime + wait)) {
            bld = client.get(ResourceKind.BUILD, bldId, getNamespace(overrides));
            bldState = bld.getStatus();
            if (Boolean.parseBoolean(getVerbose(overrides)))
                listener.getLogger().println("\nOpenShiftBuilder bld state:  " + bldState);

            if (follow) {
                final String container = pod.getContainers().iterator().next().getName();
                listener.getLogger().println("CONATINERNAME: " + container);

                stop = pod.accept(new CapabilityVisitor<IPodLogRetrievalAsync, IStoppable>() {

Each second, a new pod.accept is being invoked (which creates a net new socket/listener for the life of the build process).

The simple fix is to move the if (follow){...} block outside of the loop. However, invoking .accept too early results in an exception which is currently swallowed by the restclient.

Oct 05, 2016 6:12:57 PM hudson.init.impl.InstallUncaughtExceptionHandler$DefaultUncaughtExceptionHandler uncaughtException
SEVERE: A thread (OkHttp Dispatcher/95) died unexpectedly due to an uncaught exception, this may leave your Jenkins in a bad way and is usually indicative of a bug in the code.
com.openshift.restclient.BadRequestException: https://10.13.137.145:8443/api/v1/namespaces/myproject/pods/ruby-hello-world-8-build/log?container=docker-build&follow=true container "docker-build" in pod "ruby-hello-world-8-build" is waiting to start: ContainerCreating
    at com.openshift.internal.restclient.okhttp.ResponseCodeInterceptor.createOpenShiftException(ResponseCodeInterceptor.java:97)
    at com.openshift.internal.restclient.okhttp.ResponseCodeInterceptor.intercept(ResponseCodeInterceptor.java:59)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
    at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:170)
    at okhttp3.RealCall.access$100(RealCall.java:33)
    at okhttp3.RealCall$AsyncCall.execute(RealCall.java:120)
    at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)

In other words, there is presently no (straightforward) way to know whether the operation fails & needs to be retried.

Fixing it might require a slight API break in the openshift-restclient, so I've opened a PR to debate the discuss the change: openshift/openshift-restclient-java#224

FR: Post-build Actions - Scale Development

Hello.

Current workflow:

  1. "job-run" - scale development to 1, do something, call "job-down" in any situation (exit 0/1).
  2. "job-down" - scale development to 0, do something.

Why we can't do this in one job, steps:

  1. Scale development to 1
  2. Execute a shell script, which return status of execution on step 1
  3. Scale development to 0

If error will appear on step 2 (exit 1), the step 3 will not be executed and all deployments will stay in working state.

Therefore we should write and maintain two jobs (up/down) instead of one. From this arise problems for batch execution of many of jobs ("job-run" tasks stayed alive until will not be executed "job-down" tasks).

We need post-build action - "scale development".

Crazy duplication in Jenkins console output

Lots of duplication of lines in pages like https://jenkins-demo.router.default.svc.cluster.local/job/sample-pipeline/1/consoleFull , e.g.:

OpenShift Build demo/sample-pipeline-1
[Pipeline] node
Still waiting to schedule task
Waiting for next available executor
Running on maven-e07c2fe6d9 in /tmp/workspace/sample-pipeline
[Pipeline] {
[Pipeline] stage (build)
Entering stage build
Proceeding
[Pipeline] openshiftBuild


Starting the "Trigger OpenShift Build" step with build config "ruby-sample-build" from the project "demo".
  Started build "ruby-sample-build-1" and waiting for build completion ...
Cloning "https://github.com/openshift/ruby-hello-world.git" ...
Cloning "https://github.com/openshift/ruby-hello-world.git" ...
Cloning "https://github.com/openshift/ruby-hello-world.git" ...
Cloning "https://github.com/openshift/ruby-hello-world.git" ...
Cloning "https://github.com/openshift/ruby-hello-world.git" ...
Cloning "https://github.com/openshift/ruby-hello-world.git" ...
Cloning "https://github.com/openshift/ruby-hello-world.git" ...
Cloning "https://github.com/openshift/ruby-hello-world.git" ...
Cloning "https://github.com/openshift/ruby-hello-world.git" ...
Cloning "https://github.com/openshift/ruby-hello-world.git" ...
    Commit: e79d8870be808a7abb4ab304e94c8bee69d909c6 (Merge pull request #53 from danmcp/master)
    Commit: e79d8870be808a7abb4ab304e94c8bee69d909c6 (Merge pull request #53 from danmcp/master)
    Author: Ben Parees <[email protected]>
    Date:   Tue Apr 5 10:06:50 2016 -0400
    Commit: e79d8870be808a7abb4ab304e94c8bee69d909c6 (Merge pull request #53 from danmcp/master)
    Author: Ben Parees <[email protected]>
    Date:   Tue Apr 5 10:06:50 2016 -0400
    Author: Ben Parees <[email protected]>
    Commit: e79d8870be808a7abb4ab304e94c8bee69d909c6 (Merge pull request #53 from danmcp/master)
    Date:   Tue Apr 5 10:06:50 2016 -0400
    Author: Ben Parees <[email protected]>
    Date:   Tue Apr 5 10:06:50 2016 -0400
    Commit: e79d8870be808a7abb4ab304e94c8bee69d909c6 (Merge pull request #53 from danmcp/master)
    Author: Ben Parees <[email protected]>
    Date:   Tue Apr 5 10:06:50 2016 -0400
    Commit: e79d8870be808a7abb4ab304e94c8bee69d909c6 (Merge pull request #53 from danmcp/master)
    Commit: e79d8870be808a7abb4ab304e94c8bee69d909c6 (Merge pull request #53 from danmcp/master)
    Commit: e79d8870be808a7abb4ab304e94c8bee69d909c6 (Merge pull request #53 from danmcp/master)
    Commit: e79d8870be808a7abb4ab304e94c8bee69d909c6 (Merge pull request #53 from danmcp/master)
    Author: Ben Parees <[email protected]>
    Author: Ben Parees <[email protected]>
    Date:   Tue Apr 5 10:06:50 2016 -0400
    Date:   Tue Apr 5 10:06:50 2016 -0400
    Author: Ben Parees <[email protected]>
    Author: Ben Parees <[email protected]>
    Date:   Tue Apr 5 10:06:50 2016 -0400
    Date:   Tue Apr 5 10:06:50 2016 -0400
    Commit: e79d8870be808a7abb4ab304e94c8bee69d909c6 (Merge pull request #53 from danmcp/master)
    Author: Ben Parees <[email protected]>
    Date:   Tue Apr 5 10:06:50 2016 -0400
---> Installing application source ...
---> Building your Ruby application from source ...
---> Installing application source ...
---> Building your Ruby application from source ...
---> Installing application source ...
---> Building your Ruby application from source ...
---> Installing application source ...
---> Installing application source ...
---> Installing application source ...
---> Building your Ruby application from source ...
---> Building your Ruby application from source ...
---> Installing application source ...
---> Installing application source ...
---> Running 'bundle install --deployment' ...
---> Building your Ruby application from source ...
---> Running 'bundle install --deployment' ...
---> Running 'bundle install --deployment' ...
---> Building your Ruby application from source ...
---> Installing application source ...
---> Building your Ruby application from source ...
---> Running 'bundle install --deployment' ...
---> Building your Ruby application from source ...
---> Running 'bundle install --deployment' ...
---> Running 'bundle install --deployment' ...
---> Installing application source ...
---> Building your Ruby application from source ...
---> Running 'bundle install --deployment' ...
---> Running 'bundle install --deployment' ...
---> Running 'bundle install --deployment' ...
---> Running 'bundle install --deployment' ...

FR: Tag images in multiple projects simultaneously

Hello. The quantity of projects are growing and dedicated tag step for each project - it's not convenient. 6 projects and 20 different builds = 120 tag steps (all imagestream in all projects, except central image project).

Support username and password credentials

Currently, the Jenkins plugin only supports using a token to authenticate itself to the OpenShift master. This is fine if Jenkins is being run from inside OpenShift, but if you have an external Jenkins instance, you have to deal with figuring out how to populate the auth token with a value that expires (by default) every 24 hours. It would be great if the plugin were extended to support authentication via a username and password from the credential store. Ideally, it would log in to the OpenShift master, execute whichever commands, and then log out to destroy the auth token.

In the meantime, I've worked around this by setting up a pipeline job that runs every 12 hours, gets a username and password from a credential entry, logs in to the OpenShift master via curl, parses out the auth token, and stores it in a plain credential. It requires the pipeline plugin, the credentials binding plugin, and the plain credentials plugin. It's also super janky due to limitations of the pipeline plugin (e.g. no ability to get command output, so you have to redirect into a file). Here's the job, in case anybody needs to do this for now:

def token

node {
  withCredentials([[$class: 'UsernamePasswordBinding', credentialsId: 'USER_PASS_CRED_ID', variable: 'OCCREDS']]) {
    sh '''
      curl -v -XGET \\
        --no-keepalive \\
        -u "${OCCREDS}" \\
        -H "X-Csrf-Token: 1" \\
        'https://OPENSHIFT_MASTER:8443/oauth/authorize?response_type=token&client_id=openshift-challenging-client' \\
        2>&1 | \\
        grep 'Location: ' | \\
        sed -E 's/.*access_token=([^&]+)&.*/\\1/' >token
    '''
    token = readFile 'token'
    token = token.trim()
    sh 'rm token'
  }
}

def cred = com.cloudbees.plugins.credentials.CredentialsProvider.lookupCredentials(
  org.jenkinsci.plugins.plaincredentials.StringCredentials
).find { it.id == 'AUTH_TOKEN_CRED_ID' ? it : null }

def credstore = jenkins.model.Jenkins.instance.getExtensionList(
  'com.cloudbees.plugins.credentials.SystemCredentialsProvider'
)[0].getStore()

def newcred = new org.jenkinsci.plugins.plaincredentials.impl.StringCredentialsImpl(
  cred.scope,
  cred.id,
  cred.description,
  new hudson.util.Secret(token)
)

credstore.updateCredentials(
  com.cloudbees.plugins.credentials.domains.Domain.global(),
  cred,
  newcred
)

On any jobs that you want to use this credential, you bind the plain string credential containing the token to the AUTH_TOKEN environment variable.

FR: Dedicated timeout settings for tasks

SUBJ. At this moment we have global settings for tasks, but it is very inconvenient.

Use case: We have build1, we should set high time out for that build. We have build2, which failed, but we should wait global time out, which we set for build1.

Trigger OpenShift Build Options

Can I use options --from-file in Trigger Openshift Build. I using external Jenkins for build and Openshift Origin just for binary deployment. I want to start Openshift build from Jenkins Plugin with options --from-file.

How could I do?

Thanks.

FR: Using variables as substring in names of configurations

Hello. At the moment we can use variables like this:

VERSION=centos

The name of the DeploymentConfig to scale: VERSION

But we can not do like this:

The name of the DeploymentConfig to scale: drweb-fss-VERSION or drweb-fss-$VERSION or drweb-fss-${VERSION} or drweb-fss-${VERSION}-rpm

We have a lot of similar tasks, which are different only in software version.

java.lang.NullPointerException during build

I used pre-release version of plugin - #34 (comment)

But build continued to work in Openshift.

Started by user admin
Building in workspace /var/lib/jenkins/workspace/images/testing-11.0-drweb-dss-opensuse

Starting the "Trigger OpenShift Build" step with build config "testing-11.0-drweb-dss-opensuse" from the project "images".
Started build "testing-11.0-drweb-dss-opensuse-11" and waiting for build completion ...
ERROR: Build step failed with exception
java.lang.NullPointerException
at com.openshift.jenkins.plugins.pipeline.OpenShiftBuilder.coreLogic(OpenShiftBuilder.java:276)
at com.openshift.jenkins.plugins.pipeline.IOpenShiftPlugin.doItCore(IOpenShiftPlugin.java:123)
at com.openshift.jenkins.plugins.pipeline.IOpenShiftPlugin.doIt(IOpenShiftPlugin.java:134)
at com.openshift.jenkins.plugins.pipeline.OpenShiftBaseStep.perform(OpenShiftBaseStep.java:85)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:782)
at hudson.model.Build$BuildExecution.build(Build.java:205)
at hudson.model.Build$BuildExecution.doRun(Build.java:162)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:534)
at hudson.model.Run.execute(Run.java:1738)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:410)
Build step 'Trigger OpenShift Build' marked build as failure
Finished: FAILURE

Replace use of System.currentTimeMillis()

currentTimeMillis() is impacted by system clock changes (e.g. daylight savings changes). This can cause wait time calculations relying on the API to behave incorrectly.
These loops can be changed to use System.nanoTime() (with changes to accommodate nanoseconds instead of milliseconds values).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.