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

Docker build as part of workflow #928

Merged
merged 21 commits into from
Oct 21, 2024
Merged

Docker build as part of workflow #928

merged 21 commits into from
Oct 21, 2024

Conversation

vmilosevic
Copy link
Contributor

@vmilosevic vmilosevic commented Oct 16, 2024

I’m updating the workflow to make the Docker image build the first step in the build and test pipeline. Instead of triggering Docker builds manually, the workflow will check if the required Docker images already exist on GHCR (GitHub Container Registry). If they don’t, the workflow will initiate the build.

How do we determine which Docker image is needed?

The image tag is based on a hash of the Dockerfiles and the environment CMake file. If any of these change, a new Docker image build will be triggered. Although we could refine this to only trigger builds for specific changes (e.g., LLVM version in the environment file), for now, any change will trigger a new build. See get-docker-tag.sh

If a Docker image with the calculated tag already exists, the job will quickly complete and pass the image tag to the subsequent build and test jobs, which will use this specific image instead of the "latest" tag. This ensures the workflow always uses the correct Docker image.

How do we know which image to use in IRD?

Each time a Docker image is built, it will also be tagged as "latest." In most cases, this "latest" image will work for IRD. However, if it doesn’t, developers can run the get-docker-tag.sh script to retrieve the exact image tag needed for their code and use that in IRD.

Docs

# Calculate hash from the following files. This hash is used to tag the docker images.
# Any change in these files will result in a new docker image build
DOCKERFILE_HASH_FILES=".github/Dockerfile.base .github/Dockerfile.ci .github/Dockerfile.ci env/CMakeLists.txt"
DOCKERFILE_HASH=$(md5sum $DOCKERFILE_HASH_FILES | md5sum | cut -d ' ' -f 1)
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we use sha256sum?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, this will make slightly longer tags, but it's ok we don't hit any length limitations
dt-e931311c5edde3f3df8df7b8bf42e9dd
dt-8d11f16163457c4007e6c21d000dee14c80887131e4dce6a3b34f106e25ea344

.github/build-docker-images.sh Show resolved Hide resolved
@vmilosevic vmilosevic merged commit 0142a5c into main Oct 21, 2024
13 checks passed
vmilosevic added a commit to tenstorrent/tt-forge-fe that referenced this pull request Oct 24, 2024
Build docker image as part of a workflow
Similar to : tenstorrent/tt-mlir#928
vmilosevic added a commit to tenstorrent/tt-xla that referenced this pull request Nov 22, 2024
Build docker image as part of a workflow
Similar to : tenstorrent/tt-mlir#928
Docs
@vmilosevic vmilosevic deleted the vmilosevic/docker_build branch January 20, 2025 09:48
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.

2 participants