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

Allow building buildx from source #99

Merged
merged 1 commit into from Jul 2, 2021
Merged

Conversation

crazy-max
Copy link
Member

@crazy-max crazy-max commented Jun 30, 2021

Closes #98

I made some changes from what we said in #98. Now buildx will be built on-the-fly against the reference passed to build-ref input. Here is a workflow:

build-ref:
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        ref:
          - master
          - refs/tags/v0.5.1
          - refs/pull/648/head
    steps:
      -
        name: Checkout
        uses: actions/checkout@v2
      -
        name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v1
        with:
          build-ref: https://github.com/docker/buildx.git#${{ matrix.ref }}
      -
        name: Check version
        run: |
          docker buildx version

Run: https://github.com/docker/setup-buildx-action/runs/2963153312?check_suite_focus=true#step:3:94

cc @tonistiigi

Signed-off-by: CrazyMax crazy-max@users.noreply.github.com

@crazy-max crazy-max force-pushed the build-ref branch 2 times, most recently from b592f11 to f258f34 Compare Jun 30, 2021
src/buildx.ts Outdated
return tc.cacheFile(
`${outFolder}/buildx`,
context.osPlat == 'win32' ? 'docker-buildx.exe' : 'docker-buildx',
'buildx',
sha
);
Copy link
Member Author

@crazy-max crazy-max Jun 30, 2021

Choose a reason for hiding this comment

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

Binary will be cached. Atm remote ref sha is used as cache key. ${repo}-${sha} would be safer imo but it's fine in the meantime.

Copy link
Member

@tonistiigi tonistiigi left a comment

Overall LGTM but the build-ref name is not great. Maybe buildx-source? Theoretically, we could also just use the version field and detect if it is a URL to a git repo.

Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
@crazy-max
Copy link
Member Author

@crazy-max crazy-max commented Jul 2, 2021

@tonistiigi

we could also just use the version field and detect if it is a URL to a git repo.

Ok I've changed the version input behavior to handle a git context if we want to build from source.

@crazy-max crazy-max changed the title Add build-ref input Allow building buildx from source Jul 2, 2021
@crazy-max crazy-max merged commit e673438 into docker:master Jul 2, 2021
25 checks passed
@crazy-max crazy-max deleted the build-ref branch Jul 2, 2021
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.

None yet

2 participants