From f277a025ead48626dba7491d48548ce06e0bf17d Mon Sep 17 00:00:00 2001 From: Ning Shang Date: Tue, 21 May 2024 15:24:49 -0700 Subject: [PATCH] Add rootfs release support (#19) * Add rootfs release support Implemented handler for rootfs release type. * Self-test: make rootfs release job depend on zip_archive release job This is to avoid a potential race condition related to manifest anti-rollback version setting. --- .github/workflows/test.yml | 29 +++++++++++++++++++++++++++++ entrypoint.sh | 20 +++++++++++++++++--- 2 files changed, 46 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c0cd4be..23132f4 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -71,3 +71,32 @@ jobs: signing_key_management: 'local' signing_key: ${{ secrets.TEST_SIGNING_KEY }} signing_key_password: ${{ secrets.TEST_SIGNING_KEY_PASSWORD }} + + test_ota_release_rootfs: + name: 'Test OTA Release Action (release_type: rootfs)' + needs: 'test_ota_release_zip_archive' + runs-on: 'ubuntu-latest' + steps: + - name: 'Checkout' + uses: 'actions/checkout@v4' + + - name: 'Set up environment' + run: | + echo "TIMESTAMP=$(date +'%Y-%m-%dT%H:%M:%S%z')" >> $GITHUB_ENV + + - name: 'Create (bogus) rootfs for test' + run: | + echo "Create fake rootfs at ${{ env.TIMESTAMP }}" > rootfs.img + + - name: 'Test OTA Release' + uses: './' # Use an action in the root directory + with: + release_name: 'rootfs-release ${{ env.TIMESTAMP }}' + release_type: 'rootfs' + persist_dir: '/tmp/persist' + rootfs_img_path: 'rootfs.img' + base_install_path_on_device: '/boot' + project_access_token: ${{ secrets.TEST_PROJECT_ACCESS_TOKEN }} + signing_key_management: 'local' + signing_key: ${{ secrets.TEST_SIGNING_KEY }} + signing_key_password: ${{ secrets.TEST_SIGNING_KEY_PASSWORD }} diff --git a/entrypoint.sh b/entrypoint.sh index e8ab020..b31830c 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -77,8 +77,22 @@ file_release() { } rootfs_release() { - echo "Not implemented" - exit 1 + get_manifest_template_hack + + local release_name="${INPUT_RELEASE_NAME:-}" + + local rootfs_img_path="${INPUT_ROOTFS_IMG_PATH:-}" + [ -z "${rootfs_img_path}" ] && err "No rootfs image path provided" + + "${TRH_BINARY_PATH}" prepare --target="${rootfs_img_path}" + + if [ -n "${release_name}" ]; then + "${TRH_BINARY_PATH}" release --name="${release_name}" + else + "${TRH_BINARY_PATH}" release + fi + + echo "done" } zip_archive_release() { @@ -98,7 +112,7 @@ zip_archive_release() { "${TRH_BINARY_PATH}" release --name="${release_name}" else "${TRH_BINARY_PATH}" release - fi + fi echo "done" }