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

feat/port-init-to-rust #191

Open
wants to merge 23 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
5 changes: 5 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ jobs:
restore-keys: |
${{ runner.os }}-cargo-registry-

- name: Install Protobuf
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y protobuf-compiler
- name: Cache cargo index
uses: actions/cache@v1
with:
Expand Down
24 changes: 15 additions & 9 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,20 +51,26 @@ jobs:
steps:
- name: Install Musl
run: sudo apt-get install -y musl-tools musl autoconf gperf libtool automake
- name: Install Rust ${{ env.rust_stable }}
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ env.rust_stable }}
target: x86_64-unknown-linux-musl
override: true
- uses: actions/checkout@v1
- name: Make
run: |
musl-gcc -v
git submodule init
git submodule update
cd runtime/init-container
cd rinit
make
- uses: actions/upload-artifact@v4
with:
name: init-container
path: |
runtime/init-container/initramfs.cpio.gz
runtime/init-container/vmlinuz-virt
rinit/initramfs.cpio.gz
rinit/vmlinuz-virt

build:
name: Build Release
Expand All @@ -81,10 +87,10 @@ jobs:
- uses: actions/download-artifact@v4
with:
name: init-container
path: runtime/init-container/
path: rinit
- run: |
ls -R
test -f runtime/init-container/initramfs.cpio.gz
test -f rinit/initramfs.cpio.gz
- name: Download self-test image
uses: robinraju/[email protected]
with:
Expand Down Expand Up @@ -139,8 +145,8 @@ jobs:
cp runtime/conf/ya-runtime-vm.json "$TARGET_DIR/"
cp -r runtime/poc/runtime "$TARGET_DIR/ya-runtime-vm/"
cp "runtime/image/self-test.gvmi" "$TARGET_DIR/ya-runtime-vm/runtime/"
cp "runtime/init-container/initramfs.cpio.gz" "$TARGET_DIR/ya-runtime-vm/runtime/"
cp "runtime/init-container/vmlinuz-virt" "$TARGET_DIR/ya-runtime-vm/runtime/"
cp "rinit/initramfs.cpio.gz" "$TARGET_DIR/ya-runtime-vm/runtime/"
cp "rinit/vmlinuz-virt" "$TARGET_DIR/ya-runtime-vm/runtime/"
(cd releases && tar czvf "ya-runtime-vm-${OS_NAME}-${TAG_NAME}.tar.gz" "ya-runtime-vm-${OS_NAME}-${TAG_NAME}")
echo "::set-output name=artifact::ya-runtime-vm-${OS_NAME}-${TAG_NAME}.tar.gz"
echo "::set-output name=media::application/tar+gzip"
Expand Down Expand Up @@ -185,9 +191,9 @@ jobs:
- uses: actions/download-artifact@v4
with:
name: init-container
path: runtime/init-container/
path: rinit
- run: |
test -f runtime/init-container/initramfs.cpio.gz
test -f rinit/initramfs.cpio.gz
- name: Download self-test image
uses: robinraju/[email protected]
with:
Expand Down
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,11 @@
/.idea/
/.vscode/
logs/

# rinit build files
/rinit/extern-libs/libseccomp.a
/rinit/extern-libs/unpacked_headers
/rinit/extern-libs/unpacked_kernel
/rinit/init
/rinit/initramfs.cpio.gz
/rinit/vmlinuz-virt
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@
[submodule "runtime/init-container/libseccomp"]
path = runtime/init-container/libseccomp
url = https://github.com/seccomp/libseccomp.git
[submodule "rinit/extern-libs/libseccomp"]
path = rinit/extern-libs/libseccomp
url = https://github.com/seccomp/libseccomp.git
Binary file added 1
Binary file not shown.
10 changes: 10 additions & 0 deletions 1.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#include <stdio.h>
#include <stdint.h>

static uint64_t get_next_id(void)
{
static uint64_t id = 0;
return ++id;
}

int main() { printf("%d\n", get_next_id()); }
Loading
Loading