mirror of
https://github.com/docker/login-action.git
synced 2026-10-20 05:13:06 +01:00
Compare commits
3 Commits
82a137ba99
...
e5665a8005
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e5665a8005 | ||
|
|
580c4eb563 | ||
|
|
4850ca5e15 |
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
@@ -3,7 +3,6 @@ import * as core from '@actions/core';
|
|||||||
import * as yaml from 'js-yaml';
|
import * as yaml from 'js-yaml';
|
||||||
|
|
||||||
import {Buildx} from '@docker/actions-toolkit/lib/buildx/buildx';
|
import {Buildx} from '@docker/actions-toolkit/lib/buildx/buildx';
|
||||||
import {Util} from '@docker/actions-toolkit/lib/util';
|
|
||||||
|
|
||||||
export interface Inputs {
|
export interface Inputs {
|
||||||
registry: string;
|
registry: string;
|
||||||
@@ -70,7 +69,7 @@ export function getAuthList(inputs: Inputs): Array<Auth> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function scopeToConfigDir(registry: string, scope?: string): string {
|
export function scopeToConfigDir(registry: string, scope?: string): string {
|
||||||
if (scopeDisabled() || !scope || scope === '') {
|
if (!scope || scope === '') {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
let configDir = path.join(Buildx.configDir, 'config', registry === 'docker.io' ? 'registry-1.docker.io' : registry);
|
let configDir = path.join(Buildx.configDir, 'config', registry === 'docker.io' ? 'registry-1.docker.io' : registry);
|
||||||
@@ -81,10 +80,3 @@ export function scopeToConfigDir(registry: string, scope?: string): string {
|
|||||||
}
|
}
|
||||||
return configDir;
|
return configDir;
|
||||||
}
|
}
|
||||||
|
|
||||||
function scopeDisabled(): boolean {
|
|
||||||
if (process.env.DOCKER_LOGIN_SCOPE_DISABLED) {
|
|
||||||
return Util.parseBool(process.env.DOCKER_LOGIN_SCOPE_DISABLED);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -56,10 +56,9 @@ export async function loginECR(registry: string, username: string, password: str
|
|||||||
|
|
||||||
async function loginExec(registry: string, username: string, password: string, scope?: string): Promise<void> {
|
async function loginExec(registry: string, username: string, password: string, scope?: string): Promise<void> {
|
||||||
let envs: {[key: string]: string} | undefined;
|
let envs: {[key: string]: string} | undefined;
|
||||||
const configDir = context.scopeToConfigDir(registry, scope);
|
if (scope && scope !== '') {
|
||||||
if (configDir !== '') {
|
|
||||||
envs = Object.assign({}, process.env, {
|
envs = Object.assign({}, process.env, {
|
||||||
DOCKER_CONFIG: configDir
|
DOCKER_CONFIG: context.scopeToConfigDir(registry, scope)
|
||||||
}) as {
|
}) as {
|
||||||
[key: string]: string;
|
[key: string]: string;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user