15 Commits

Author SHA1 Message Date
dependabot[bot] aa315b45ce Update thiserror requirement from 1.0.48 to 2.0.11
Updates the requirements on [thiserror](https://github.com/dtolnay/thiserror) to permit the latest version.
- [Release notes](https://github.com/dtolnay/thiserror/releases)
- [Commits](https://github.com/dtolnay/thiserror/compare/1.0.48...2.0.11)

---
updated-dependencies:
- dependency-name: thiserror
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-01-10 18:29:31 +00:00
dependabot[bot] 9b602f70a6 Merge pull request #64 from anthonyoteri/dependabot/cargo/simple_logger-5.0.0 2024-05-21 18:54:24 +00:00
dependabot[bot] f12615a7f2 Update simple_logger requirement from 4.2.0 to 5.0.0
Updates the requirements on [simple_logger](https://github.com/borntyping/rust-simple_logger) to permit the latest version.
- [Release notes](https://github.com/borntyping/rust-simple_logger/releases)
- [Commits](https://github.com/borntyping/rust-simple_logger/compare/v4.2.0...v5.0.0)

---
updated-dependencies:
- dependency-name: simple_logger
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-07 18:23:41 +00:00
dependabot[bot] 39c03a2b5b Merge pull request #59 from anthonyoteri/dependabot/cargo/env_logger-0.11.3 2024-05-06 19:28:45 +00:00
dependabot[bot] f836b26930 Merge pull request #63 from anthonyoteri/dependabot/cargo/reqwest-0.12.3 2024-05-06 19:28:33 +00:00
dependabot[bot] 0d9761178c Update reqwest requirement from 0.11.20 to 0.12.3
Updates the requirements on [reqwest](https://github.com/seanmonstar/reqwest) to permit the latest version.
- [Release notes](https://github.com/seanmonstar/reqwest/releases)
- [Changelog](https://github.com/seanmonstar/reqwest/blob/master/CHANGELOG.md)
- [Commits](https://github.com/seanmonstar/reqwest/compare/v0.11.20...v0.12.3)

---
updated-dependencies:
- dependency-name: reqwest
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-04-05 18:44:24 +00:00
dependabot[bot] 358a19f6f7 Update env_logger requirement from 0.10.0 to 0.11.3
Updates the requirements on [env_logger](https://github.com/rust-cli/env_logger) to permit the latest version.
- [Release notes](https://github.com/rust-cli/env_logger/releases)
- [Changelog](https://github.com/rust-cli/env_logger/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rust-cli/env_logger/compare/v0.10.0...v0.11.3)

---
updated-dependencies:
- dependency-name: env_logger
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-05 18:16:31 +00:00
dependabot[bot] 0527b6268d Merge pull request #55 from anthonyoteri/dependabot/github_actions/github/codeql-action-3 2023-12-27 13:25:38 +00:00
dependabot[bot] 67c02581f3 Bump github/codeql-action from 2 to 3
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2 to 3.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/v2...v3)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-13 18:20:08 +00:00
dependabot[bot] b6fda7162f Merge pull request #54 from anthonyoteri/dependabot/cargo/http-1.0.0 2023-11-16 16:18:29 +00:00
Anthony Oteri 07746429bb Be consistent with use of http and reqwest libraries
The types may have similar names but are distinct types and should be used consistently.  This changes
the code to use the header and status code information directly from the `reqwests` library instead of
mixing the two.

Signed-off-by: Anthony Oteri <anthony.oteri@gmail.com>
2023-11-16 10:30:03 -05:00
dependabot[bot] 23f1d21a2e Update http requirement from 0.2.9 to 1.0.0
Updates the requirements on [http](https://github.com/hyperium/http) to permit the latest version.
- [Release notes](https://github.com/hyperium/http/releases)
- [Changelog](https://github.com/hyperium/http/blob/master/CHANGELOG.md)
- [Commits](https://github.com/hyperium/http/compare/v0.2.9...v1.0.0)

---
updated-dependencies:
- dependency-name: http
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-11-15 18:32:17 +00:00
Anthony Oteri 5e7d0e4e1e Release version 1.1.0 2023-10-03 09:55:09 -04:00
Anthony Oteri 600c2d86ac Merge pull request #52 from anthonyoteri/license
Change License to MIT/Apache
2023-10-03 09:48:38 -04:00
Anthony Oteri 0e4219b405 Change License
This changes the effective license from a simple Apache-2.0 license to a
dual license consisting of both Apache-2.0 and the MIT license to be more
compatible for use in GPL Code.

The MIT license requires reproducing countless copies of the same copyright
header with diffferent names in the copyright field, for every MIT library
in use.  The Apache license does not have this drawback.  However, this is not
the primary motivation for creating these issues.  The Apache license also has
protections from patent trolls and explicit contribuition licensing clause.
However the Apache license is incompatible with GPLv2.  This is why Rust is
dual-licensed as MIT/Apache (the "primary" license being Apache, MIT only for
GPLv2 compat), and doing so would be wise for this project.  This also makes
this crate suitable for inclusion and unrestricted sharing in the Rust
standard distribution and other projects using dual MIT/Apache.
2023-10-03 09:36:43 -04:00
18 changed files with 132 additions and 121 deletions
+1 -1
View File
@@ -45,7 +45,7 @@ jobs:
continue-on-error: true
- name: Upload analysis results ot GitHub
uses: github/codeql-action/upload-sarif@v2
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: rust-clippy-results.sarif
wait-for-processing: true
+6
View File
@@ -0,0 +1,6 @@
<component name="CopyrightManager">
<copyright>
<option name="notice" value="Copyright 2023 Anthony Oteri&#10;&#10;Licensed under the Apache License, Version 2.0, &lt;LICENSE-APACHE or&#10;http://apache.org/licenses/LICENSE-2.0&gt; or the MIT license &lt;LICENSE-MIT or&#10;http://opensource.org/licenses/MIT&gt;, at your option. This file may not be&#10;copied, modified, or distributed except according to those terms." />
<option name="myName" value="MIT OR Apache-2.0 (personal)" />
</copyright>
</component>
+1 -1
View File
@@ -1,7 +1,7 @@
<component name="CopyrightManager">
<settings>
<module2copyright>
<element module="Project Files" copyright="Apache License (personal)" />
<element module="Project Files" copyright="MIT OR Apache-2.0 (personal)" />
</module2copyright>
</settings>
</component>
+7 -7
View File
@@ -1,13 +1,13 @@
[package]
name = "dredge-tool"
version = "1.0.0"
version = "1.1.0"
edition = "2021"
authors = ["Anthony Oteri"]
description = "A Command Line tool for interracting with the Docker Registry API"
readme = "README.md"
repository = "https://github.com/anthonyoteri/dredge"
rust-version = "1.72"
license-file = "LICENSE"
license = "MIT OR Apache-2.0"
keywords = [
"docker",
"registry",
@@ -27,15 +27,15 @@ name = "dredge"
[dependencies]
clap = { version = "4.4.3", features = ["derive", "env", "wrap_help"] }
simple_logger = { version = "4.2.0", features = ["timestamps", "colors", "stderr"] }
http = "0.2.9"
simple_logger = { version = "5.0.0", features = ["timestamps", "colors", "stderr"] }
http = "1.0.0"
indoc = "2.0.4"
log = "0.4.20"
reqwest = { version = "0.11.20", features = ["json", "gzip", "multipart", "native-tls-vendored"] }
reqwest = { version = "0.12.3", features = ["json", "gzip", "multipart", "native-tls-vendored"] }
serde = { version = "1.0.188", features = ["derive"] }
serde_toml = "0.0.1"
serde_yaml = "0.9.25"
thiserror = "1.0.48"
thiserror = "2.0.11"
toml = "0.8.0"
url = { version = "2.4.1", features = ["serde"] }
xdg = "2.5.2"
@@ -43,4 +43,4 @@ tokio = { version = "1.32.0", features = ["macros"] }
[dev-dependencies]
mockito = "1.2.0"
env_logger = "0.10.0"
env_logger = "0.11.3"
View File
+24
View File
@@ -0,0 +1,24 @@
Permission is hereby granted, free of charge, to any
person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the
Software without restriction, including without
limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software
is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice
shall be included in all copies or substantial portions
of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
+17 -1
View File
@@ -106,4 +106,20 @@ Arguments:
Options:
-h, --help Print help
```
```
## License
Licensed under either of
* Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
* MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)
at your option.
### Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted
for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any
additional terms or conditions.
+9
View File
@@ -1,11 +1,20 @@
# Dredge Release Notes
## Legal
As of version 1.1.0, this software license has been changed from Apache-2.0
to a dual-licensed Apache-2.0 OR MIT license.
## Known Issues
* Docker authentication is not currently supported, and attempts to query a
registry which requires authentication will fail.
## Changelog
- v1.1.0
- Change License by Anthony Oteri 0e4219b
- v1.0.0
- Rename project to dredge-tool by Anthony Oteri b60d433
+3
View File
@@ -0,0 +1,3 @@
- v1.1.0
- Change License by Anthony Oteri 0e4219b
+5
View File
@@ -1,5 +1,10 @@
# Dredge Release Notes
## Legal
As of version 1.1.0, this software license has been changed from Apache-2.0
to a dual-licensed Apache-2.0 OR MIT license.
## Known Issues
* Docker authentication is not currently supported, and attempts to query a
+9 -16
View File
@@ -1,21 +1,14 @@
#
# Copyright 2023 Anthony Oteri
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#!/usr/bin/bash
#
# Copyright 2023 Anthony Oteri
#
# Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
# http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
# http://opensource.org/licenses/MIT>, at your option. This file may not be
# copied, modified, or distributed except according to those terms.
#
set -e
REPO_ROOT=$(git rev-parse --show-toplevel)
+8 -13
View File
@@ -1,20 +1,15 @@
#!/usr/bin/bash
#
# Copyright 2023 Anthony Oteri
# Copyright 2023 Anthony Oteri
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
# http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
# http://opensource.org/licenses/MIT>, at your option. This file may not be
# copied, modified, or distributed except according to those terms.
#
#!/usr/bin/bash -e
set -e
version=$1
previous=$2
+8 -13
View File
@@ -1,20 +1,15 @@
#!/usr/bin/bash
#
# Copyright 2023 Anthony Oteri
# Copyright 2023 Anthony Oteri
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
# http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
# http://opensource.org/licenses/MIT>, at your option. This file may not be
# copied, modified, or distributed except according to those terms.
#
#!/usr/bin/bash
set -e
REPO_ROOT=$(git rev-parse --show-toplevel)
+14 -21
View File
@@ -1,20 +1,15 @@
/*
* Copyright 2023 Anthony Oteri
* Copyright 2023 Anthony Oteri
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
* http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
* http://opensource.org/licenses/MIT>, at your option. This file may not be
* copied, modified, or distributed except according to those terms.
*/
use http::header;
use reqwest::header;
use reqwest::header::HeaderValue;
use reqwest::StatusCode;
use serde::Deserialize;
use url::Url;
@@ -59,7 +54,7 @@ pub async fn fetch_paginated<T: for<'de> Deserialize<'de>>(
responses.push(json);
}
if let Some(p) = parse_rfc5988(headers.get(http::header::LINK))? {
if let Some(p) = parse_rfc5988(headers.get(header::LINK))? {
next_path = p;
} else {
break;
@@ -80,7 +75,7 @@ pub async fn fetch_paginated<T: for<'de> Deserialize<'de>>(
///
/// Returns and `ApiError` if there is a problem parsing contents of the
/// supplied header value.
fn parse_rfc5988(header_value: Option<&http::HeaderValue>) -> Result<Option<String>, ApiError> {
fn parse_rfc5988(header_value: Option<&HeaderValue>) -> Result<Option<String>, ApiError> {
log::trace!("parse_rfc5988(header_value: {header_value:?})");
if let Some(link_value) = header_value {
@@ -134,7 +129,7 @@ pub fn parse_response_status(response: &reqwest::Response) -> Result<(), ApiErro
log::trace!("parse_response_status(response: {response:?})");
match response.status() {
http::StatusCode::OK | http::StatusCode::ACCEPTED => {
StatusCode::OK | StatusCode::ACCEPTED => {
let headers = response.headers();
if let Some(header_value) = headers.get("Docker-Distribution-API-Version") {
if header_value.to_str()? == "registry/2.0" {
@@ -148,8 +143,8 @@ pub fn parse_response_status(response: &reqwest::Response) -> Result<(), ApiErro
))
}
}
http::StatusCode::METHOD_NOT_ALLOWED => Err(ApiError::MethodNotAllowed),
http::StatusCode::UNAUTHORIZED => {
StatusCode::METHOD_NOT_ALLOWED => Err(ApiError::MethodNotAllowed),
StatusCode::UNAUTHORIZED => {
let headers = response.headers();
if let Some(header_value) = headers.get("Docker-Distribution-API-Version") {
if header_value.to_str()? == "registry/2.0" {
@@ -163,7 +158,7 @@ pub fn parse_response_status(response: &reqwest::Response) -> Result<(), ApiErro
))
}
}
http::StatusCode::NOT_FOUND => Err(ApiError::NotFound),
StatusCode::NOT_FOUND => Err(ApiError::NotFound),
e => Err(ApiError::UnexpectedResponse(format!(
"Undocumented status code: {e:?}"
))),
@@ -199,8 +194,6 @@ pub async fn get_digest(client: &reqwest::Client, url: &Url) -> Result<String, A
#[cfg(test)]
mod tests {
use http::header::HeaderValue;
use super::*;
/// Test parsing a valid RFC5988 header value.
+5 -12
View File
@@ -1,17 +1,10 @@
/*
* Copyright 2023 Anthony Oteri
* Copyright 2023 Anthony Oteri
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
* http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
* http://opensource.org/licenses/MIT>, at your option. This file may not be
* copied, modified, or distributed except according to those terms.
*/
#![allow(unused_imports)]
+5 -12
View File
@@ -1,17 +1,10 @@
/*
* Copyright 2023 Anthony Oteri
* Copyright 2023 Anthony Oteri
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
* http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
* http://opensource.org/licenses/MIT>, at your option. This file may not be
* copied, modified, or distributed except according to those terms.
*/
use std::io::Write;
+5 -12
View File
@@ -1,17 +1,10 @@
/*
* Copyright 2023 Anthony Oteri
* Copyright 2023 Anthony Oteri
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
* http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
* http://opensource.org/licenses/MIT>, at your option. This file may not be
* copied, modified, or distributed except according to those terms.
*/
#![allow(clippy::enum_variant_names)]
+5 -12
View File
@@ -1,17 +1,10 @@
/*
* Copyright 2023 Anthony Oteri
* Copyright 2023 Anthony Oteri
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
* http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
* http://opensource.org/licenses/MIT>, at your option. This file may not be
* copied, modified, or distributed except according to those terms.
*/
#![deny(clippy::pedantic)]