mirror of
https://gh-proxy.org/https://github.com/docker/login-action.git
synced 2026-07-25 12:23:01 +08:00
support dhi.io as Docker Hub OIDC registry
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
This commit is contained in:
+2
-5
@@ -12,17 +12,14 @@ interface OIDCTokenResponse {
|
|||||||
access_token: string;
|
access_token: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const registries = new Set(['', 'docker.io', 'registry-1.docker.io', 'registry-1-stage.docker.io', 'dhi.io']);
|
||||||
const defaultExpiresIn = 300;
|
const defaultExpiresIn = 300;
|
||||||
const minExpiresIn = 300;
|
const minExpiresIn = 300;
|
||||||
const maxExpiresIn = 3600;
|
const maxExpiresIn = 3600;
|
||||||
const maxRetries = 5;
|
const maxRetries = 5;
|
||||||
|
|
||||||
export const isDockerHubOIDC = (registry: string, password: string): boolean => {
|
export const isDockerHubOIDC = (registry: string, password: string): boolean => {
|
||||||
return process.env.DOCKERHUB_OIDC_CONNECTIONID !== undefined && !password && isDockerHubRegistry(registry);
|
return process.env.DOCKERHUB_OIDC_CONNECTIONID !== undefined && !password && registries.has(registry);
|
||||||
};
|
|
||||||
|
|
||||||
const isDockerHubRegistry = (registry: string): boolean => {
|
|
||||||
return registry === '' || registry === 'docker.io' || registry === 'registry-1.docker.io' || registry === 'registry-1-stage.docker.io';
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getOIDCToken = async (registry: string, username: string): Promise<LoginCredentials> => {
|
export const getOIDCToken = async (registry: string, username: string): Promise<LoginCredentials> => {
|
||||||
|
|||||||
Reference in New Issue
Block a user