Skip to content

Commit

Permalink
Merge pull request #235 from fussybeaver/ND-models-v20.10.16
Browse files Browse the repository at this point in the history
Bump models to match v20.10.16 moby release
  • Loading branch information
fussybeaver committed May 31, 2022
2 parents 48d18c1 + 32ba453 commit 79ea9ce
Show file tree
Hide file tree
Showing 8 changed files with 66 additions and 47 deletions.
14 changes: 7 additions & 7 deletions .circleci/config.yml
Expand Up @@ -3,7 +3,7 @@ version: 2
jobs:
test_ssl:
docker:
- image: docker:20.10.11
- image: docker:20.10.16
steps:
- checkout
- setup_remote_docker
Expand All @@ -15,7 +15,7 @@ jobs:
- run: docker run -ti -e DOCKER_CERT_PATH=/certs -e DOCKER_HOST='tcp://test.example.com:2376' --volumes-from certs --rm --link test-docker-daemon:docker bollard cargo test --features test_ssl,ct_logs -- --test test_version_ssl
test_http:
docker:
- image: docker:20.10.11
- image: docker:20.10.16
steps:
- checkout
- setup_remote_docker
Expand All @@ -24,31 +24,31 @@ jobs:
- run: docker run -ti -e DOCKER_HOST='tcp://test.example.com:2375' --rm --link test-docker-daemon:docker bollard cargo test --features test_http -- --test test_version_http
test_unix:
docker:
- image: docker:20.10.11
- image: docker:20.10.16
steps:
- checkout
- setup_remote_docker
- run: docker build -t bollard .
- run: dockerfiles/bin/run_integration_tests.sh
test_doc:
docker:
- image: docker:20.10.11
- image: docker:20.10.16
steps:
- checkout
- setup_remote_docker
- run: docker build -t bollard .
- run: docker run -ti --rm bollard cargo test --target x86_64-unknown-linux-gnu --doc
test_clippy:
docker:
- image: docker:20.10.11
- image: docker:20.10.16
steps:
- checkout
- setup_remote_docker
- run: docker build -t bollard .
- run: docker run -ti --rm bollard bash -c "rustup component add clippy && cargo clippy --all-targets -- -Dwarnings -Aclippy::upper_case_acronyms"
test_audit:
docker:
- image: docker:20.10.11
- image: docker:20.10.16
steps:
- checkout
- setup_remote_docker
Expand All @@ -57,7 +57,7 @@ jobs:
- run: docker run -ti --rm bollard bash -c "cargo install cargo-audit && cargo audit --deny warnings --ignore=RUSTSEC-2020-0159 --ignore=RUSTSEC-2020-0071"
test_fmt:
docker:
- image: docker:20.10.11
- image: docker:20.10.16
steps:
- checkout
- setup_remote_docker
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Expand Up @@ -24,7 +24,7 @@ ct_logs = ["ssl", "ct-logs"]

[dependencies]
base64 = "0.13"
bollard-stubs = { version = "=1.42.0-rc.0" }
bollard-stubs = { version = "=1.42.0-rc.2" }
bytes = "1"
chrono = { version = "0.4", features = ["serde"] }
ct-logs = { version = "0.9.0", optional = true }
Expand Down
11 changes: 6 additions & 5 deletions codegen/pom.xml
Expand Up @@ -12,25 +12,26 @@
<plugin>
<groupId>io.swagger</groupId>
<artifactId>swagger-codegen-maven-plugin</artifactId>
<version>2.4.26</version>
<version>2.4.27</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<!-- Pegged release: switch back on moby release v20.10.14+
<!-- moby commit a06bae909494b43daadc0ee60dbce79231616470 is v20.10.16 + a fix for issue https://github.com/moby/moby/issues/43655
<inputSpec>https://raw.githubusercontent.com/moby/moby/v20.10.16/docs/api/v1.41.yaml</inputSpec>
<inputSpec>https://docs.docker.com/engine/api/v1.41.yaml</inputSpec>
-->
<inputSpec>https://raw.githubusercontent.com/moby/moby/master/docs/api/v1.41.yaml</inputSpec>
<inputSpec>https://raw.githubusercontent.com/moby/moby/a06bae909494b43daadc0ee60dbce79231616470/docs/api/v1.41.yaml</inputSpec>
<language>bollard.BollardCodegen</language>
<output>${project.build.directory}/generated-sources</output>
<generateApis>true</generateApis>
<templateDirectory>${project.basedir}/src/main/resources/bollard</templateDirectory>
<supportingFilesToGenerate>models.rs,lib.rs,Cargo.toml,config,README.md</supportingFilesToGenerate>
<configOptions>
<packageName>bollard-stubs</packageName>
<packageVersion>1.42.0-rc.0</packageVersion>
<packageVersion>1.42.0-rc.2</packageVersion>
</configOptions>
</configuration>
</execution>
Expand All @@ -55,7 +56,7 @@
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-codegen</artifactId>
<version>2.4.26</version>
<version>2.4.27</version>
</dependency>
</dependencies>
</project>
2 changes: 1 addition & 1 deletion codegen/target/generated-sources/.swagger-codegen/VERSION
@@ -1 +1 @@
2.4.26
2.4.27
2 changes: 1 addition & 1 deletion codegen/target/generated-sources/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "bollard-stubs"
version = "1.42.0-rc.0"
version = "1.42.0-rc.2"
authors = [ "Bollard contributors" ]
description = "Stubs used for the Bollard rust async Docker client API"
license = "Apache-2.0"
Expand Down
6 changes: 3 additions & 3 deletions codegen/target/generated-sources/README.md
Expand Up @@ -7,9 +7,9 @@ To see how to make this your own, look here:

[README](https://github.com/swagger-api/swagger-codegen/blob/master/README.md)

- API version: 1.42.0-rc.0
- Code generation suffix: 1.42.0-rc.0
- Build date: 2022-03-23T16:54:11.696Z
- API version: 1.42.0-rc.2
- Code generation suffix: 1.42.0-rc.2
- Build date: 2022-05-31T18:04:02.348+01:00

This autogenerated project defines an API crate `bollard-stubs` which contains:
* Data types representing the underlying data model.
Expand Down
56 changes: 33 additions & 23 deletions codegen/target/generated-sources/src/models.rs
Expand Up @@ -284,7 +284,7 @@ pub struct ContainerChangeResponseItem {

}

/// Configuration for a container that is portable between hosts.
/// Configuration for a container that is portable between hosts. When used as `ContainerConfig` field in an image, `ContainerConfig` is an optional field containing the configuration of the container that was last committed when creating the image. Previous versions of Docker builder used this field to store build cache, and it is not in active use anymore.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct ContainerConfig {
/// The hostname to use for the container, as a valid RFC 1123 hostname.
Expand Down Expand Up @@ -801,6 +801,16 @@ pub struct ContainerUpdateResponse {

}

/// container waiting error, if any
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct ContainerWaitExitError {
/// Details of an error
#[serde(rename = "Message")]
#[serde(skip_serializing_if="Option::is_none")]
pub message: Option<String>,

}

/// OK response to ContainerWait operation
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct ContainerWaitResponse {
Expand All @@ -810,17 +820,7 @@ pub struct ContainerWaitResponse {

#[serde(rename = "Error")]
#[serde(skip_serializing_if="Option::is_none")]
pub error: Option<ContainerWaitResponseError>,

}

/// container waiting error, if any
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct ContainerWaitResponseError {
/// Details of an error
#[serde(rename = "Message")]
#[serde(skip_serializing_if="Option::is_none")]
pub message: Option<String>,
pub error: Option<ContainerWaitExitError>,

}

Expand Down Expand Up @@ -2028,7 +2028,7 @@ pub struct HostConfig {
#[serde(skip_serializing_if="Option::is_none")]
pub readonly_rootfs: Option<bool>,

/// A list of string values to customize labels for MLS systems, such as SELinux.
/// A list of string values to customize labels for MLS systems, such as SELinux.
#[serde(rename = "SecurityOpt")]
#[serde(skip_serializing_if="Option::is_none")]
pub security_opt: Option<Vec<String>>,
Expand Down Expand Up @@ -2056,7 +2056,7 @@ pub struct HostConfig {
/// Size of `/dev/shm` in bytes. If omitted, the system uses 64MB.
#[serde(rename = "ShmSize")]
#[serde(skip_serializing_if="Option::is_none")]
pub shm_size: Option<usize>,
pub shm_size: Option<i64>,

/// A list of kernel parameters (sysctls) to set in the container. For example: ``` {\"net.ipv4.ip_forward\": \"1\"} ```
#[serde(rename = "Sysctls")]
Expand Down Expand Up @@ -2231,12 +2231,12 @@ pub struct ImageId {
/// Information about an image in the local image cache.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct ImageInspect {
/// ID is the content-addressable ID of an image. This identified is a content-addressable digest calculated from the image's configuration (which includes the digests of layers used by the image). Note that this digest differs from the `RepoDigests` below, which holds digests of image manifests that reference the image.
/// ID is the content-addressable ID of an image. This identifier is a content-addressable digest calculated from the image's configuration (which includes the digests of layers used by the image). Note that this digest differs from the `RepoDigests` below, which holds digests of image manifests that reference the image.
#[serde(rename = "Id")]
#[serde(skip_serializing_if="Option::is_none")]
pub id: Option<String>,

/// List of image names/tags in the local image cache that reference this image. Multiple image tags can refer to the same imagem and this list may be empty if no tags reference the image, in which case the image is \"untagged\", in which case it can still be referenced by its ID.
/// List of image names/tags in the local image cache that reference this image. Multiple image tags can refer to the same image, and this list may be empty if no tags reference the image, in which case the image is \"untagged\", in which case it can still be referenced by its ID.
#[serde(rename = "RepoTags")]
#[serde(skip_serializing_if="Option::is_none")]
pub repo_tags: Option<Vec<String>>,
Expand Down Expand Up @@ -2390,36 +2390,46 @@ pub struct ImageSearchResponseItem {

#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct ImageSummary {
/// ID is the content-addressable ID of an image. This identifier is a content-addressable digest calculated from the image's configuration (which includes the digests of layers used by the image). Note that this digest differs from the `RepoDigests` below, which holds digests of image manifests that reference the image.
#[serde(rename = "Id")]
pub id: String,

/// ID of the parent image. Depending on how the image was created, this field may be empty and is only set for images that were built/created locally. This field is empty if the image was pulled from an image registry.
#[serde(rename = "ParentId")]
pub parent_id: String,

/// List of image names/tags in the local image cache that reference this image. Multiple image tags can refer to the same image, and this list may be empty if no tags reference the image, in which case the image is \"untagged\", in which case it can still be referenced by its ID.
#[serde(rename = "RepoTags")]
#[serde(deserialize_with = "deserialize_nonoptional_vec")]
pub repo_tags: Vec<String>,

/// List of content-addressable digests of locally available image manifests that the image is referenced from. Multiple manifests can refer to the same image. These digests are usually only available if the image was either pulled from a registry, or if the image was pushed to a registry, which is when the manifest is generated and its digest calculated.
#[serde(rename = "RepoDigests")]
#[serde(deserialize_with = "deserialize_nonoptional_vec")]
pub repo_digests: Vec<String>,

/// Date and time at which the image was created as a Unix timestamp (number of seconds sinds EPOCH).
#[serde(rename = "Created")]
pub created: i64,

/// Total size of the image including all layers it is composed of.
#[serde(rename = "Size")]
pub size: i64,

/// Total size of image layers that are shared between this image and other images. This size is not calculated by default. `-1` indicates that the value has not been set / calculated.
#[serde(rename = "SharedSize")]
pub shared_size: i64,

/// Total size of the image including all layers it is composed of. In versions of Docker before v1.10, this field was calculated from the image itself and all of its parent images. Docker v1.10 and up store images self-contained, and no longer use a parent-chain, making this field an equivalent of the Size field. This field is kept for backward compatibility, but may be removed in a future version of the API.
#[serde(rename = "VirtualSize")]
pub virtual_size: i64,

/// User-defined key/value metadata.
#[serde(rename = "Labels")]
#[serde(deserialize_with = "deserialize_nonoptional_map")]
pub labels: HashMap<String, String>,

/// Number of containers using this image. Includes both stopped and running containers. This size is not calculated by default, and depends on which API endpoint is used. `-1` indicates that the value has not been set / calculated.
#[serde(rename = "Containers")]
pub containers: i64,

Expand Down Expand Up @@ -6565,9 +6575,9 @@ pub struct TaskSpecResources {
pub limits: Option<Limit>,

/// Define resources reservation.
#[serde(rename = "Reservation")]
#[serde(rename = "Reservations")]
#[serde(skip_serializing_if="Option::is_none")]
pub reservation: Option<ResourceObject>,
pub reservations: Option<ResourceObject>,

}

Expand Down Expand Up @@ -6905,7 +6915,7 @@ impl ::std::convert::AsRef<str> for VolumeScopeEnum {

/// Volume configuration
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct VolumeConfig {
pub struct VolumeCreateOptions {
/// The new volume's name. If not specified, Docker generates a name.
#[serde(rename = "Name")]
#[serde(skip_serializing_if="Option::is_none")]
Expand Down Expand Up @@ -6933,13 +6943,13 @@ pub struct VolumeConfig {
pub struct VolumeListResponse {
/// List of volumes
#[serde(rename = "Volumes")]
#[serde(deserialize_with = "deserialize_nonoptional_vec")]
pub volumes: Vec<Volume>,
#[serde(skip_serializing_if="Option::is_none")]
pub volumes: Option<Vec<Volume>>,

/// Warnings that occurred when fetching the list of volumes.
#[serde(rename = "Warnings")]
#[serde(deserialize_with = "deserialize_nonoptional_vec")]
pub warnings: Vec<String>,
#[serde(skip_serializing_if="Option::is_none")]
pub warnings: Option<Vec<String>>,

}

Expand Down
20 changes: 14 additions & 6 deletions tests/volume_test.rs
Expand Up @@ -35,8 +35,11 @@ async fn list_volumes_test(docker: Docker) -> Result<(), Error> {
}))
.await?;

assert_eq!(results.volumes.len(), 1);
assert_eq!(results.volumes[0].name, "integration_test_list_volumes");
assert_eq!(results.volumes.as_ref().unwrap().len(), 1);
assert_eq!(
results.volumes.as_ref().unwrap()[0].name,
"integration_test_list_volumes"
);

let remove_volume_options = RemoveVolumeOptions { force: true };
let _ = &docker
Expand Down Expand Up @@ -124,7 +127,7 @@ async fn prune_volumes_test(docker: Docker) -> Result<(), Error> {
}))
.await?;

assert_eq!(results.volumes.len(), 0);
assert_eq!(results.volumes, None);

let mut list_volumes_filters = HashMap::new();
list_volumes_filters.insert("label", vec!["maintainer=bollard-maintainer"]);
Expand All @@ -135,8 +138,11 @@ async fn prune_volumes_test(docker: Docker) -> Result<(), Error> {
}))
.await?;

assert_eq!(results.volumes.len(), 1);
assert_eq!(results.volumes[0].name, "integration_test_prune_volumes_2");
assert_eq!(results.volumes.as_ref().unwrap().len(), 1);
assert_eq!(
results.volumes.as_ref().unwrap()[0].name,
"integration_test_prune_volumes_2"
);

let results = &docker.list_volumes::<String>(None).await?;

Expand All @@ -146,13 +152,15 @@ async fn prune_volumes_test(docker: Docker) -> Result<(), Error> {
String::from("bollard-maintainer"),
);

assert_ne!(0, results.volumes.len());
assert_ne!(0, results.volumes.as_ref().unwrap().len());

// we need to filter the results, because volumes without a label are not pruned
assert_eq!(
&expected_results_label,
&results
.volumes
.as_ref()
.unwrap()
.iter()
.find(|v| !v.labels.is_empty())
.unwrap()
Expand Down

0 comments on commit 79ea9ce

Please sign in to comment.