Skip to content

Commit 10e90e3

Browse files
authored
Merge pull request #1458 from crazy-max/git-auth-port
preserve port in GIT_AUTH_TOKEN host
2 parents 806c751 + 5262538 commit 10e90e3

File tree

4 files changed

+49
-3
lines changed

4 files changed

+49
-3
lines changed

__tests__/context.test.ts

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -857,6 +857,52 @@ ANOTHER_SECRET=ANOTHER_SECRET_ENV`]
857857
['BUILDX_NO_DEFAULT_ATTESTATIONS', '1']
858858
])
859859
],
860+
[
861+
35,
862+
'0.13.1',
863+
new Map<string, string>([
864+
['github-token', 'abcdefghijklmno0123456789'],
865+
['context', '{{defaultContext}}'],
866+
['load', 'false'],
867+
['no-cache', 'false'],
868+
['push', 'false'],
869+
['pull', 'false'],
870+
]),
871+
[
872+
'build',
873+
'--iidfile', imageIDFilePath,
874+
'--attest', `type=provenance,mode=min,inline-only=true,builder-id=http://10.0.0.5:22827/docker/build-push-action/actions/runs/123456789/attempts/1`,
875+
'--secret', `id=GIT_AUTH_TOKEN.10.0.0.5:22827,src=${tmpName}`,
876+
'--metadata-file', metadataJson,
877+
'http://10.0.0.5:22827/docker/build-push-action.git#refs/heads/master'
878+
],
879+
new Map<string, string>([
880+
['GITHUB_SERVER_URL', 'http://10.0.0.5:22827'],
881+
])
882+
],
883+
[
884+
36,
885+
'0.13.1',
886+
new Map<string, string>([
887+
['github-token', 'abcdefghijklmno0123456789'],
888+
['context', '{{defaultContext}}'],
889+
['load', 'false'],
890+
['no-cache', 'false'],
891+
['push', 'false'],
892+
['pull', 'false'],
893+
]),
894+
[
895+
'build',
896+
'--iidfile', imageIDFilePath,
897+
'--attest', `type=provenance,mode=min,inline-only=true,builder-id=https://github.cds.internal.unity3d.com/docker/build-push-action/actions/runs/123456789/attempts/1`,
898+
'--secret', `id=GIT_AUTH_TOKEN.github.cds.internal.unity3d.com,src=${tmpName}`,
899+
'--metadata-file', metadataJson,
900+
'https://github.cds.internal.unity3d.com/docker/build-push-action.git#refs/heads/master'
901+
],
902+
new Map<string, string>([
903+
['GITHUB_SERVER_URL', 'https://github.cds.internal.unity3d.com'],
904+
])
905+
],
860906
])(
861907
'[%d] given %p with %p as inputs, returns %p',
862908
async (num: number, buildxVersion: string, inputs: Map<string, string>, expected: Array<string>, envs: Map<string, string> | undefined) => {

dist/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/context.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ async function getBuildArgs(inputs: Inputs, context: string, toolkit: Toolkit):
183183
}
184184
});
185185
if (inputs['github-token'] && !Build.hasGitAuthTokenSecret(inputs.secrets) && context.startsWith(Context.gitContext())) {
186-
args.push('--secret', Build.resolveSecretString(`GIT_AUTH_TOKEN.${new URL(GitHub.serverURL).hostname.trimEnd()}=${inputs['github-token']}`));
186+
args.push('--secret', Build.resolveSecretString(`GIT_AUTH_TOKEN.${new URL(GitHub.serverURL).host.trimEnd()}=${inputs['github-token']}`));
187187
}
188188
if (inputs['shm-size']) {
189189
args.push('--shm-size', inputs['shm-size']);

0 commit comments

Comments
 (0)