opendevstack / tailor

Infrastructure as Code for OpenShift
Apache License 2.0
13 stars 9 forks source link

tailor update on build config jenkins-master and jenkins-slave-base #157

Closed stefanlack closed 4 years ago

stefanlack commented 4 years ago

Describe the bug After tailor update is executed, on next run tailor reports changes again:

To Reproduce

cd ${BASE_DIR}/ods-core/jenkins/ocp-config
yes 'y' | tailor update -v --force
tailor status --force

Expected behavior After tailor update, no further changes should appier when tailor update is executed again.

Screenshots and logs image

[root@openshift ocp-config]# tailor status --force
Comparing templates in . with OCP namespace cd.
Limiting resources to bc,is with selector app=jenkins.
Found 6 resources in OCP cluster (current state) and 6 resources in processed templates (desired state).

* bc/jenkins-webhook-proxy is in sync
* is/jenkins-master is in sync
* is/jenkins-slave-base is in sync
* is/jenkins-webhook-proxy is in sync
~ bc/jenkins-master to update
--- Current State (OpenShift cluster)
+++ Desired State (Processed template)
@@ -27,6 +27,7 @@
       - name: APP_DNS
         value: 192.168.56.101.nip.io
       - name: TARGET_HOSTS
+        value: ""
       from:
         kind: ImageStreamTag
         name: jenkins:2
~ bc/jenkins-slave-base to update
--- Current State (OpenShift cluster)
+++ Desired State (Processed template)
@@ -30,6 +30,7 @@
       - name: SNYK_DISTRIBUTION_URL
         value: https://github.com/snyk/snyk/releases/download/v1.180.1/snyk-linux
       - name: TARGET_HOSTS
+        value: ""
       from:
         kind: DockerImage
         name: openshift/jenkins-slave-base-centos7

Affected version (please complete the following information):

michaelsauter commented 4 years ago

I will look into it.

michaelsauter commented 4 years ago

@stefanlack I can reproduce this. I have moved this to the tailor repository now as this is, to some extent, an issue with Tailor.

When using --diff=json, one can see that Tailor tries to add the empty strings:

~ bc/jenkins-master to update
[
  {
    "op": "add",
    "path": "/spec/strategy/dockerStrategy/env/1/value",
    "value": ""
  }
]
~ bc/jenkins-slave-base to update
[
  {
    "op": "add",
    "path": "/spec/strategy/dockerStrategy/env/2/value",
    "value": ""
  }
]

However, it seems like OpenShift immediately removes them again. Opening the YAML in the web console shows:

- name: TARGET_HOSTS

There is no value field. When adding value: '' an error shows: No changes were applied to build config jenkins-master.Make sure any new fields you may have added are supported API fields.. If you just add value: (without single quotes), then one can save it, but the field is removed again by OpenShift.