{"action":"created","issue":{"url":"https://api.github.com/repos/openshift/jenkins-client-plugin/issues/153","repository_url":"https://api.github.com/repos/openshift/jenkins-client-plugin","labels_url":"https://api.github.com/repos/openshift/jenkins-client-plugin/issues/153/labels{/name}","comments_url":"https://api.github.com/repos/openshift/jenkins-client-plugin/issues/153/comments","events_url":"https://api.github.com/repos/openshift/jenkins-client-plugin/issues/153/events","html_url":"https://github.com/openshift/jenkins-client-plugin/issues/153","id":318131353,"number":153,"title":"exported selectors are missing quotations on some fields","user":{"login":"tomcooperca","id":23202065,"avatar_url":"https://avatars3.githubusercontent.com/u/23202065?v=4","gravatar_id":"","url":"https://api.github.com/users/tomcooperca","html_url":"https://github.com/tomcooperca","followers_url":"https://api.github.com/users/tomcooperca/followers","following_url":"https://api.github.com/users/tomcooperca/following{/other_user}","gists_url":"https://api.github.com/users/tomcooperca/gists{/gist_id}","starred_url":"https://api.github.com/users/tomcooperca/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tomcooperca/subscriptions","organizations_url":"https://api.github.com/users/tomcooperca/orgs","repos_url":"https://api.github.com/users/tomcooperca/repos","events_url":"https://api.github.com/users/tomcooperca/events{/privacy}","received_events_url":"https://api.github.com/users/tomcooperca/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"gabemontero","id":3594868,"avatar_url":"https://avatars0.githubusercontent.com/u/3594868?v=4","gravatar_id":"","url":"https://api.github.com/users/gabemontero","html_url":"https://github.com/gabemontero","followers_url":"https://api.github.com/users/gabemontero/followers","following_url":"https://api.github.com/users/gabemontero/following{/other_user}","gists_url":"https://api.github.com/users/gabemontero/gists{/gist_id}","starred_url":"https://api.github.com/users/gabemontero/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gabemontero/subscriptions","organizations_url":"https://api.github.com/users/gabemontero/orgs","repos_url":"https://api.github.com/users/gabemontero/repos","events_url":"https://api.github.com/users/gabemontero/events{/privacy}","received_events_url":"https://api.github.com/users/gabemontero/received_events","type":"User","site_admin":false},"assignees":[{"login":"gabemontero","id":3594868,"avatar_url":"https://avatars0.githubusercontent.com/u/3594868?v=4","gravatar_id":"","url":"https://api.github.com/users/gabemontero","html_url":"https://github.com/gabemontero","followers_url":"https://api.github.com/users/gabemontero/followers","following_url":"https://api.github.com/users/gabemontero/following{/other_user}","gists_url":"https://api.github.com/users/gabemontero/gists{/gist_id}","starred_url":"https://api.github.com/users/gabemontero/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gabemontero/subscriptions","organizations_url":"https://api.github.com/users/gabemontero/orgs","repos_url":"https://api.github.com/users/gabemontero/repos","events_url":"https://api.github.com/users/gabemontero/events{/privacy}","received_events_url":"https://api.github.com/users/gabemontero/received_events","type":"User","site_admin":false}],"milestone":null,"comments":1,"created_at":"2018-04-26T17:44:05Z","updated_at":"2018-04-26T19:02:07Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"oc version\r\noc v3.6.1+008f2d5\r\nkubernetes v1.6.1+5115d708d7\r\n\r\nClient plugin version 1.07\r\n\r\nNot sure if this is a client plugin bug or just the CLI version I'm using.\r\nWe have a pipeline script that backs up all our OpenShift resources. \r\nWhen trying to recreate any of these objects (using an `DeploymentConfig` as an example) from the backup, a number of fields are not quoted and thus are being interpreted as the wrong datatype via the CLI (numbers or booleans, expecting only plain strings).\r\n\r\nWhen I export this dc via `oc get dc my-dc -o yaml --export`, those field values are surrounded correctly. \r\n\r\nPipeline:\r\n```Groovy\r\nopenshift.selector('dc').withEach {\r\n    sh \"echo \\\"${it.asYaml(exportable: true)}\\\" > ${it.object().metadata.name}.yml\"\r\n}\r\n```\r\n\r\nResult:\r\n\r\n```\r\napiVersion: v1\r\nkind: DeploymentConfig\r\n..\r\nspec:\r\n  template:\r\n    spec:\r\n      containers:\r\n      - env:\r\n        ...\r\n        - name: SOME_NUMBER_VALUE\r\n          value: 0\r\n        - name: AB_JOLOKIA_OFF\r\n          value: true\r\n```\r\n\r\nRecreating:\r\n\r\n```\r\ncat my-dc.yml | oc --loglevel=8 create -f -\r\nI0426 14:44:52.523698   55118 request.go:991] Request Body: {\"apiVersion\":\"v1\",\"kind\":\"DeploymentConfig\",\"metadata\":..{\"name\":\"SOME_NUMBER_VALUE\",\"value\":0},{\"name\":\"AB_JOLOKIA_OFF\",\"value\":true}],\r\n...\r\nI0426 14:44:52.679359   55118 request.go:991] Response Body: {\"kind\":\"Status\",\"apiVersion\":\"v1\",\"metadata\":{},\"status\":\"Failure\",\"message\":\"DeploymentConfig in version \\\"v1\\\" cannot be handled as a DeploymentConfig: [pos 758]: json: expect char '\\\"' but got char '0'\",\"reason\":\"BadRequest\",\"code\":400}\r\n```\r\n\r\nEnvironment variables in dc's can only be strings so these values are being rejected. Exporting the resource manually gives me quoted values in those fields:\r\n\r\n\r\n```\r\noc get pvc my-dc -n my-namespace -o yaml --export > my-dc.yml\r\n\r\ndiff --git a/my-namespace/dc/my-dc.yml b/my-namespace/dc/my-dc.yml\r\nindex 6e50285..a33d89f 100644\r\n--- a/my-namespace/dc/my-dc.yml\r\n+++ b/my-namespace/dc/my-dc.yml\r\n@@ -7,6 +7,7 @@ metadata:\r\n     app: my-dc\r\n     template: template-deploy\r\n   name: my-dc\r\n+  selfLink: /oapi/v1/namespaces//deploymentconfigs/my-dc\r\n spec:\r\n   replicas: 1\r\n   selector:\r\n@@ -35,9 +36,9 @@ spec:\r\n         - name: EUREKA_INSTANCE_HOSTNAME\r\n           value: my-dc\r\n         - name: SOME_NUMBER_VALUE\r\n-          value: 0\r\n+          value: \"0\"\r\n         - name: AB_JOLOKIA_OFF\r\n-          value: true\r\n+          value: \"true\"\r\n         image: ...\r\n```"},"comment":{"url":"https://api.github.com/repos/openshift/jenkins-client-plugin/issues/comments/384755104","html_url":"https://github.com/openshift/jenkins-client-plugin/issues/153#issuecomment-384755104","issue_url":"https://api.github.com/repos/openshift/jenkins-client-plugin/issues/153","id":384755104,"user":{"login":"tomcooperca","id":23202065,"avatar_url":"https://avatars3.githubusercontent.com/u/23202065?v=4","gravatar_id":"","url":"https://api.github.com/users/tomcooperca","html_url":"https://github.com/tomcooperca","followers_url":"https://api.github.com/users/tomcooperca/followers","following_url":"https://api.github.com/users/tomcooperca/following{/other_user}","gists_url":"https://api.github.com/users/tomcooperca/gists{/gist_id}","starred_url":"https://api.github.com/users/tomcooperca/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tomcooperca/subscriptions","organizations_url":"https://api.github.com/users/tomcooperca/orgs","repos_url":"https://api.github.com/users/tomcooperca/repos","events_url":"https://api.github.com/users/tomcooperca/events{/privacy}","received_events_url":"https://api.github.com/users/tomcooperca/received_events","type":"User","site_admin":false},"created_at":"2018-04-26T19:02:07Z","updated_at":"2018-04-26T19:02:07Z","author_association":"CONTRIBUTOR","body":"Thanks @gabemontero - I also updated the original issue with a more practical example (a DeploymentConfig). Straight away, I'm see the same outputs from `oc export` (yay!) so those quotations are _supposed_ to be present. \r\n\r\nI'll get the `oc` binary with matched versions and the additional debug logs from the pipeline job. "}}
{"actor":{"display_login":"tomcooperca"}}