From 9e7100d2e84c22829cfe9c0ac8eb4912e54ee017 Mon Sep 17 00:00:00 2001 From: Shreyas Goenka Date: Mon, 15 Apr 2024 14:36:14 +0200 Subject: [PATCH] Add support for multi-arch docker images --- .github/workflows/release.yml | 179 +++++++++++++++++----------------- .goreleaser.yaml | 10 ++ 2 files changed, 100 insertions(+), 89 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f9b4ec15f0..3793cac4c3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -4,6 +4,7 @@ on: push: tags: - "v*" + - "v0.0.0-docker" workflow_dispatch: @@ -46,99 +47,99 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - create-setup-cli-release-pr: - needs: goreleaser - runs-on: ubuntu-latest - steps: - - name: Set VERSION variable from tag - run: | - VERSION=${{ github.ref_name }} - echo "VERSION=${VERSION:1}" >> $GITHUB_ENV + # create-setup-cli-release-pr: + # needs: goreleaser + # runs-on: ubuntu-latest + # steps: + # - name: Set VERSION variable from tag + # run: | + # VERSION=${{ github.ref_name }} + # echo "VERSION=${VERSION:1}" >> $GITHUB_ENV - - name: Update setup-cli - uses: actions/github-script@v6 - with: - github-token: ${{ secrets.DECO_GITHUB_TOKEN }} - script: | - await github.rest.actions.createWorkflowDispatch({ - owner: 'databricks', - repo: 'setup-cli', - workflow_id: 'release-pr.yml', - ref: 'main', - inputs: { - version: "${{ env.VERSION }}", - } - }); + # - name: Update setup-cli + # uses: actions/github-script@v6 + # with: + # github-token: ${{ secrets.DECO_GITHUB_TOKEN }} + # script: | + # await github.rest.actions.createWorkflowDispatch({ + # owner: 'databricks', + # repo: 'setup-cli', + # workflow_id: 'release-pr.yml', + # ref: 'main', + # inputs: { + # version: "${{ env.VERSION }}", + # } + # }); - create-homebrew-tap-release-pr: - needs: goreleaser - runs-on: ubuntu-latest - steps: - - name: Set VERSION variable from tag - run: | - VERSION=${{ github.ref_name }} - echo "VERSION=${VERSION:1}" >> $GITHUB_ENV + # create-homebrew-tap-release-pr: + # needs: goreleaser + # runs-on: ubuntu-latest + # steps: + # - name: Set VERSION variable from tag + # run: | + # VERSION=${{ github.ref_name }} + # echo "VERSION=${VERSION:1}" >> $GITHUB_ENV - - name: Update homebrew-tap - uses: actions/github-script@v6 - with: - github-token: ${{ secrets.DECO_GITHUB_TOKEN }} - script: | - let artifacts = JSON.parse('${{ needs.goreleaser.outputs.artifacts }}') - artifacts = artifacts.filter(a => a.type == "Archive") - artifacts = new Map( - artifacts.map(a => [ - a.goos + "_" + a.goarch, - a.extra.Checksum.replace("sha256:", "") - ]) - ) + # - name: Update homebrew-tap + # uses: actions/github-script@v6 + # with: + # github-token: ${{ secrets.DECO_GITHUB_TOKEN }} + # script: | + # let artifacts = JSON.parse('${{ needs.goreleaser.outputs.artifacts }}') + # artifacts = artifacts.filter(a => a.type == "Archive") + # artifacts = new Map( + # artifacts.map(a => [ + # a.goos + "_" + a.goarch, + # a.extra.Checksum.replace("sha256:", "") + # ]) + # ) - await github.rest.actions.createWorkflowDispatch({ - owner: 'databricks', - repo: 'homebrew-tap', - workflow_id: 'release-pr.yml', - ref: 'main', - inputs: { - version: "${{ env.VERSION }}", - darwin_amd64_sha: artifacts.get('darwin_amd64'), - darwin_arm64_sha: artifacts.get('darwin_arm64'), - linux_amd64_sha: artifacts.get('linux_amd64'), - linux_arm64_sha: artifacts.get('linux_arm64') - } - }); + # await github.rest.actions.createWorkflowDispatch({ + # owner: 'databricks', + # repo: 'homebrew-tap', + # workflow_id: 'release-pr.yml', + # ref: 'main', + # inputs: { + # version: "${{ env.VERSION }}", + # darwin_amd64_sha: artifacts.get('darwin_amd64'), + # darwin_arm64_sha: artifacts.get('darwin_arm64'), + # linux_amd64_sha: artifacts.get('linux_amd64'), + # linux_arm64_sha: artifacts.get('linux_arm64') + # } + # }); - create-vscode-extension-update-pr: - needs: goreleaser - runs-on: ubuntu-latest - steps: - - name: Set VERSION variable from tag - run: | - VERSION=${{ github.ref_name }} - echo "VERSION=${VERSION:1}" >> $GITHUB_ENV + # create-vscode-extension-update-pr: + # needs: goreleaser + # runs-on: ubuntu-latest + # steps: + # - name: Set VERSION variable from tag + # run: | + # VERSION=${{ github.ref_name }} + # echo "VERSION=${VERSION:1}" >> $GITHUB_ENV - - name: Update CLI version in the VSCode extension - uses: actions/github-script@v6 - with: - github-token: ${{ secrets.DECO_GITHUB_TOKEN }} - script: | - await github.rest.actions.createWorkflowDispatch({ - owner: 'databricks', - repo: 'databricks-vscode', - workflow_id: 'update-cli-version.yml', - ref: 'main', - inputs: { - version: "${{ env.VERSION }}", - } - }); + # - name: Update CLI version in the VSCode extension + # uses: actions/github-script@v6 + # with: + # github-token: ${{ secrets.DECO_GITHUB_TOKEN }} + # script: | + # await github.rest.actions.createWorkflowDispatch({ + # owner: 'databricks', + # repo: 'databricks-vscode', + # workflow_id: 'update-cli-version.yml', + # ref: 'main', + # inputs: { + # version: "${{ env.VERSION }}", + # } + # }); - publish-to-winget-pkgs: - needs: goreleaser - runs-on: windows-latest - environment: release - steps: - - uses: vedantmgoyal2009/winget-releaser@93fd8b606a1672ec3e5c6c3bb19426be68d1a8b0 # https://github.com/vedantmgoyal2009/winget-releaser/releases/tag/v2 - with: - identifier: Databricks.DatabricksCLI - installers-regex: 'windows_.*\.zip$' # Only windows releases - token: ${{ secrets.ENG_DEV_ECOSYSTEM_BOT_TOKEN }} - fork-user: eng-dev-ecosystem-bot + # publish-to-winget-pkgs: + # needs: goreleaser + # runs-on: windows-latest + # environment: release + # steps: + # - uses: vedantmgoyal2009/winget-releaser@93fd8b606a1672ec3e5c6c3bb19426be68d1a8b0 # https://github.com/vedantmgoyal2009/winget-releaser/releases/tag/v2 + # with: + # identifier: Databricks.DatabricksCLI + # installers-regex: 'windows_.*\.zip$' # Only windows releases + # token: ${{ secrets.ENG_DEV_ECOSYSTEM_BOT_TOKEN }} + # fork-user: eng-dev-ecosystem-bot diff --git a/.goreleaser.yaml b/.goreleaser.yaml index e440687473..d37876edb0 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -75,6 +75,16 @@ dockers: - "./docker/config.tfrc" - "./docker/setup.sh" +docker_manifests: + - name_template: ghcr.io/databricks/cli:{{replace .Version "+" "-"}} + image_templates: + - ghcr.io/databricks/cli:{{replace .Version "+" "-"}}-amd64 + - ghcr.io/databricks/cli:{{replace .Version "+" "-"}}-arm64 + - name_template: ghcr.io/databricks/cli:latest + image_templates: + - ghcr.io/databricks/cli:latest-amd64 + - ghcr.io/databricks/cli:latest-arm64 + checksum: name_template: 'databricks_cli_{{ .Version }}_SHA256SUMS'