{"id":30713120,"url":"https://github.com/db7/smolbsd-cicd","last_synced_at":"2025-09-03T03:12:19.591Z","repository":{"id":311732040,"uuid":"1043852369","full_name":"db7/smolbsd-cicd","owner":"db7","description":null,"archived":false,"fork":false,"pushed_at":"2025-08-26T08:30:59.000Z","size":5,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-08-26T09:16:39.527Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"0bsd","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/db7.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-08-24T18:49:28.000Z","updated_at":"2025-08-26T08:31:03.000Z","dependencies_parsed_at":"2025-08-26T09:17:35.966Z","dependency_job_id":"5b75911f-af08-4e52-9738-577b2a86a7d0","html_url":"https://github.com/db7/smolbsd-cicd","commit_stats":null,"previous_names":["db7/smolbsd-cicd"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/db7/smolbsd-cicd","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/db7%2Fsmolbsd-cicd","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/db7%2Fsmolbsd-cicd/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/db7%2Fsmolbsd-cicd/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/db7%2Fsmolbsd-cicd/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/db7","download_url":"https://codeload.github.com/db7/smolbsd-cicd/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/db7%2Fsmolbsd-cicd/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273382199,"owners_count":25095414,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-03T02:00:09.631Z","response_time":76,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-09-03T03:12:15.605Z","updated_at":"2025-09-03T03:12:19.584Z","avatar_url":"https://github.com/db7.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Simple CICD container with smolBSD\n\nThis repository is an example of how to use [smolBSD](https://smolbsd.org) as\na container in a CICD pipeline. Since smolBSD can boot very quickly, it is a\ngood tool to run tests cases without booting a heavy-weight VM.\n\nThe idea is simple. It consists of these phases:\n\n## 1. creating a Docker container\n\nThe steps below are in `.github/workflows/docker.yml`. The workflow is\ntriggered manually.\n\n### 1.1 Create the VM image\n\nStarting with a Ubuntu, install the dependencies for smolBSD:\n\n    sudo apt install -y \\\n       build-essential  \\\n       curl             \\\n       git              \\\n       libarchive-tools \\\n       rsync            \\\n       uuid-runtime\n\nNext, get smolBSD and sets and kernel (`scripts/get_smolBSD.sh`):\n\n    git clone --depth 1 https://github.com/NetBSDfr/smolBSD.git smolBSD\n    cd smolBSD\n    curl -LO https://smolbsd.org/assets/netbsd-SMOL\n    gmake setfetch SETS=\"base.tar.xz etc.tar.xz comp.tar.xz\"\n\nOur project may need some tools beyond those in comp set, for example, cmake.\nThe script `scripts/get_pkgsrc.sh` will download with `curl` the given packages\nand their dependencies from [pkgsrc](https://pkgsrc.org):\n\n    scripts/get_pkgsrc.sh cmake\n\nFinally, create the VM image using smolBSD script `mkimg.sh`:\n\n    cd smolBSD\n    PKGS=\"../pkgsrc/downloads/*.tgz\"\n    sudo env ADDONS=\"$PKGS\" ./mkimg.sh -s base -i smolbsd.img \\\n            -x \"base.tar.xz etc.tar.xz comp.tar.xz\" \\\n            -m 2048\n\n### 1.2 Save the VM image in a Docker container image\n\nBuild a Docker image with the `Dockerfile` in the repo. It will install smolBSD\nand copy the generated `smolbsd.img` into `/data/smolBSD/`.\n\nAfter that,  push the Docker image to the CICD registry.\n\n## 2. Running the tests\n\nWhenever code changes in our example project are pushed, we'd like to test them\nrunning the following steps in a Docker container from the previous phase check\n`.github/workflows/example.yml` for details).\n\n1. `scripts/add2img.sh \u003cSMOLBSD_IMAGE\u003e \u003cPATH_TO_CODE\u003e`: add the repository with\n   the test and code to the smolBSD image. Here, our test is in `example/`. The\n   script that starts the test is inside `add2img.sh`.\n2. Using `smolBSD/startnb.sh`, run test(s) in QEMU. Ensure the test results are\n   saved to the VM disk. Important: pass option `-x \"-no-reboot\"` to stop QEMU\n   when the test is done.\n3. `scripts/get_results.h \u003cSMOLBSD_IMAGE\u003e`: open the image and check the results\n   of the test.\n\n# Disclaimer\n\nThe code in this repo is a crude demo and has lots of room for improvement. For\nexample, the script defining the build and test steps is hardcoded inside\n`scripts/add2img.sh`.  Instead of storing the image inside a Docker container,\none can store that as a GitHub release file. That can be downloaded and mounted\non demand. Also, one can use cross-platform-actions instead of running with\nDocker.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdb7%2Fsmolbsd-cicd","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdb7%2Fsmolbsd-cicd","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdb7%2Fsmolbsd-cicd/lists"}