From 8342e4814b5acdc7ee9af547f95932aa7d9ef381 Mon Sep 17 00:00:00 2001 From: CrazyMax <1951866+crazy-max@users.noreply.github.com> Date: Tue, 14 Jan 2025 14:38:19 +0100 Subject: [PATCH] Revert "set GIT_AUTH_TOKEN secret if Git context used" This reverts commit 932b78563b572e02e419d29c016432436d342b0e. Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com> --- .github/workflows/ci.yml | 1 - src/context.ts | 13 ------------- src/main.ts | 2 +- 3 files changed, 1 insertion(+), 15 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7c30261..f2fb79a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -729,7 +729,6 @@ jobs: name: Build uses: ./ with: - source: . files: | ./test/config.hcl allow: network.host diff --git a/src/context.ts b/src/context.ts index d502cc3..0131234 100644 --- a/src/context.ts +++ b/src/context.ts @@ -68,10 +68,6 @@ export function sanitizeInputs(inputs: Inputs) { return res; } -export function getGitAuthToken(inputs: Inputs): string { - return process.env.BUILDX_BAKE_GIT_AUTH_TOKEN ?? inputs['github-token']; -} - export async function getArgs(inputs: Inputs, definition: BakeDefinition, toolkit: Toolkit): Promise> { // prettier-ignore return [ @@ -101,15 +97,6 @@ async function getBakeArgs(inputs: Inputs, definition: BakeDefinition, toolkit: await Util.asyncForEach(inputs.set, async set => { args.push('--set', set); }); - if (await toolkit.buildx.versionSatisfies('<0.20.0')) { - // For buildx versions < 0.20.0, we need to set GIT_AUTH_TOKEN secret as it - // doesn't infer BUILDX_BAKE_GIT_AUTH_TOKEN environment variable for build - // request: https://github.com/docker/buildx/pull/2905 - const gitAuthToken = getGitAuthToken(inputs); - if (gitAuthToken && !Bake.hasGitAuthTokenSecret(definition) && inputs.source.startsWith(Context.gitContext())) { - args.push('--set', `*.secrets=${Build.resolveSecretString(`GIT_AUTH_TOKEN=${gitAuthToken}`)}`); - } - } if (await toolkit.buildx.versionSatisfies('>=0.6.0')) { args.push('--metadata-file', toolkit.buildxBake.getMetadataFilePath()); } diff --git a/src/main.ts b/src/main.ts index 63e9a88..1335cfc 100644 --- a/src/main.ts +++ b/src/main.ts @@ -30,7 +30,7 @@ actionsToolkit.run( stateHelper.setInputs(inputs); const toolkit = new Toolkit(); - const gitAuthToken = context.getGitAuthToken(inputs); + const gitAuthToken = process.env.BUILDX_BAKE_GIT_AUTH_TOKEN ?? inputs['github-token']; await core.group(`GitHub Actions runtime token ACs`, async () => { try {