Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Greenboot rs continued personal #3

Open
wants to merge 45 commits into
base: update-rollback-policy-poc
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
6244211
chore: dev container and ci
say-paul Apr 12, 2023
56ad569
chore: greenboot rustified
say-paul Apr 12, 2023
983624b
chore: unit file and packaging
say-paul Apr 12, 2023
f7beedb
chore: add greenboot default healthcheck
say-paul Apr 28, 2023
397e956
fix: review comments
say-paul May 23, 2023
d04f157
chore: version bump
say-paul Jun 6, 2023
61c1794
fix:rollback trigger and logging
say-paul Jun 26, 2023
cc7b0e5
test: a/b testing
say-paul Jun 27, 2023
5d43283
a/b
say-paul Jun 28, 2023
c423a3e
updated check for rollback.service
say-paul Jun 28, 2023
75774e7
test: if services are working
say-paul Jun 28, 2023
fb7c53c
test:with systemupdatedone
say-paul Jun 28, 2023
423be44
test:rollback to run post update
say-paul Jun 30, 2023
f5624a1
test:version-bump
say-paul Jun 30, 2023
c415c72
test:remove default dependencies in greenboot
say-paul Jun 30, 2023
e0d811a
test:requires mount in greenboot
say-paul Jun 30, 2023
3ebf39b
test:aproach as discussed
say-paul Jun 30, 2023
56e0d72
remove update done
say-paul Jun 30, 2023
8ecf6a7
add update done
say-paul Jun 30, 2023
2971310
add default dependencyy
say-paul Jun 30, 2023
57a272a
add multi-user target
say-paul Jun 30, 2023
5db5df5
test: systemd test 05
say-paul Jul 4, 2023
0c1b7e7
test: should always rollback
say-paul Jul 4, 2023
e117b1f
test: onfailure for service to unit
say-paul Jul 4, 2023
99f4e35
test: greenboot run before update done
say-paul Jul 4, 2023
480a77f
test: requires loacl
say-paul Jul 5, 2023
26b949b
test: vresion bump
say-paul Jul 5, 2023
6eb8533
test: remove systemd update done on rollback servc
say-paul Jul 5, 2023
f48b42f
test: check condition
say-paul Jul 5, 2023
f93ed46
test: cleanup as i see it
say-paul Jul 5, 2023
db3c746
test: version 1.1.22
say-paul Jul 5, 2023
f325372
test: greenboot before udate done
say-paul Jul 5, 2023
08b5116
test: include dbus.service
say-paul Jul 5, 2023
d66a943
test: remove systemd update done from rollback
say-paul Jul 5, 2023
4d3bb15
test: after and wanrs in rollback
say-paul Jul 5, 2023
c0b6eb1
test: binds to in rollback
say-paul Jul 6, 2023
30c0c41
test: last one wa working decopling on failure
say-paul Jul 6, 2023
8b86e43
feat: Makefile to build locally
say-paul Jul 17, 2023
72a2d75
vresion bump
say-paul Jul 17, 2023
b261ce8
remove packit flag
say-paul Jul 18, 2023
ef56854
modified packit flag
say-paul Jul 18, 2023
6175d4a
remove else
say-paul Jul 18, 2023
1612c97
remove if
say-paul Jul 18, 2023
7e5493e
add if in main section
say-paul Jul 18, 2023
4eec111
edit packit variable
say-paul Jul 18, 2023
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
9 changes: 9 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM fedora:latest

RUN bash -c "$(curl -fsSL "https://raw.githubusercontent.com/microsoft/vscode-dev-containers/main/script-library/common-redhat.sh")" -- "true" "vscode" "1000" "1000" "true"

RUN dnf install -y \
sudo git cargo rust rust-src git-core clippy rustfmt \
&& dnf clean all

USER vscode
28 changes: 28 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"name": "greenboot-rs",
"build": {
"dockerfile": "Dockerfile"
},
"runArgs": [
"--cap-add=SYS_PTRACE",
"--security-opt",
"seccomp=unconfined"
],
"settings": {
"rust-analyzer.checkOnSave.command": "clippy"
},
"extensions": [
"mutantdino.resourcemonitor",
"matklad.rust-analyzer",
"serayuzgur.crates"
],
"hostRequirements": {
"memory": "4gb"
},
"remoteUser": "vscode",
"updateContentCommand": [
"cargo",
"build"
],
"waitFor": "onCreateCommand"
}
52 changes: 15 additions & 37 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
on:
push:
branches:
- main
- greenboot-rs
pull_request:

name: Continuous integration
Expand All @@ -22,20 +22,18 @@ jobs:
skip: "./docs/Gemfile.lock,./docs/_config.yml,./.github,./.git,./greenboot.spec,./dist"

fmt:
name: Rustfmt
name: Cargo fmt
runs-on: ubuntu-latest
container: fedora:latest
steps:
- name: Install deps
run: |
dnf install -y cargo rustfmt
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- run: rustup component add rustfmt
- uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
args: --check --all

clippy:
name: Clippy
Expand Down Expand Up @@ -63,11 +61,13 @@ jobs:

build_and_test:
runs-on: ubuntu-latest
container: fedora:latest
container:
image: fedora:latest
options: --user root
steps:
- name: Install deps
run: |
dnf install -y make gcc git cargo rust git clevis
dnf install -y make gcc git cargo rust git grub2-efi grub2-efi-modules shim
- uses: actions/checkout@v3
with:
persist-credentials: false
Expand All @@ -91,30 +91,8 @@ jobs:
uses: actions-rs/cargo@v1
with:
command: test
# This is primarily to ensure that changes to fdo_data.h are committed,
# which is critical for determining whether any stability changes were made
# during the PR review.
- name: Ensure building did not change any code
run: |
git diff --exit-code

commitlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: 'latest'
- name: Install commitlint dependencies
run: npm install commitlint
- uses: wagoid/commitlint-github-action@v5
env:
NODE_PATH: ${{ github.workspace }}/node_modules
with:
configFile: .github/commitlint.config.js
failOnWarnings: true
args: -- --test-threads=1


# manpages:
# name: Test man page generation
Expand All @@ -136,6 +114,6 @@ jobs:
# - name: Install devcontainer CLI
# run: npm install -g @vscode/dev-container-cli
# - name: Build devcontainer
# run: devcontainer build --image-name devcontainer-fdo-rs .
# run: devcontainer build --image-name greenboot-rs .
# - name: Test building in devcontainer
# run: docker run --rm -v `pwd`:/code:z --workdir /code --user root devcontainer-fdo-rs cargo build --verbose
# run: docker run --rm -v `pwd`:/code:z --workdir /code --user root greenboot-rs cargo build --verbose
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ log = "0.4"
clap = { version = "4.0", features = ["derive"] }
config = "0.13"
pretty_env_logger = "0.4"
nix = "0.25.0"
nix = "0.26.2"
glob = "0.3.0"
serde = "1.0"
serde_json = "1.0"
thiserror = "1.0.38"
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ else
endif

.PHONY: all
all: build check
all: build test

$(RPM_SPECFILE):
mkdir -p $(CURDIR)/rpmbuild/SPECS
Expand All @@ -40,9 +40,9 @@ install: build
install -D -t ${DESTDIR}/usr/libexec "${TARGETDIR}/${PROFILE}/greenboot"
install -D -m 644 -t ${DESTDIR}/usr/lib/systemd/system dist/systemd/system/*.service

.PHONY: check
check:
cargo test "--target-dir=${TARGETDIR}"
.PHONY: test
test:
cargo test "--target-dir=${TARGETDIR}" -- --test-threads=1

.PHONY: srpm
srpm: $(RPM_SPECFILE) $(RPM_TARBALL) $(VENDOR_TARBALL)
Expand Down
15 changes: 15 additions & 0 deletions dist/systemd/system/greenboot-rollback.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[Unit]
Description=Greenboot rollback
Requires=dbus.service
RequiresMountsFor=/boot
After=systemd-update-done.service
BindsTo=systemd-update-done.service

[Service]
Type=oneshot
RemainAfterExit=true
ExecStart=/usr/libexec/greenboot/greenboot rollback
Restart=no

[Install]
WantedBy=multi-user.target
21 changes: 0 additions & 21 deletions dist/systemd/system/greenboot-trigger.service

This file was deleted.

12 changes: 8 additions & 4 deletions dist/systemd/system/greenboot.service
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
[Unit]
Description=Greenboot - TODO
After=multi-user.target
Before=boot-complete.target
Description=greenboot Health Checks Runner
DefaultDependencies=no
Before=boot-complete.target systemd-update-done.service
OnFailureJobMode=fail
RequiresMountsFor=/boot
RequiresMountsFor=/etc

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/libexec/greenboot/greenboot check
ExecStart=/usr/libexec/greenboot/greenboot health-check
Restart=no

[Install]
RequiredBy=boot-complete.target
WantedBy=multi-user.target
4 changes: 4 additions & 0 deletions etc/greenboot/greenboot.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Greenboot configuration file

## Generic
GREENBOOT_MAX_BOOT_ATTEMPTS=1
Loading
Loading