From 907d9d535bcb3431e6cf05c5353d5fc70821246d Mon Sep 17 00:00:00 2001 From: Dongsu Park Date: Tue, 27 Feb 2024 14:58:22 +0100 Subject: [PATCH 1/3] Split common library parts into a separate workspace Create a new workspace libazureinit, split common library parts into the separate lib. --- Cargo.toml | 26 +++++++++----------------- libazureinit/Cargo.toml | 22 ++++++++++++++++++++++ {src => libazureinit/src}/distro.rs | 0 {src => libazureinit/src}/goalstate.rs | 0 {src => libazureinit/src}/imds.rs | 0 {src => libazureinit/src}/lib.rs | 0 {src => libazureinit/src}/media.rs | 0 {src => libazureinit/src}/user.rs | 0 src/main.rs | 4 ++-- tests/functional_tests.rs | 6 +++--- 10 files changed, 36 insertions(+), 22 deletions(-) create mode 100644 libazureinit/Cargo.toml rename {src => libazureinit/src}/distro.rs (100%) rename {src => libazureinit/src}/goalstate.rs (100%) rename {src => libazureinit/src}/imds.rs (100%) rename {src => libazureinit/src}/lib.rs (100%) rename {src => libazureinit/src}/media.rs (100%) rename {src => libazureinit/src}/user.rs (100%) diff --git a/Cargo.toml b/Cargo.toml index 187aef1..fab82ba 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,29 +3,16 @@ name = "azure-init" version = "0.1.1" edition = "2021" -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - [dependencies] -reqwest = { version = "0.11.18", default-features = false, features = ["blocking", "json"] } -serde = {version = "1.0.163", features = ["derive"]} -serde_xml = "0.9.1" -serde_derive = "1.0" tokio = { version = "1", features = ["full"] } -serde-xml-rs = "0.6.0" -xml-rs = "0.8.13" -serde_json = "1.0.96" -rustfmt = "0.10.0" -nix = "0.26.2" -libc = "0.2.146" -fmt = "0.1.0" + +[dependencies.libazureinit] +path = "libazureinit" +version = "0.1.0" [profile.dev] incremental = true -[lib] -name = "lib" -path = "src/lib.rs" - [[bin]] name = "azure-init" path = "src/main.rs" @@ -33,3 +20,8 @@ path = "src/main.rs" [[bin]] name = "functional_tests" path = "tests/functional_tests.rs" + +[workspace] +members = [ + "libazureinit", +] diff --git a/libazureinit/Cargo.toml b/libazureinit/Cargo.toml new file mode 100644 index 0000000..dad16af --- /dev/null +++ b/libazureinit/Cargo.toml @@ -0,0 +1,22 @@ +[package] +name = "libazureinit" +version = "0.1.1" +edition = "2021" + +[dependencies] +reqwest = { version = "0.11.18", default-features = false, features = ["blocking", "json"] } +serde = {version = "1.0.163", features = ["derive"]} +serde_xml = "0.9.1" +serde_derive = "1.0" +tokio = { version = "1", features = ["full"] } +serde-xml-rs = "0.6.0" +xml-rs = "0.8.13" +serde_json = "1.0.96" +rustfmt = "0.10.0" +nix = "0.26.2" +libc = "0.2.146" + +[lib] +name = "libazureinit" +path = "src/lib.rs" + diff --git a/src/distro.rs b/libazureinit/src/distro.rs similarity index 100% rename from src/distro.rs rename to libazureinit/src/distro.rs diff --git a/src/goalstate.rs b/libazureinit/src/goalstate.rs similarity index 100% rename from src/goalstate.rs rename to libazureinit/src/goalstate.rs diff --git a/src/imds.rs b/libazureinit/src/imds.rs similarity index 100% rename from src/imds.rs rename to libazureinit/src/imds.rs diff --git a/src/lib.rs b/libazureinit/src/lib.rs similarity index 100% rename from src/lib.rs rename to libazureinit/src/lib.rs diff --git a/src/media.rs b/libazureinit/src/media.rs similarity index 100% rename from src/media.rs rename to libazureinit/src/media.rs diff --git a/src/user.rs b/libazureinit/src/user.rs similarity index 100% rename from src/user.rs rename to libazureinit/src/user.rs diff --git a/src/main.rs b/src/main.rs index 391aaaf..e8b9c6c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,8 +1,8 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -use lib::distro::{Distribution, Distributions}; -use lib::{goalstate, imds, media, user}; +use libazureinit::distro::{Distribution, Distributions}; +use libazureinit::{goalstate, imds, media, user}; #[tokio::main] async fn main() { diff --git a/tests/functional_tests.rs b/tests/functional_tests.rs index 62fd07b..cebd55b 100644 --- a/tests/functional_tests.rs +++ b/tests/functional_tests.rs @@ -1,9 +1,9 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -use lib::distro::{Distribution, Distributions}; -use lib::imds::PublicKeys; -use lib::{goalstate, user}; +use libazureinit::distro::{Distribution, Distributions}; +use libazureinit::imds::PublicKeys; +use libazureinit::{goalstate, user}; use std::env; From 1bbe82f43bb10039e056d4bd8d069df15327ed32 Mon Sep 17 00:00:00 2001 From: Dongsu Park Date: Wed, 28 Feb 2024 17:01:27 +0100 Subject: [PATCH 2/3] Add package metadata fields in Cargo.toml for publishing to crates.io --- Cargo.toml | 5 +++++ libazureinit/Cargo.toml | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index fab82ba..8672b10 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,6 +2,11 @@ name = "azure-init" version = "0.1.1" edition = "2021" +repository = "https://github.com/Azure/azure-init/" +homepage = "https://github.com/Azure/azure-init/" +license = "MIT" +readme = "README.md" +description = "A reference implementation for provisioning Linux VMs on Azure." [dependencies] tokio = { version = "1", features = ["full"] } diff --git a/libazureinit/Cargo.toml b/libazureinit/Cargo.toml index dad16af..4926215 100644 --- a/libazureinit/Cargo.toml +++ b/libazureinit/Cargo.toml @@ -2,6 +2,10 @@ name = "libazureinit" version = "0.1.1" edition = "2021" +repository = "https://github.com/Azure/azure-init/" +homepage = "https://github.com/Azure/azure-init/" +license = "MIT" +description = "A common library for provisioning Linux VMs on Azure." [dependencies] reqwest = { version = "0.11.18", default-features = false, features = ["blocking", "json"] } From 0bdb62cf777fb28ac8f5aa85b8d512dd7b55f385 Mon Sep 17 00:00:00 2001 From: Dongsu Park Date: Wed, 28 Feb 2024 18:06:35 +0100 Subject: [PATCH 3/3] Update a wording in the description in README, SUPPORT --- README.md | 8 ++++---- SUPPORT.md | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index acbab56..53d9bb9 100644 --- a/README.md +++ b/README.md @@ -2,13 +2,13 @@ [![Github CI](https://github.com/Azure/azure-init/actions/workflows/ci.yaml/badge.svg)](https://github.com/Azure/azure-init/actions) -A minimal guest agent implementation for provisioning Linux VMs on Azure. +A reference implementation for provisioning Linux VMs on Azure. -The agent configures Linux guests from provisioning metadata. -Contrary to complex guest configuration and customisation systems like e.g. cloud-init, Azure-Init aims to be minimal. +Azure-init configures Linux guests from provisioning metadata. +Contrary to complex guest configuration and customisation systems like e.g. cloud-init, azure-init aims to be minimal. It strictly focuses on basic instance initialisation from Azure metadata. -Azure-Init has very few requirements on its environment, so it may run in a very early stage of the boot process. +Azure-init has very few requirements on its environment, so it may run in a very early stage of the boot process. ## Installing Rust diff --git a/SUPPORT.md b/SUPPORT.md index ef03337..bb68b0f 100644 --- a/SUPPORT.md +++ b/SUPPORT.md @@ -15,4 +15,4 @@ Feel free to [start a new discussion](https://github.com/Azure/azure-init/discus ## Microsoft Support Policy -Support for the Azure-Init is limited to the resources listed above. +Support for the azure-init is limited to the resources listed above.