Skip to content

Commit b575bbc

Browse files
authored
docker: fix and docu (#108)
- fixed `omnect-cli ssh set-certificate` command in `omnect/omnect-cli:0.20.1` docker image - documented `-b` option to create bmap file is not working in `omnect/omnect-cli` docker image @empwilli @mlilien we need to refine how we can support bmap file generation in docker distroless. Either we implement our self or we copy all the python deps into distroless image. Are there other options?
1 parent 519d771 commit b575bbc

File tree

8 files changed

+33
-22
lines changed

8 files changed

+33
-22
lines changed

CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [0.20.2] Q1 2024
9+
- omnect/omnect-cli docker image:
10+
- fixed `omnect-cli ssh set-certificate` command
11+
- documented `-b` option to create bmap file is not working
12+
813
## [0.20.1] Q1 2024
914
- added distroless docker image
1015
- refactored partition handling of file functions

Cargo.lock

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ license = "MIT OR Apache-2.0"
77
name = "omnect-cli"
88
readme = "README.md"
99
repository = "https://github.com/omnect/omnect-cli"
10-
version = "0.20.1"
10+
version = "0.20.2"
1111

1212
[dependencies]
1313
actix-web = "4.4"

Dockerfile

+7-6
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,17 @@ RUN <<EOT
3333

3434
mkdir -p /copy/status.d
3535

36-
executables=( \
37-
/usr/bin/omnect-cli \
38-
/usr/sbin/fdisk \
36+
executables=(
3937
/usr/bin/dd \
40-
/usr/bin/sync \
41-
/usr/bin/e2mkdir \
4238
/usr/bin/e2cp \
39+
/usr/bin/e2mkdir \
4340
/usr/bin/fallocate \
4441
/usr/bin/mcopy \
45-
)
42+
/usr/bin/omnect-cli \
43+
/usr/bin/ssh-keygen \
44+
/usr/bin/sync \
45+
/usr/sbin/fdisk \
46+
)
4647

4748
for executable in ${executables[@]}; do
4849
echo "${executable}"

README.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,11 @@ docker run --rm -it \
4040
-v "$(pwd)":/source \
4141
-e RUST_LOG=debug \
4242
-u $(id -u) \
43-
omnect/omnect-cli:0.20.1 file copy-to-image --files /source/my-source-file,boot:/my-dest-file -i /source/my-image.wic
43+
omnect/omnect-cli:latest file copy-to-image --files /source/my-source-file,boot:/my-dest-file -i /source/my-image.wic
4444
```
4545

46-
**Note**: `omnect-cli ssh set-connection`command is currently not supported by docker image.
46+
**Note1**: `omnect-cli ssh set-connection`command is not supported by docker image.
47+
**Note2**: `-b` option to create bmap file is not supported by docker image.
4748

4849
# Build from sources
4950

build-image.sh

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
# local build
2+
cli_version=$(toml get --raw Cargo.toml package.version)
3+
rust_version="1.76.0-bookworm"
4+
25
docker build \
36
--build-arg docker_namespace=omnectweucopsacr.azurecr.io \
4-
--build-arg version_rust_container=1.76.0-bookworm \
5-
--build-arg omnect_cli_version=0.20.1 \
7+
--build-arg version_rust_container="${rust_version}" \
8+
--build-arg omnect_cli_version="${cli_version}" \
69
--build-arg debian_dir=target/debian \
10+
--build-arg add_cicd_tools=true \
711
-f Dockerfile \
812
--progress=plain \
9-
-t omnect-cli:0.20.1 .
13+
-t omnect-cli:"${cli_version}" .

src/cli.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ pub enum File {
2222
/// path to wic image file (optionally compressed with xz, bzip2 or gzip)
2323
#[arg(short = 'i', long = "image")]
2424
image: PathBuf,
25-
/// optional: generate bmap file
25+
/// optional: generate bmap file (currently not working in docker image)
2626
#[arg(short = 'b', long = "generate-bmap-file")]
2727
generate_bmap: bool,
2828
/// optional: pack image [xz, bzip2, gzip]
@@ -55,7 +55,7 @@ pub enum IdentityConfig {
5555
/// path to wic image file (optionally compressed with xz, bzip2 or gzip)
5656
#[arg(short = 'i', long = "image")]
5757
image: PathBuf,
58-
/// optional: generate bmap file
58+
/// optional: generate bmap file (currently not working in docker image)
5959
#[arg(short = 'b', long = "generate-bmap-file")]
6060
generate_bmap: bool,
6161
/// optional: pack image [xz, bzip2, gzip]
@@ -79,7 +79,7 @@ pub enum IdentityConfig {
7979
/// path to device identity certificate key file
8080
#[arg(short = 'k', long = "device_identity_key")]
8181
device_identity_key: PathBuf,
82-
/// optional: generate bmap file
82+
/// optional: generate bmap file (currently not working in docker image)
8383
#[arg(short = 'b', long = "generate-bmap-file")]
8484
generate_bmap: bool,
8585
/// optional: pack image [xz, bzip2, gzip]
@@ -97,7 +97,7 @@ pub enum IdentityConfig {
9797
/// path to root ca certificate file
9898
#[arg(short = 'r', long = "root_ca")]
9999
root_ca: PathBuf,
100-
/// optional: generate bmap file
100+
/// optional: generate bmap file (currently not working in docker image)
101101
#[arg(short = 'b', long = "generate-bmap-file")]
102102
generate_bmap: bool,
103103
/// optional: pack image [xz, bzip2, gzip]
@@ -121,7 +121,7 @@ pub enum IdentityConfig {
121121
/// period of validity in days
122122
#[arg(short = 'D', long = "days")]
123123
days: u32,
124-
/// optional: generate bmap file
124+
/// optional: generate bmap file (currently not working in docker image)
125125
#[arg(short = 'b', long = "generate-bmap-file")]
126126
generate_bmap: bool,
127127
/// optional: pack image [xz, bzip2, gzip]
@@ -142,7 +142,7 @@ pub enum IotHubDeviceUpdate {
142142
/// path to wic image file (optionally compressed with xz, bzip2 or gzip)
143143
#[arg(short = 'i', long = "image")]
144144
image: PathBuf,
145-
/// optional: generate bmap file
145+
/// optional: generate bmap file (currently not working in docker image)
146146
#[arg(short = 'b', long = "generate-bmap-file")]
147147
generate_bmap: bool,
148148
/// optional: pack image [xz, bzip2, gzip]
@@ -237,7 +237,7 @@ pub enum SshConfig {
237237
/// device-id
238238
#[arg(short = 'd', long = "device-principal")]
239239
device_principal: String,
240-
/// optional: generate bmap file
240+
/// optional: generate bmap file (currently not working in docker image)
241241
#[arg(short = 'b', long = "generate-bmap-file")]
242242
generate_bmap: bool,
243243
/// optional: pack image [xz, bzip2, gzip]

src/device_update.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -265,9 +265,9 @@ pub async fn import_update(
265265
],
266266
}];
267267

268-
let import_update = serde_json::to_string(&import_update).context("context")?;
268+
let import_update = serde_json::to_string_pretty(&import_update).context("Cannot parse import_update")?;
269269

270-
debug!("{import_update}");
270+
debug!("import update: {import_update}");
271271

272272
let import_update_response = client.import_update(&instance_id, import_update).await?;
273273
info!("Result of import: {:?}", &import_update_response);

0 commit comments

Comments
 (0)