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

refactor: Add build GHA image #209

Closed

Conversation

jesse-peters
Copy link
Contributor

@jesse-peters jesse-peters commented Dec 29, 2022

I took another whack at this using a few different methods. The time to run is still a bit longer than native GHA jobs, but with a self-hosted runner I think it would be pretty similar.

I'm building the image as the first step in the pipeline, then using that image to run the jobs on downstream. I have introduced cargo-chef to package the dependencies, without needing to compile the code itself.

Using minideb we launch a container that has the rust requirements (but without extras like cargo-chef). This runs the actual make steps, and uses native GHA caching for the rust modules.

I would be happy to setup and own a self-hosted runner and docker registry. I'm happy to chat about that in discord too (kuxaku) :)

Most of the build layers should cache across branches too (using buildkits native GHA cache), so the first time it runs should be the longest.

Biggest Risks:

  • I got the caching wrong and the pipeline doesn't have correct dependencies someplace along the test/build process
  • The build times are longer, impacting developer feedback times

Out of scope:

  • I did not apply the docker image to the deploy step yet.

I kept the original two GHA jobs in the pipeline for reference. If/when this gets merged they can be ran alongside for a bit to ensure its working, or deleted in a second PR.

@jesse-peters jesse-peters changed the title feat: Add build GHA image WIP: Add build GHA image Dec 29, 2022
Dockerfile Outdated Show resolved Hide resolved
@jesse-peters
Copy link
Contributor Author

Sorry for the noise, I created this PR a little bit early it looks like

@jesse-peters jesse-peters changed the title WIP: Add build GHA image refactor: Add build GHA image Dec 30, 2022
@jesse-peters jesse-peters marked this pull request as ready for review December 30, 2022 01:26
@krisnova
Copy link
Contributor

Want to squash for us?

@jesse-peters
Copy link
Contributor Author

Happy to. Bare with me, git and I dont get alone sometimes :) (I usually have squash turns on automatically in my repos)

Move dockerfile to dir. Add to makefile. Add other deps

build needs addl permissions

Change image name

need protobuf

dockerfile hash was in the wrong spot in GHA

still not seeing the cache marker

Checking out the repo first would help

Add pkg-config and use latest digest in builder

needs not jobs in GHA

imageid not digest from the docker build

id missing on build step

retrigger with new cache to get output

it must have been digest, but the other issue bocked it

try defining the tag earlier

need a new cache to trigger the image push

gha syntax error

can't have uppercase

hash was too long, use built in GHA to create a single

Add vale, protoc. Cleanup dockerfile

timeout

split apart for speed

That wasnt faster. Lets keep the old ones for now too.

need to use a different cache key
@future-highway
Copy link
Contributor

@cla-bot check

@cla-bot
Copy link

cla-bot bot commented Dec 30, 2022

In order to contribute to an Aurae project you must sign and agree to the CLA. Comment @cla-bot check to check again.

@cla-bot
Copy link

cla-bot bot commented Dec 30, 2022

The cla-bot has been summoned, and re-checked this pull request!

@jesse-peters
Copy link
Contributor Author

I think I'll need a project maintainer to add write permissions containers to this project. I'm using aurae-builder as the name of the package. Now is a good time to change that too if we wanted to use a different one.

I think its here for an org:

https://github.com/orgs/aurae-runtime/packages

https://docs.github.com/en/packages/managing-github-packages-using-github-actions-workflows/publishing-and-installing-a-package-with-github-actions#upgrading-a-workflow-that-accesses-a-registry-using-a-personal-access-token

@jesse-peters
Copy link
Contributor Author

@cla-bot check

@cla-bot
Copy link

cla-bot bot commented Dec 31, 2022

The cla-bot has been summoned, and re-checked this pull request!

@krisnova
Copy link
Contributor

Hey @jesse-peters I hate to sound like the idiot who doesn't understand how to use GitHub, but I have spent the last 30 minutes trying to understand what it is I am supposed to do to help you out here and I honestly am stumped.

What exactly do you need? Can you be as descriptive as possible? Is there any way you can share a "this specific thing is failing and if you make this specific thing go away we will be happy" style description?

@jesse-peters
Copy link
Contributor Author

I think Daegalus provided some instructions in discord. The docker image is failing when it pushes to the docker registry with a 403. I hit this issue when developing on my branch, and thought I had to solve it with the steps above. This other solution may be what we need though. Sorry to send you on a wild goose chase if this solves it!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants