Skip to content
Open
Show file tree
Hide file tree
Changes from 59 commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
ba55580
Port osmodifier from Go binary to native Rust crate
bfjelds May 11, 2026
9684c93
fix: correct module.options type (HashMap not Option) and remove unus…
bfjelds May 11, 2026
accd65e
fix: remove osmodifier binary from pipelines, Makefile, and functiona…
bfjelds May 11, 2026
30afe99
fix: restore Path import in osconfig and remove unused imports
bfjelds May 11, 2026
6303de6
fix: apply cargo fmt formatting
bfjelds May 11, 2026
e64322f
fix: resolve clippy redundant_closure warning
bfjelds May 11, 2026
0c7e5ad
fix: remove stale osmodifier option and constant from conftest.py
bfjelds May 12, 2026
dff2cc2
fix: address deep review findings - atomic writes, security, correctness
bfjelds May 12, 2026
7a25b62
fix: remove trailing newline from hostname write to match Go behavior
bfjelds May 12, 2026
23ca4c8
Add functional tests for osmodifier crate
bfjelds May 14, 2026
ee3bb10
fix: apply cargo fmt formatting corrections
bfjelds May 14, 2026
9399a1e
fix: update Cargo.lock with osmodifier test dependencies
bfjelds May 14, 2026
d7e563b
docs: add README mapping Rust port to Go source files
bfjelds May 16, 2026
afa8641
refactor: use Dependency enum for system tool invocations
bfjelds May 16, 2026
a97e604
simplify: remove chroot codepath from osmodifier
bfjelds May 16, 2026
691b577
fix: break cyclic dependency between osutils and osmodifier
bfjelds May 16, 2026
33fb451
fix: update Cargo.lock after removing osutils→osmodifier dependency
bfjelds May 16, 2026
af8c03b
fix: use full import path osutils::dependencies::Dependency
bfjelds May 16, 2026
cba55c5
fix: remove trailing blank lines (cargo fmt)
bfjelds May 16, 2026
0e2ab38
fix: cargo fmt and unused variable warning
bfjelds May 16, 2026
e60b892
osmodifier: replace regex grub parsing with faithful Go-style string …
bfjelds May 20, 2026
972b025
osmodifier: fix service and module divergences from Go
bfjelds May 20, 2026
bbced72
osmodifier: remove regex from selinux.rs
bfjelds May 20, 2026
5f8b50a
update Cargo.lock: remove regex dep from osmodifier
bfjelds May 20, 2026
9594124
fix: use CommandOutput::output() API and remove unused variable
bfjelds May 20, 2026
262a826
osmodifier: expand grub test coverage
bfjelds May 20, 2026
d66adcc
fix: cargo fmt
bfjelds May 20, 2026
6c03939
fix: test_add_extra_cmdline_basic used duplicate key
bfjelds May 20, 2026
958d1f4
osmodifier: fix bugs found by 9-agent deep review
bfjelds May 20, 2026
2ae3b2a
fix: cargo fmt
bfjelds May 20, 2026
663780c
osmodifier: update README with grub parsing notes and fidelity fixes
bfjelds May 20, 2026
1b35b07
osmodifier: expand sync guide with function mapping and update playbook
bfjelds May 20, 2026
e184b53
test: add unit tests for OsModifierContext.path
bfjelds May 20, 2026
4123c85
fix: address Copilot review comments on osmodifier port
bfjelds May 20, 2026
4a77e43
fix: correct grub2-tools to grub2 in RPM Suggests
bfjelds May 21, 2026
564db8a
update lock
bfjelds May 21, 2026
f48df6b
fix: correct misleading test comment in services.rs
bfjelds May 21, 2026
ca1ebbd
fix: use grub2-tools instead of grub2 in RPM Suggests
bfjelds May 21, 2026
83c8b5b
fix: address Copilot review round 3
bfjelds May 21, 2026
801da3c
docs: document intentional lack of brace tracking in grub_cfg parser
bfjelds May 21, 2026
713bd44
docs: trim brace tracking comment
bfjelds May 21, 2026
112371b
style: fix rustfmt formatting
bfjelds May 21, 2026
776703d
fix: reject carriage returns in startup command validation
bfjelds May 21, 2026
1cce4a4
fix: fidelity fixes for osmodifier Go-to-Rust port
bfjelds May 21, 2026
0a962e5
update docs for api changes
bfjelds May 21, 2026
fc245ef
osmodifier: clarify password expiry field matches Go behavior
bfjelds May 21, 2026
092d855
osmodifier: address PR #638 review comments
bfjelds May 25, 2026
2d7e17a
osmodifier: propagate error from days_since_unix_epoch
bfjelds May 25, 2026
877f86b
osmodifier: document submenu tracking limitation in grub_cfg parser
bfjelds May 25, 2026
300c784
docs: fix Storage-Rules table header + SELinux doc comments
bfjelds May 25, 2026
442c766
osmodifier: fix OsModifierContext doc comment
bfjelds May 25, 2026
5bb9092
osmodifier: rustfmt formatting fixes
bfjelds May 25, 2026
efbdf22
osmodifier: fix ? in non-Result closure for days_since_unix_epoch
bfjelds May 25, 2026
dc6f57f
osmodifier: fix clippy doc_lazy_continuation warnings
bfjelds May 25, 2026
be703e4
osmodifier: add security=selinux to JSON schema descriptions
bfjelds May 25, 2026
c7a1bb8
docbuilder: fix 'Mount Path' column header to 'Partition Type'
bfjelds May 25, 2026
3d62e68
osmodifier: regenerate schema and docs from Rust source
bfjelds May 25, 2026
9fcdb66
osmodifier: remove unused serde_yaml dependency
bfjelds May 25, 2026
37fc1c1
osmodifier: update Cargo.lock after removing serde_yaml
bfjelds May 25, 2026
39cb990
osmodifier: take() stdin before wait_with_output()
bfjelds May 25, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,6 @@ stages:

- template: ../common_tasks/update-protoc.yml

- template: ../common_tasks/download-osmodifier.yml
parameters:
tridentSourceDirectory: $(TRIDENT_SOURCE_DIR)
osModifierBranch: ${{ parameters.osModifierBranch }}
targetArchitecture: amd64

- bash: |
set -eux

Expand Down
12 changes: 0 additions & 12 deletions .pipelines/templates/stages/trident_rpms/build-source.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,6 @@ stages:
- template: ../common_tasks/cargo-auth.yml
parameters:
cargoConfigPath: $(TRIDENT_SOURCE_DIR)/.cargo/config.toml
- template: ../common_tasks/download-osmodifier.yml
parameters:
tridentSourceDirectory: $(TRIDENT_SOURCE_DIR)
targetArchitecture: ${{ parameters.targetArchitecture }}
osModifierBranch: ${{ parameters.osModifierBranch }}
osModifierBuildType: ${{ parameters.osModifierBuildType }}
- template: release.yml
Comment thread
bfjelds marked this conversation as resolved.
parameters:
targetArchitecture: ${{ parameters.targetArchitecture }}
Expand Down Expand Up @@ -144,12 +138,6 @@ stages:
set -eux
sudo systemctl start docker
displayName: Start Docker
- template: ../common_tasks/download-osmodifier.yml
parameters:
tridentSourceDirectory: $(TRIDENT_SOURCE_DIR)
targetArchitecture: ${{ parameters.targetArchitecture }}
osModifierBranch: ${{ parameters.osModifierBranch }}
osModifierBuildType: ${{ parameters.osModifierBuildType }}
- template: release.yml
parameters:
targetArchitecture: ${{ parameters.targetArchitecture }}
Expand Down
13 changes: 0 additions & 13 deletions .pipelines/templates/stages/validate_makefile/dev-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,19 +85,6 @@ stages:
steps:
- template: ../common_tasks/checkout_trident.yml
- template: ../common_tasks/avoid-pypi-usage.yml
- bash: |
set -eux
make artifacts/osmodifier
rm -rf artifacts/osmodifier
displayName: Invoke make artifacts/osmodifier
workingDirectory: $(TRIDENT_SOURCE_DIR)

- template: ../common_tasks/download-osmodifier.yml
parameters:
tridentSourceDirectory: $(TRIDENT_SOURCE_DIR)
osModifierBuildType: dev
osModifierBranch: ${{ parameters.osModifierBranch }}
targetArchitecture: amd64

- script: |
set -eux
Expand Down
18 changes: 18 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ default-members = ["crates/trident"]
members = [
"crates/docbuilder",
"crates/trident-acl-agent",
"crates/osmodifier",
"crates/osutils",
"crates/pytest_gen",
"crates/pytest",
Expand Down
33 changes: 6 additions & 27 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -142,25 +142,8 @@ target/release/trident target/release/trident-acl-agent: .cargo/config | version
TRIDENT_VERSION="$(LOCAL_BUILD_TRIDENT_VERSION)" \
cargo build --release --features dangerous-options,grpc-preview -p trident -p trident-acl-agent

TOOLKIT_DIR="azure-linux-image-tools/toolkit"
AZL_TOOLS_OUT_DIR="$(TOOLKIT_DIR)/out/tools"
ARTIFACTS_DIR="artifacts"

# Build OSModifier from a local clone of azure-linux-image-tools.
# Make sure the repo has been cloned manually, via:
#
# git clone https://github.com/microsoft/azure-linux-image-tools

artifacts/osmodifier: packaging/docker/Dockerfile-osmodifier.azl3
@docker build -t trident/osmodifier-build:latest \
-f packaging/docker/Dockerfile-osmodifier.azl3 \
.
@mkdir -p "$(ARTIFACTS_DIR)"
@id=$$(docker create trident/osmodifier-build:latest) && \
docker cp -q $$id:/work/azure-linux-image-tools/toolkit/out/tools/osmodifier $@ || \
docker rm -v $$id
@touch $@

.PHONY: azl3-builder-image clean-azl3-builder-image build-azl3
azl3-builder-image:
@echo "Checking for local image $(AZL3_BUILDER_IMAGE)..."
Expand All @@ -185,7 +168,7 @@ target/azl3/release/trident target/azl3/release/trident-acl-agent: version-vars
cargo build --color always --target-dir target/azl3 --release --features dangerous-options,grpc-preview -p trident -p trident-acl-agent

# This will do a proper build on azl3, exactly as the pipelines would, with the custom registry and all.
bin/trident-rpms-azl3.tar.gz: packaging/docker/Dockerfile.full packaging/systemd/*.service packaging/rpm/trident.spec artifacts/osmodifier packaging/selinux-policy-trident/* version-vars
bin/trident-rpms-azl3.tar.gz: packaging/docker/Dockerfile.full packaging/systemd/*.service packaging/rpm/trident.spec packaging/selinux-policy-trident/* version-vars
$(eval CARGO_REGISTRIES_BMP_PUBLICPACKAGES_TOKEN := $(shell az account get-access-token --query "join(' ', ['Bearer', accessToken])" --output tsv))

@mkdir -p bin/
Expand All @@ -207,7 +190,7 @@ bin/trident-rpms-azl3.tar.gz: packaging/docker/Dockerfile.full packaging/systemd
@tar xf $@ -C bin/

# This one does a fast trick-build where we build locally and inject the binary into the container to add it to the RPM.
bin/trident-rpms.tar.gz: packaging/docker/Dockerfile.azl3 packaging/systemd/*.service packaging/rpm/trident.spec artifacts/osmodifier target/release/trident target/release/trident-acl-agent packaging/selinux-policy-trident/*
bin/trident-rpms.tar.gz: packaging/docker/Dockerfile.azl3 packaging/systemd/*.service packaging/rpm/trident.spec target/release/trident target/release/trident-acl-agent packaging/selinux-policy-trident/*
@mkdir -p bin/
@if [ ! -f bin/trident ] || ! cmp -s target/release/trident bin/trident; then \
cp target/release/trident bin/trident; \
Expand Down Expand Up @@ -390,7 +373,7 @@ functional-test: artifacts/trident-functest.qcow2
# A target for pipelines that skips all setup and building steps that are not
# required in the pipeline environment.
.PHONY: functional-test-core
functional-test-core: artifacts/osmodifier build-functional-test-cc generate-functional-test-manifest artifacts/trident-functest.qcow2 bin/virtdeploy
functional-test-core: build-functional-test-cc generate-functional-test-manifest artifacts/trident-functest.qcow2 bin/virtdeploy
python3 -u -m \
pytest --color=yes \
--log-level=INFO \
Expand All @@ -407,7 +390,7 @@ functional-test-core: artifacts/osmodifier build-functional-test-cc generate-fun
--build-output $(BUILD_OUTPUT)

.PHONY: patch-functional-test
patch-functional-test: artifacts/osmodifier build-functional-test-cc generate-functional-test-manifest
patch-functional-test: build-functional-test-cc generate-functional-test-manifest
python3 -u -m \
pytest --color=yes \
--log-level=INFO \
Expand Down Expand Up @@ -566,16 +549,14 @@ RUN_NETLAUNCH_TRIDENT_BIN ?= $(if $(filter yes,$(IS_UBUNTU_24_OR_NEWER)),target/
RUN_NETLAUNCH_LAUNCHER_BIN ?= $(if $(filter yes,$(IS_UBUNTU_24_OR_NEWER)),target/azl3/release/trident-acl-agent,target/release/trident-acl-agent)

.PHONY: run-netlaunch run-netlaunch-stream
run-netlaunch: $(NETLAUNCH_CONFIG) $(TRIDENT_CONFIG) $(NETLAUNCH_ISO) bin/netlaunch validate artifacts/osmodifier $(RUN_NETLAUNCH_TRIDENT_BIN) $(RUN_NETLAUNCH_LAUNCHER_BIN)
run-netlaunch: $(NETLAUNCH_CONFIG) $(TRIDENT_CONFIG) $(NETLAUNCH_ISO) bin/netlaunch validate $(RUN_NETLAUNCH_TRIDENT_BIN) $(RUN_NETLAUNCH_LAUNCHER_BIN)
@echo "Using trident binary: $(RUN_NETLAUNCH_TRIDENT_BIN)"
@mkdir -p artifacts/test-image
@cp $(RUN_NETLAUNCH_TRIDENT_BIN) artifacts/test-image/trident
@cp $(RUN_NETLAUNCH_LAUNCHER_BIN) artifacts/test-image/trident-acl-agent
@cp artifacts/osmodifier artifacts/test-image/
@bin/netlaunch \
--trident-binary $(RUN_NETLAUNCH_TRIDENT_BIN) \
--launcher-binary $(RUN_NETLAUNCH_LAUNCHER_BIN) \
--osmodifier-binary artifacts/osmodifier \
--rcp-agent-mode cli \
--iso $(NETLAUNCH_ISO) \
$(if $(NETLAUNCH_PORT),--port $(NETLAUNCH_PORT)) \
Expand All @@ -587,15 +568,13 @@ run-netlaunch: $(NETLAUNCH_CONFIG) $(TRIDENT_CONFIG) $(NETLAUNCH_ISO) bin/netlau
--trace-file trident-metrics.jsonl \
$(if $(LOG_TRACE),--log-trace)

run-netlaunch-stream: $(NETLAUNCH_CONFIG) $(TRIDENT_CONFIG) $(NETLAUNCH_ISO) bin/netlaunch artifacts/osmodifier $(RUN_NETLAUNCH_TRIDENT_BIN)
run-netlaunch-stream: $(NETLAUNCH_CONFIG) $(TRIDENT_CONFIG) $(NETLAUNCH_ISO) bin/netlaunch $(RUN_NETLAUNCH_TRIDENT_BIN)
@echo "Using trident binary: $(RUN_NETLAUNCH_TRIDENT_BIN)"
@mkdir -p artifacts/test-image
@cp $(RUN_NETLAUNCH_TRIDENT_BIN) artifacts/test-image/trident
@cp artifacts/osmodifier artifacts/test-image/
@bin/netlaunch \
--stream-image \
--trident-binary $(RUN_NETLAUNCH_TRIDENT_BIN) \
--osmodifier-binary artifacts/osmodifier \
--rcp-agent-mode cli \
--iso $(NETLAUNCH_ISO) \
$(if $(NETLAUNCH_PORT),--port $(NETLAUNCH_PORT)) \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use crate::markdown::table::MdTable;
use super::{get_part_types, RuleDefinition};

pub(super) fn valid_mount_paths() -> RuleDefinition {
let mut table = MdTable::new(vec!["Mount Path", "Valid Mount Paths"]);
let mut table = MdTable::new(vec!["Partition Type", "Valid Mount Paths"]);

for pt in get_part_types() {
table.add_row(vec![
Expand Down
26 changes: 26 additions & 0 deletions crates/osmodifier/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
[package]
name = "osmodifier"
version = "0.1.0"
edition = "2021"
publish = false
license = "MIT"
description = "OS modifier library - applies OS configuration changes (users, hostname, services, modules, boot config, SELinux)"

[dependencies]
anyhow = { workspace = true }
inventory = { workspace = true }
log = { workspace = true }
nix = { workspace = true }
serde = { workspace = true }
tempfile = { workspace = true }
Comment thread
bfjelds marked this conversation as resolved.

pytest = { path = "../pytest" }
pytest_gen = { path = "../pytest_gen" }
trident_api = { path = "../trident_api" }
osutils = { path = "../osutils" }
Comment thread
bfjelds marked this conversation as resolved.

[dev-dependencies]
indoc = { workspace = true }

[features]
functional-test = []
Loading
Loading