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