omit missing Created field from ImageInspect response

Signed-off-by: ChendongSun <sunchendong@xfusion.com>
This commit is contained in:
ChendongSun 2024-11-04 07:13:04 +00:00 committed by Gitee
parent 45ec1f93f7
commit 74f5abf9d7
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 75 additions and 2 deletions

View File

@ -0,0 +1,69 @@
From 5d9e13bc8453c856f055769008dac9311f43c265 Mon Sep 17 00:00:00 2001
From: Bjorn Neergaard <bjorn.neergaard@docker.com>
Date: Mon, 26 Feb 2024 10:25:08 -0700
Subject: [PATCH] api: omit missing Created field from ImageInspect response
Signed-off-by: Bjorn Neergaard <bjorn.neergaard@docker.com>
---
api/swagger.yaml | 6 +++++-
api/types/types.go | 6 +++++-
docs/api/v1.44.yaml | 6 +++++-
3 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/api/swagger.yaml b/api/swagger.yaml
index e55a76f..350d37a 100644
--- a/api/swagger.yaml
+++ b/api/swagger.yaml
@@ -1743,8 +1743,12 @@ definitions:
description: |
Date and time at which the image was created, formatted in
[RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds.
+
+ This information is only available if present in the image,
+ and omitted otherwise.
type: "string"
- x-nullable: false
+ format: "dateTime"
+ x-nullable: true
example: "2022-02-04T21:20:12.497794809Z"
Container:
description: |
diff --git a/api/types/types.go b/api/types/types.go
index 5c56a0c..3c1f69a 100644
--- a/api/types/types.go
+++ b/api/types/types.go
@@ -72,8 +72,12 @@ type ImageInspect struct {
// Created is the date and time at which the image was created, formatted in
// RFC 3339 nano-seconds (time.RFC3339Nano).
- Created string
+ //
+ // This information is only available if present in the image,
+ // and omitted otherwise.
+ Created string `json:",omitempty"`
+
// Container is the ID of the container that was used to create the image.
//
// Depending on how the image was created, this field may be empty.
diff --git a/docs/api/v1.44.yaml b/docs/api/v1.44.yaml
index e55a76f..350d37a 100644
--- a/docs/api/v1.44.yaml
+++ b/docs/api/v1.44.yaml
@@ -1743,8 +1743,12 @@ definitions:
description: |
Date and time at which the image was created, formatted in
[RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds.
+
+ This information is only available if present in the image,
+ and omitted otherwise.
type: "string"
- x-nullable: false
+ format: "dateTime"
+ x-nullable: true
example: "2022-02-04T21:20:12.497794809Z"
Container:
description: |
--
2.41.0

View File

@ -7,7 +7,7 @@
Name: docker
Version: 25.0.3
Release: 14
Release: 15
Summary: The open-source application container engine
License: ASL 2.0
URL: https://www.docker.com
@ -27,7 +27,7 @@ Patch0004: 0004-fix-docker-swarm-run-failed-for-loongarch64.patch
Patch0005: 0005-CVE-2024-41110.patch
Patch0006: 0006-tini.c-a-function-declaration-without-a-prototype-is.patch
Patch0007: 0007-fix-libnetwork-osl-test-TestAddRemoveInterface.patch
Patch0008: 0008-api-omit-missing-Created-field-from-ImageInspect-res.patch
Requires: %{name}-engine = %{version}-%{release}
Requires: %{name}-client = %{version}-%{release}
@ -97,6 +97,7 @@ Docker client binary and related utilities
%patch 0004 -p1
%patch 0005 -p1
%patch 0007 -p1
%patch 0008 -p1
%setup -q -T -n %{_source_docker_init} -b 2
%patch 0006 -p1
@ -199,6 +200,9 @@ fi
%systemd_postun_with_restart docker.service
%changelog
* Mon Nov 4 2024 sunchendong<sunchendong@xfusion.com> - 25.0.3-15
- DESC:omit missing Created field from ImageInspect response
* Thu Oct 31 2024 yaoguangzhong<yaoguangzhong@xfusion.com> - 25.0.3-14
- DESC:backport upstream patch to fix libnetwork/osl test TestAddRemoveInterface