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

ci(*): merge build action #548

Merged
merged 10 commits into from
Apr 15, 2024
Merged

ci(*): merge build action #548

merged 10 commits into from
Apr 15, 2024

Conversation

Mossaka
Copy link
Member

@Mossaka Mossaka commented Apr 3, 2024

this commit merges the build step in the release action and the one in the ci action since they share a large overlap code.

the build step not only builds the binary, but signs it, and upload as action artifacts. this step is now running for every ci run, including PR and release pipeline.

this commit merges the build step in the release action and
the one in the ci action since they share a large overlap code.

the build step not only builds the binary, but signs it, and
upload as action artifacts. this step is now running for every
ci run, including PR and release pipeline.

Signed-off-by: jiaxiao zhou <[email protected]>
@Mossaka Mossaka mentioned this pull request Apr 3, 2024
@Mossaka Mossaka requested a review from jsturtevant April 3, 2024 23:13
@jsturtevant
Copy link
Contributor

Are there implications for signing the binary every PR?

uses: ./.github/workflows/action-build.yml
with:
os: "ubuntu-22.04"
runtime: ${{ matrix.runtime }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there will be times when this value won't be common as the check in the action is expecting

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, can you elaborate your concerns here?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This value in the release.yml will be something like oci-tar-builder

const crate = '${{ inputs.crate }}';
let runtime = crate.replace(/^containerd-shim-/, '');
core.setOutput('runtime', runtime);
const non_shim_crates = ['wasm', 'wasm-test-modules', 'oci-tar-builder'];

and I think signing will fail in the new signing step at https://github.com/containerd/runwasi/pull/548/files#diff-43035769cde349b680ebf72f18e67b049e730d0d0ec91174e6455a685b3c2accR61-R64

Copy link
Member Author

@Mossaka Mossaka Apr 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point! I have modified the logic of runtime_sub step to replace the name of non-shim crate to common in this commit: 61dc1ee

@Mossaka
Copy link
Member Author

Mossaka commented Apr 3, 2024

Are there implications for signing the binary every PR?

Since we are signing the artifacts that we publish on every build, I can imagine increased security and potentially degraded performance and increased complexity of managing keys.

Although stated in the release doc for how to verify the binaries, we probably want to make that even clearer by copying the exact verification command in the release doc everytime we release signed artifacts.

I am not sure if anyone would want to verify build artifacts for each PR / commit, but if they want, it's do-able.

@@ -22,13 +22,13 @@ jobs:
- name: Download artifacts
uses: actions/download-artifact@master
with:
name: containerd-shim-${{ inputs.runtime }}-linux-musl
name: containerd-shim-${{ inputs.runtime }}-x86_64-linux-musl
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

interesting, I don't see where this arch was being included in the inputs.runtime before. Or is this extra field new?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before this PR, only the release pipeline runs both x86_64 and aarch64. The ci does not have a matrix for different archs. I added that to make the build job on par with the one in the release CI.

@marosset
Copy link

marosset commented Apr 5, 2024

If you add # yaml-language-server: $schema=https://json.schemastore.org/github-action.json to the top of all the github action files you'll get schema validation in a lot of editors like vs code

path: dist
- name: Unpack artifats
shell: bash
run: |
mkdir -p dist/bin
tar -xzf dist/containerd-shim-${{ inputs.runtime }}-linux-musl.tar.gz -C dist/bin
tar -xzf dist/containerd-shim-${{ inputs.runtime }}-x86_64-linux-musl.tar.gz -C dist/bin
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Maybe make this a makefile target since the tar command is repeated in multiple workflows?

@Mossaka
Copy link
Member Author

Mossaka commented Apr 5, 2024

Are there implications for signing the binary every PR?

Now that I thought more about the implications, and realized that I missed one of the biggest implication in my previous comment - signing requires feature branches to be pushed to upstream, because they require id-token: write permission which will not grant to public forked repos (the max permission for id-token is read for forked repos, so even though you specified write permission, the pipeline won't grant you the context you want).

I am okay to put a condition on the signing to differentiate build / release pipelines so we can disable signing on build. Wdyt?

Mossaka added 2 commits April 7, 2024 22:01
this commit makes the signing step optional in the
build-action and then disable signing required in the
build CI. it is only necessary for releasing the artifacts

see more discussion on #548 (comment)

Signed-off-by: jiaxiao zhou <[email protected]>
this commit replaces the name of non-shim runtime to "common"
in the runtime_sub step under the release pipeline because
"common" is used in action-build action to determine
artifact signing, packaging and uploading.

Signed-off-by: jiaxiao zhou <[email protected]>
@Mossaka Mossaka closed this Apr 7, 2024
@Mossaka Mossaka reopened this Apr 7, 2024
.github/workflows/action-build.yml Outdated Show resolved Hide resolved
.github/workflows/action-build.yml Show resolved Hide resolved
@Mossaka Mossaka closed this Apr 11, 2024
@Mossaka Mossaka reopened this Apr 11, 2024
@Mossaka Mossaka requested review from cpuguy83 and devigned April 12, 2024 01:17
@Mossaka
Copy link
Member Author

Mossaka commented Apr 15, 2024

Could you please this PR again? @cpuguy83 @devigned 🙏

Copy link
Contributor

@devigned devigned left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

Nice work, @Mossaka!

@devigned devigned enabled auto-merge (squash) April 15, 2024 20:23
@Mossaka
Copy link
Member Author

Mossaka commented Apr 15, 2024

Going to merge this now and any follow up can be addressed later

@Mossaka Mossaka disabled auto-merge April 15, 2024 23:14
@Mossaka Mossaka merged commit 5f3317f into main Apr 15, 2024
80 of 85 checks passed
@Mossaka Mossaka deleted the opt-release branch April 15, 2024 23:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants