From e0f476fa0e9702a0001eab982b19b3aa295ee1d2 Mon Sep 17 00:00:00 2001 From: Boris Date: Wed, 11 Sep 2024 00:04:50 +0200 Subject: [PATCH] CI --- .github/workflows/build.yml | 22 +++++++++------- packer_test.json | 50 +++++++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+), 9 deletions(-) create mode 100644 packer_test.json diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 953056b..f46f666 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -8,7 +8,7 @@ jobs: steps: - uses: actions/checkout@v3 - name: Setup `packer` - uses: hashicorp/setup-packer@main + uses: hashicorp/setup-packer@v1 id: setup # - name: Setup arm packer prerequisites # run: | @@ -30,7 +30,7 @@ jobs: - name: Install dependencies run: | sudo apt-get update - sudo apt-get install fdisk gdisk qemu-user-static libarchive-tools tar parted qemu-utils squashfs-tools -y + sudo apt-get install tree fdisk gdisk qemu-user-static libarchive-tools psmisc tar autoconf make qemu-utils zip shell: bash # Install packer arm plugin @@ -44,11 +44,15 @@ jobs: - name: init example image run: | cp plugin/packer-builder-arm . - packer init plugin/boards/raspberry-pi-4/ubuntu_server_20.04_arm64.pkr.hcl - packer build plugin/boards/raspberry-pi-4/ubuntu_server_20.04_arm64.pkr.hcl + sudo packer build packer_test.json shell: bash - - - name: Upload artifacts - uses: actions/upload-artifact@v2 - with: - name: ubuntu-20.04.img \ No newline at end of file + + - name: List dir + run: | + pwd + ls -la + shell: bash + # - name: Upload artifacts + # uses: actions/upload-artifact@v2 + # with: + # name: ubuntu-20.04.img \ No newline at end of file diff --git a/packer_test.json b/packer_test.json new file mode 100644 index 0000000..50b810b --- /dev/null +++ b/packer_test.json @@ -0,0 +1,50 @@ +{ + "variables": { + "apt_packages": "software-properties-common apt-transport-https ca-certificates openssl ufw curl docker-compose" + }, + "builders": [ + { + "type": "arm", + "file_urls": [ + "https://downloads.raspberrypi.org/raspios_lite_arm64/images/raspios_lite_arm64-2022-09-26/2022-09-22-raspios-bullseye-arm64-lite.img.xz" + ], + "file_checksum_url": "https://downloads.raspberrypi.org/raspios_lite_arm64/images/raspios_lite_arm64-2022-09-26/2022-09-22-raspios-bullseye-arm64-lite.img.xz.sha256", + "file_unarchive_cmd": ["xz", "-d", "$ARCHIVE_PATH"], + "file_checksum_type": "sha256", + "file_target_extension": "xz", + "image_build_method": "resize", + "image_path": "grampsweb-2022-09-22-raspios-bullseye-arm64-lite.img", + "image_size": "2G", + "image_type": "dos", + "image_partitions": [ + { + "name": "boot", + "type": "c", + "start_sector": "8192", + "filesystem": "vfat", + "size": "256M", + "mountpoint": "/boot" + }, + { + "name": "root", + "type": "83", + "start_sector": "532480", + "filesystem": "ext4", + "size": "0", + "mountpoint": "/" + } + ], + "image_chroot_env": [ + "PATH=/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin" + ], + "qemu_binary_source_path": "/usr/bin/qemu-arm-static", + "qemu_binary_destination_path": "/usr/bin/qemu-arm-static" + } + ], + "provisioners": [ + { + "type": "shell", + "inline": ["touch /boot/ssh"] + } + ] + } \ No newline at end of file