Merge pull request #663 from crazy-max/fix-git-token-cond
Some checks failed
example / docker (push) Has been cancelled
e2e / docker (AWS_SECRET_ACCESS_KEY, 175142243308.dkr.ecr.us-east-2.amazonaws.com, 175142243308.dkr.ecr.us-east-2.amazonaws.com/sandbox/test-docker-action, AWS_ACCESS_KEY_ID) (push) Has been cancelled
e2e / docker (AWS_SECRET_ACCESS_KEY, public.ecr.aws, public.ecr.aws/q3b5f1u4/test-docker-action, AWS_ACCESS_KEY_ID) (push) Has been cancelled
e2e / docker (AZURE_CLIENT_SECRET, officialgithubactions.azurecr.io, officialgithubactions.azurecr.io/test-docker-action, AZURE_CLIENT_ID) (push) Has been cancelled
e2e / docker (DOCKERHUB_TOKEN, , ghactionstest/ghactionstest, DOCKERHUB_USERNAME) (push) Has been cancelled
e2e / docker (GAR_JSON_KEY, us-east4-docker.pkg.dev, us-east4-docker.pkg.dev/sandbox-298914/docker-official-github-actions/test-docker-action, GAR_USERNAME) (push) Has been cancelled
e2e / docker (GCR_JSON_KEY, gcr.io, gcr.io/sandbox-298914/test-docker-action, GCR_USERNAME) (push) Has been cancelled
e2e / docker (GHCR_PAT, ghcr.io, ghcr.io/docker-ghactiontest/test, GHCR_USERNAME) (push) Has been cancelled
e2e / docker (GITLAB_TOKEN, registry.gitlab.com, registry.gitlab.com/test1716/test, GITLAB_USERNAME) (push) Has been cancelled
Some checks failed
example / docker (push) Has been cancelled
e2e / docker (AWS_SECRET_ACCESS_KEY, 175142243308.dkr.ecr.us-east-2.amazonaws.com, 175142243308.dkr.ecr.us-east-2.amazonaws.com/sandbox/test-docker-action, AWS_ACCESS_KEY_ID) (push) Has been cancelled
e2e / docker (AWS_SECRET_ACCESS_KEY, public.ecr.aws, public.ecr.aws/q3b5f1u4/test-docker-action, AWS_ACCESS_KEY_ID) (push) Has been cancelled
e2e / docker (AZURE_CLIENT_SECRET, officialgithubactions.azurecr.io, officialgithubactions.azurecr.io/test-docker-action, AZURE_CLIENT_ID) (push) Has been cancelled
e2e / docker (DOCKERHUB_TOKEN, , ghactionstest/ghactionstest, DOCKERHUB_USERNAME) (push) Has been cancelled
e2e / docker (GAR_JSON_KEY, us-east4-docker.pkg.dev, us-east4-docker.pkg.dev/sandbox-298914/docker-official-github-actions/test-docker-action, GAR_USERNAME) (push) Has been cancelled
e2e / docker (GCR_JSON_KEY, gcr.io, gcr.io/sandbox-298914/test-docker-action, GCR_USERNAME) (push) Has been cancelled
e2e / docker (GHCR_PAT, ghcr.io, ghcr.io/docker-ghactiontest/test, GHCR_USERNAME) (push) Has been cancelled
e2e / docker (GITLAB_TOKEN, registry.gitlab.com, registry.gitlab.com/test1716/test, GITLAB_USERNAME) (push) Has been cancelled
Fix GitHub token not passed with Git context if subdir defined
This commit is contained in:
@@ -500,6 +500,25 @@ nproc=3`],
|
||||
'https://github.com/docker/build-push-action.git#refs/heads/test-jest:docker'
|
||||
]
|
||||
],
|
||||
[
|
||||
16,
|
||||
'0.8.2',
|
||||
new Map<string, string>([
|
||||
['github-token', 'abcdefghijklmno0123456789'],
|
||||
['context', '{{defaultContext}}:subdir'],
|
||||
['load', 'false'],
|
||||
['no-cache', 'false'],
|
||||
['push', 'false'],
|
||||
['pull', 'false'],
|
||||
]),
|
||||
[
|
||||
'build',
|
||||
'--iidfile', '/tmp/.docker-build-push-jest/iidfile',
|
||||
'--secret', 'id=GIT_AUTH_TOKEN,src=/tmp/.docker-build-push-jest/.tmpname-jest',
|
||||
'--metadata-file', '/tmp/.docker-build-push-jest/metadata-file',
|
||||
'https://github.com/docker/build-push-action.git#refs/heads/test-jest:subdir'
|
||||
]
|
||||
]
|
||||
])(
|
||||
'[%d] given %p with %p as inputs, returns %p',
|
||||
async (num: number, buildxVersion: string, inputs: Map<string, string>, expected: Array<string>) => {
|
||||
|
||||
2
dist/index.js
generated
vendored
2
dist/index.js
generated
vendored
File diff suppressed because one or more lines are too long
2
dist/index.js.map
generated
vendored
2
dist/index.js.map
generated
vendored
File diff suppressed because one or more lines are too long
@@ -101,15 +101,16 @@ export async function getInputs(defaultContext: string): Promise<Inputs> {
|
||||
}
|
||||
|
||||
export async function getArgs(inputs: Inputs, defaultContext: string, buildxVersion: string): Promise<Array<string>> {
|
||||
const context = handlebars.compile(inputs.context)({defaultContext});
|
||||
// prettier-ignore
|
||||
return [
|
||||
...await getBuildArgs(inputs, defaultContext, buildxVersion),
|
||||
...await getBuildArgs(inputs, defaultContext, context, buildxVersion),
|
||||
...await getCommonArgs(inputs, buildxVersion),
|
||||
handlebars.compile(inputs.context)({defaultContext})
|
||||
context
|
||||
];
|
||||
}
|
||||
|
||||
async function getBuildArgs(inputs: Inputs, defaultContext: string, buildxVersion: string): Promise<Array<string>> {
|
||||
async function getBuildArgs(inputs: Inputs, defaultContext: string, context: string, buildxVersion: string): Promise<Array<string>> {
|
||||
const args: Array<string> = ['build'];
|
||||
await asyncForEach(inputs.addHosts, async addHost => {
|
||||
args.push('--add-host', addHost);
|
||||
@@ -166,7 +167,7 @@ async function getBuildArgs(inputs: Inputs, defaultContext: string, buildxVersio
|
||||
core.warning(err.message);
|
||||
}
|
||||
});
|
||||
if (inputs.githubToken && !buildx.hasGitAuthToken(inputs.secrets) && inputs.context == defaultContext) {
|
||||
if (inputs.githubToken && !buildx.hasGitAuthToken(inputs.secrets) && context.startsWith(defaultContext)) {
|
||||
args.push('--secret', await buildx.getSecretString(`GIT_AUTH_TOKEN=${inputs.githubToken}`));
|
||||
}
|
||||
if (inputs.shmSize) {
|
||||
|
||||
Reference in New Issue
Block a user