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

Simplified greenboot health-check #100

Open
wants to merge 11 commits into
base: greenboot-rs
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 8 commits
Commits
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
10 changes: 10 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
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 \
rust-packaging rpmdevtools rpmlint \
&& 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"
}
65 changes: 9 additions & 56 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,17 @@ jobs:
skip: "./docs/Gemfile.lock,./docs/_config.yml,./.github,./.git,./greenboot.spec,./dist"

fmt:
name: Rustfmt
name: Cargo fmt
runs-on: ubuntu-latest
steps:
- 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 +60,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,51 +90,5 @@ 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

# manpages:
# name: Test man page generation
# runs-on: ubuntu-latest
# container: fedora:latest
# steps:
# - uses: actions/checkout@v3
# - name: install deps
# run: |
# dnf install -y make python3-docutils
# - name: generate man pages
# run: make man

# devcontainer_test:
# name: Test Devcontainer Creation
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v3
# - name: Install devcontainer CLI
# run: npm install -g @vscode/dev-container-cli
# - name: Build devcontainer
# run: devcontainer build --image-name devcontainer-fdo-rs .
# - name: Test building in devcontainer
# run: docker run --rm -v `pwd`:/code:z --workdir /code --user root devcontainer-fdo-rs cargo build --verbose
args: -- --test-threads=1

2 changes: 2 additions & 0 deletions .packit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ srpm_build_deps:
# post-upstream-clone: "./tools/rpm_spec_add_provides_bundle.sh"

actions:
get-current-version:
say-paul marked this conversation as resolved.
Show resolved Hide resolved
- grep -oP '^Version:\s+\K\S+' greenboot.spec
create-archive:
- "cargo vendor vendor"
- bash -c "git archive --prefix=greenboot-${PACKIT_PROJECT_VERSION}/ --format=tar HEAD > greenboot-${PACKIT_PROJECT_VERSION}.tar"
Expand Down
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"
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ install: build

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

.PHONY: srpm
srpm: $(RPM_SPECFILE) $(RPM_TARBALL) $(VENDOR_TARBALL)
Expand Down
21 changes: 0 additions & 21 deletions dist/systemd/system/greenboot-trigger.service

This file was deleted.

13 changes: 0 additions & 13 deletions dist/systemd/system/greenboot.service

This file was deleted.

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=3
Loading
Loading