From e07be3d6f86631ef2a214b21fd2d97340cf86dad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Wei=C3=9Fe?= <66256922+daniel-weisse@users.noreply.github.com> Date: Thu, 9 Mar 2023 15:01:09 +0100 Subject: [PATCH] fix: add measurement-reader to build pipeline (#1386) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Daniel Weiße --- .../build_measurement_reader/action.yml | 22 +++++++++++++++++++ .github/workflows/build-binaries.yml | 16 ++++++++++++++ .github/workflows/build-os-image.yml | 13 ++++++++++- 3 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 .github/actions/build_measurement_reader/action.yml diff --git a/.github/actions/build_measurement_reader/action.yml b/.github/actions/build_measurement_reader/action.yml new file mode 100644 index 000000000..e586946c8 --- /dev/null +++ b/.github/actions/build_measurement_reader/action.yml @@ -0,0 +1,22 @@ +name: Build measurement-reader +description: Build the Constellation measurement-reader binary + +inputs: + outputPath: + description: "Output path of the binary" + default: "./measurement-reader" + required: true + +# Linux runner only (Docker required) +runs: + using: "composite" + steps: + - name: Build the measurement-reader + shell: bash + run: | + echo "::group::Build the measurement-reader" + mkdir -p build && cd build + cmake .. + make measurement-reader + mv -n measurement-reader "${{ inputs.outputPath }}" + echo "::endgroup::" diff --git a/.github/workflows/build-binaries.yml b/.github/workflows/build-binaries.yml index e60745b88..c52a605d8 100644 --- a/.github/workflows/build-binaries.yml +++ b/.github/workflows/build-binaries.yml @@ -115,6 +115,22 @@ jobs: - name: Build disk-mapper uses: ./.github/actions/build_disk_mapper + build-measurement-reader: + runs-on: ubuntu-22.04 + steps: + - name: Checkout + uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 + with: + ref: ${{ !github.event.pull_request.head.repo.fork && github.head_ref || '' }} + + - name: Setup Go environment + uses: actions/setup-go@6edd4406fa81c3da01a34fa6f6343087c207a568 # v3.5.0 + with: + go-version: "1.20.2" + + - name: Build measurement-reader + uses: ./.github/actions/build_measurement_reader + build-cli-linux: runs-on: ubuntu-22.04 steps: diff --git a/.github/workflows/build-os-image.yml b/.github/workflows/build-os-image.yml index 2201e59e2..aa5641ce0 100644 --- a/.github/workflows/build-os-image.yml +++ b/.github/workflows/build-os-image.yml @@ -55,6 +55,7 @@ jobs: bootstrapper-sha256: ${{ steps.collect-hashes.outputs.bootstrapper-sha256 }} disk-mapper-sha256: ${{ steps.collect-hashes.outputs.disk-mapper-sha256 }} upgrade-agent-sha256: ${{ steps.collect-hashes.outputs.upgrade-agent-sha256 }} + measurement-reader-sha256: ${{ steps.collect-hashes.outputs.measurement-reader-sha256 }} steps: - name: Checkout uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 @@ -89,6 +90,11 @@ jobs: with: outputPath: ${{ github.workspace }}/build/upgrade-agent + - name: Build measurement-reader + uses: ./.github/actions/build_measurement_reader + with: + outputPath: ${{ github.workspace }}/build/measurement-reader + - name: Upload dependencies uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 env: @@ -99,6 +105,7 @@ jobs: ${{ github.workspace }}/build/${{ env.MAIN_BINARY }} ${{ github.workspace }}/build/disk-mapper ${{ github.workspace }}/build/upgrade-agent + ${{ github.workspace }}/build/measurement-reader - name: Collect hashes id: collect-hashes @@ -108,6 +115,7 @@ jobs: echo "bootstrapper-sha256=$(sha256sum bootstrapper | head -c 64)" echo "disk-mapper-sha256=$(sha256sum disk-mapper | head -c 64)" echo "upgrade-agent-sha256=$(sha256sum upgrade-agent | head -c 64)" + echo "measurement-reader-sha256=$(sha256sum measurement-reader | head -c 64)" } | tee "$GITHUB_OUTPUT" build-settings: @@ -260,12 +268,13 @@ jobs: name: dependencies path: ${{ github.workspace }}/build - - name: Mark bootstrapper, debugd, disk-mapper, and upgrade-agent as executable + - name: Mark bootstrapper, debugd, disk-mapper, measurement-reader, and upgrade-agent as executable run: | chmod +x ${{ github.workspace }}/build/bootstrapper || true chmod +x ${{ github.workspace }}/build/debugd || true chmod +x ${{ github.workspace }}/build/disk-mapper chmod +x ${{ github.workspace }}/build/upgrade-agent + chmod +x ${{ github.workspace }}/build/measurement-reader - name: Setup mkosi uses: ./.github/actions/setup_mkosi @@ -291,6 +300,7 @@ jobs: DEBUGD_BINARY: ${{ github.workspace }}/build/bootstrapper DISK_MAPPER_BINARY: ${{ github.workspace }}/build/disk-mapper UPGRADE_AGENT_BINARY: ${{ github.workspace }}/build/upgrade-agent + MEASUREMENT_READER_BINARY: ${{ github.workspace }}/build/measurement-reader DEBUG: ${{ (needs.build-settings.outputs.stream == 'debug') && 'true' || 'false' }} AUTOLOGIN: ${{ (needs.build-settings.outputs.stream == 'console' || needs.build-settings.outputs.stream == 'debug' ) && 'true' || 'false' }} IMAGE_VERSION: ${{ needs.build-settings.outputs.imageVersion }} @@ -843,6 +853,7 @@ jobs: ${{ needs.build-dependencies.outputs.bootstrapper-sha256 }} bootstrapper ${{ needs.build-dependencies.outputs.disk-mapper-sha256 }} disk-mapper ${{ needs.build-dependencies.outputs.upgrade-agent-sha256 }} upgrade-agent + ${{ needs.build-dependencies.outputs.measurement-reader-sha256 }} measurement-reader ${{ needs.make-os-image.outputs.image-raw-aws-sha256 }} aws/image.raw ${{ needs.make-os-image.outputs.image-raw-changelog-aws-sha256 }} aws/image.raw.changelog ${{ needs.make-os-image.outputs.image-raw-manifest-aws-sha256 }} aws/image.raw.manifest