Skip to content

Docker build #486

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

Merged
merged 23 commits into from
Apr 17, 2025
Merged

Docker build #486

merged 23 commits into from
Apr 17, 2025

Conversation

antonsviridov-src
Copy link
Contributor

@antonsviridov-src antonsviridov-src commented Apr 7, 2025

Closes GRAPH-1184

  • Publish amd64 and arm64 docker images on pushes to main and tags
  • Build binaries using beefy org runners
  • Upgrade actionlint and perform necessary configuration and update steps to make it happy

@antonsviridov-src antonsviridov-src marked this pull request as ready for review April 10, 2025 12:12
- platform: 'macos-14'
container: ''
config: 'release'
- platform: "macos-14"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Those quote changes are automatic from Zed. I can revert them but I don't think it's a big deal.

Copy link
Contributor

Choose a reason for hiding this comment

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

Could you please turn off this configuration setting? It's not a big deal, but it'd be nice to not have this happen elsewhere.

Copy link
Contributor

@varungandhi-src varungandhi-src left a comment

Choose a reason for hiding this comment

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

LGTM, mostly minor tweaks requested for consistency + some requests for more comments.

branches: ["main"]
tags:
- "v*"
env:
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
env:
env:

jobs:
build:
strategy:
fail-fast: false
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this set to false here? To reduce number of iterations when making changes to the CI workflow, in case there are issues on one platform but not another?

Comment on lines 17 to 23
- os: ubuntu-22.04-32core-graph-team-amd64
platform: linux/amd64
binary_name: scip-clang-x86_64-linux
- os: ubuntu-22.04-32core-graph-team-arm64
platform: linux/arm64
binary_name: scip-clang-arm64-linux
runs-on: ${{ matrix.os }}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
- os: ubuntu-22.04-32core-graph-team-amd64
platform: linux/amd64
binary_name: scip-clang-x86_64-linux
- os: ubuntu-22.04-32core-graph-team-arm64
platform: linux/arm64
binary_name: scip-clang-arm64-linux
runs-on: ${{ matrix.os }}
- runner: ubuntu-22.04-32core-graph-team-amd64
binary-name: scip-clang-x86_64-linux
- runner: ubuntu-22.04-32core-graph-team-arm64
binary-name: scip-clang-arm64-linux
runs-on: ${{ matrix.runner }}

Let's use consistent casing conventions for YAML keys. It looks like we're not using the platform keys below; can we remove them?

- uses: bazel-contrib/[email protected]
with:
bazelisk-cache: true
disk-cache: ${{ github.workflow }}-${{ matrix.binary_name }}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
disk-cache: ${{ github.workflow }}-${{ matrix.binary_name }}
disk-cache: ${{ github.workflow }}-${{ matrix.binary-name }}

uses: actions/upload-artifact@v4
with:
path: bazel-bin/indexer/scip-clang
name: ${{ matrix.binary_name }}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
name: ${{ matrix.binary_name }}
name: ${{ matrix.binary-name }}

- name: Export digest
run: |
mkdir -p ${{ runner.temp }}/digests
digest="${{ steps.build.outputs.digest }}"
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
digest="${{ steps.build.outputs.digest }}"
digest="${{ steps.build-digest-step.outputs.digest }}"

id: build
uses: docker/build-push-action@v6
with:
context: .
Copy link
Contributor

Choose a reason for hiding this comment

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

Would be good to add a comment on why this is necessary. I read the official docs, but couldn't quite follow as to why this argument is necessary.

https://github.com/docker/build-push-action?tab=readme-ov-file#git-context

Copy link
Contributor Author

Choose a reason for hiding this comment

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

By default, this action uses the Git context, so you don't need to use the actions/checkout action to check out the repository as this will be done directly by BuildKit.

As we inject a non-tracked file, we need to explicitly use folder level context (instead of context which is just git ls-files).

I'll add a comment

Comment on lines +155 to +157
type=raw,value=${{ env.PATCH }}
type=raw,value=${{ env.MINOR }}
type=raw,value=${{ env.MAJOR }}
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't see these environment variables being set in this workflow file. Are they being set by some other workflow and being injected?

- name: Create manifest list and push
working-directory: ${{ runner.temp }}/digests
run: |
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
Copy link
Contributor

Choose a reason for hiding this comment

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

Would be good to add a comment describing what sets this environment variable; it's not obvious by looking at the configuration.

Could we perhaps split this logic over multiple lines add a comment or two describing the format/conversion with 1 example?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So this, and several other things that might be confusing come directly from Docker's github actions (most copied verbatim): https://docs.docker.com/build/ci/github-actions/multi-platform/#distribute-build-across-multiple-runners

I will add a comment about the source of those steps, but I consider them internal details of the steps provided by the various docker actions – as such I would rather not deviate textually from the actions they have in their docs – all those env variables are set and processed by their custom actions.

sha256 = "4b8eff986643b8d9918c4fd3ada9c0eee7e59230a53a46a9bd9686521dcad170",
urls = ["https://github.com/rhysd/actionlint/releases/download/v1.6.27/actionlint_1.6.27_darwin_arm64.tar.gz"],
sha256 = "2693315b9093aeacb4ebd91a993fea54fc215057bf0da2659056b4bc033873db",
urls = ["https://github.com/rhysd/actionlint/releases/download/v1.7.7/actionlint_1.7.7_darwin_arm64.tar.gz"],
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you briefly describe why we needed to bump actionlint here? Did you hit a bug?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

https://github.com/rhysd/actionlint/releases/tag/v1.7.7

Main reason that they didn't support ubuntu-22.04-arm labels – I could add them to actionlint.yaml, but they're built-in, so why not bump it.

@antonsviridov-src antonsviridov-src merged commit e00ddf5 into main Apr 17, 2025
1 check passed
@antonsviridov-src antonsviridov-src deleted the docker-build branch April 17, 2025 14:39
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