Bug 1826523
| Summary: | Various fields in build resources are displayed as `null` if unset | ||
|---|---|---|---|
| Product: | OpenShift Container Platform | Reporter: | aaleman |
| Component: | Build | Assignee: | aaleman |
| Status: | CLOSED ERRATA | QA Contact: | wewang <wewang> |
| Severity: | medium | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | 4.5 | CC: | adam.kaplan, aos-bugs, pweil, wzheng |
| Target Milestone: | --- | Flags: | wewang:
needinfo-
|
| Target Release: | 4.5.0 | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | Bug Fix | |
| Doc Text: |
Cause: optional BuildConfig and Build fields did not have `omitempty` in their JSON tags
Consequence: several fields appear as `null` in oc get build
Fix: add `omitempty` tags to relevant Build and BuildConfig fields
Result: empty, optional fields do not appear in JSON or YAML output of Build and BuildConfig objects
|
Story Points: | --- |
| Clone Of: | Environment: | ||
| Last Closed: | 2020-07-13 17:29:58 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
It can be reproduced, but now latest accepted payload is 4.5.0-0.nightly-2020-04-21-103613, will wait newer payload to check it.
'''
nodeSelector: null
output:
pushSecret:
name: builder-dockercfg-55m9g
to:
kind: ImageStreamTag
name: test:latest
postCommit: {}
resources: {}
serviceAccount: builder
source:
binary:
asFile: Dockerfile
type: Binary
strategy:
dockerStrategy: {}
type: Docker
triggeredBy: null
'''
@aaleman Tested in ci payload, but still met null, if need others update.
version:
4.5.0-0.ci-2020-04-23-151503
'''
spec:
nodeSelector: null
output:
pushSecret:
name: builder-dockercfg-89pcs
to:
kind: ImageStreamTag
name: test:latest
postCommit: {}
resources: {}
serviceAccount: builder
source:
binary:
asFile: Dockerfile
type: Binary
strategy:
dockerStrategy: {}
type: Docker
triggeredBy: null
'''
Oh, I know why null still exists, seems vendor/github.com/openshift/api/build/v1/types.go in ocm repo also need to bump, @adam could you help to check it, thanks. Posted https://github.com/openshift/openshift-apiserver/pull/99 to get the changes picked up Will wait latest payload to check it Oh, I found nodeSelector is not omitempty, should be ignore, if it's null
Version:
4.5.0-0.nightly-2020-05-07-144853
-----
spec:
nodeSelector: null
output:
pushSecret:
name: builder-dockercfg-d4gm4
-----
Seems cannot omitempty for nodeSelector as said before:https://github.com/openshift/api/pull/626#discussion_r407503527, but how to resolve null issue about nodeSelector? Unfortunately, we can not do anything about the nodeSelector being displayed as null as that would mean we can not differentiate null from empty anymore. @aaleman Oh, sorry forgot change status according your comment 11 Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHBA-2020:2409 |
Description of problem: There is a set of fields that are displayed as `null` in Build custom resources, rather than getting omitted, for example: ``` apiVersion: build.openshift.io/v1 kind: Build [...] spec: nodeSelector: null [...] source: - as: null from: [...] triggeredBy: null ``` Version-Release number of selected component (if applicable): How reproducible: 100% Steps to Reproduce: 1. `oc get build -o yaml` 2. 3. Actual results: Expected results: Unset fields are omitted, rather than shown with a `null` value Additional info: