mirror of
https://github.com/docker/login-action.git
synced 2026-03-25 16:38:17 +00:00
Compare commits
11 Commits
dependabot
...
dependabot
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4392a0a50e | ||
|
|
80702da7a2 | ||
|
|
292fe2d7ee | ||
|
|
717e062c09 | ||
|
|
b9381571b7 | ||
|
|
7277d4d442 | ||
|
|
955b3c705f | ||
|
|
da5b89b92c | ||
|
|
b78dc2c156 | ||
|
|
c144859092 | ||
|
|
cf45a603d2 |
37
.github/workflows/codeql.yml
vendored
37
.github/workflows/codeql.yml
vendored
@@ -5,46 +5,41 @@ on:
|
||||
branches:
|
||||
- 'master'
|
||||
- 'releases/v*'
|
||||
paths:
|
||||
- '.github/workflows/codeql.yml'
|
||||
- 'dist/**'
|
||||
- 'src/**'
|
||||
pull_request:
|
||||
paths:
|
||||
- '.github/workflows/codeql.yml'
|
||||
- 'dist/**'
|
||||
- 'src/**'
|
||||
|
||||
permissions:
|
||||
actions: read
|
||||
contents: read
|
||||
security-events: write
|
||||
|
||||
env:
|
||||
NODE_VERSION: "24"
|
||||
|
||||
jobs:
|
||||
analyze:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
language:
|
||||
- javascript-typescript
|
||||
steps:
|
||||
-
|
||||
name: Checkout
|
||||
uses: actions/checkout@v6
|
||||
-
|
||||
name: Enable corepack
|
||||
run: |
|
||||
corepack enable
|
||||
yarn --version
|
||||
-
|
||||
name: Set up Node
|
||||
uses: actions/setup-node@v6
|
||||
with:
|
||||
node-version: ${{ env.NODE_VERSION }}
|
||||
-
|
||||
name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v4
|
||||
with:
|
||||
languages: ${{ matrix.language }}
|
||||
config: |
|
||||
paths:
|
||||
- src
|
||||
-
|
||||
name: Autobuild
|
||||
uses: github/codeql-action/autobuild@v4
|
||||
languages: javascript-typescript
|
||||
build-mode: none
|
||||
-
|
||||
name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v4
|
||||
with:
|
||||
category: "/language:${{matrix.language}}"
|
||||
category: "/language:javascript-typescript"
|
||||
|
||||
2
.github/workflows/update-dist.yml
vendored
2
.github/workflows/update-dist.yml
vendored
@@ -14,7 +14,7 @@ jobs:
|
||||
-
|
||||
name: GitHub auth token from GitHub App
|
||||
id: docker-read-app
|
||||
uses: actions/create-github-app-token@v2
|
||||
uses: actions/create-github-app-token@v3
|
||||
with:
|
||||
app-id: ${{ secrets.GHACTIONS_REPO_WRITE_APP_ID }}
|
||||
private-key: ${{ secrets.GHACTIONS_REPO_WRITE_APP_PRIVATE_KEY }}
|
||||
|
||||
@@ -1,6 +1,17 @@
|
||||
import {expect, test} from 'vitest';
|
||||
import {afterEach, expect, test} from 'vitest';
|
||||
import * as path from 'path';
|
||||
|
||||
import {getInputs} from '../src/context.js';
|
||||
import {Buildx} from '@docker/actions-toolkit/lib/buildx/buildx.js';
|
||||
|
||||
import {getAuthList, getInputs} from '../src/context.js';
|
||||
|
||||
afterEach(() => {
|
||||
for (const key of Object.keys(process.env)) {
|
||||
if (key.startsWith('INPUT_')) {
|
||||
delete process.env[key];
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
test('with password and username getInputs does not throw error', async () => {
|
||||
process.env['INPUT_USERNAME'] = 'dbowie';
|
||||
@@ -10,3 +21,15 @@ test('with password and username getInputs does not throw error', async () => {
|
||||
getInputs();
|
||||
}).not.toThrow();
|
||||
});
|
||||
|
||||
test('getAuthList uses the default Docker Hub registry when computing scoped config dir', async () => {
|
||||
process.env['INPUT_USERNAME'] = 'dbowie';
|
||||
process.env['INPUT_PASSWORD'] = 'groundcontrol';
|
||||
process.env['INPUT_SCOPE'] = 'myscope';
|
||||
process.env['INPUT_LOGOUT'] = 'false';
|
||||
const [auth] = getAuthList(getInputs());
|
||||
expect(auth).toMatchObject({
|
||||
registry: 'docker.io',
|
||||
configDir: path.join(Buildx.configDir, 'config', 'registry-1.docker.io', 'myscope')
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,15 +1,10 @@
|
||||
import {expect, test, vi} from 'vitest';
|
||||
import * as path from 'path';
|
||||
|
||||
import {Docker} from '@docker/actions-toolkit/lib/docker/docker.js';
|
||||
|
||||
import {loginStandard, logout} from '../src/docker.js';
|
||||
|
||||
process.env['RUNNER_TEMP'] = path.join(__dirname, 'runner');
|
||||
|
||||
test('loginStandard calls exec', async () => {
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
const execSpy = vi.spyOn(Docker, 'getExecOutput').mockImplementation(async () => {
|
||||
return {
|
||||
exitCode: expect.any(Number),
|
||||
@@ -38,8 +33,6 @@ test('loginStandard calls exec', async () => {
|
||||
});
|
||||
|
||||
test('logout calls exec', async () => {
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
const execSpy = vi.spyOn(Docker, 'getExecOutput').mockImplementation(async () => {
|
||||
return {
|
||||
exitCode: expect.any(Number),
|
||||
|
||||
6
dist/index.js
generated
vendored
6
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
@@ -26,8 +26,8 @@
|
||||
"@aws-sdk/client-ecr": "^3.1000.0",
|
||||
"@aws-sdk/client-ecr-public": "^3.1000.0",
|
||||
"@docker/actions-toolkit": "^0.79.0",
|
||||
"http-proxy-agent": "^8.0.0",
|
||||
"https-proxy-agent": "^8.0.0",
|
||||
"http-proxy-agent": "^7.0.2",
|
||||
"https-proxy-agent": "^7.0.6",
|
||||
"js-yaml": "^4.1.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@@ -42,24 +42,26 @@ export function getAuthList(inputs: Inputs): Array<Auth> {
|
||||
}
|
||||
let auths: Array<Auth> = [];
|
||||
if (!inputs.registryAuth) {
|
||||
const registry = inputs.registry || 'docker.io';
|
||||
auths.push({
|
||||
registry: inputs.registry || 'docker.io',
|
||||
registry,
|
||||
username: inputs.username,
|
||||
password: inputs.password,
|
||||
scope: inputs.scope,
|
||||
ecr: inputs.ecr || 'auto',
|
||||
configDir: scopeToConfigDir(inputs.registry, inputs.scope)
|
||||
configDir: scopeToConfigDir(registry, inputs.scope)
|
||||
});
|
||||
} else {
|
||||
auths = (yaml.load(inputs.registryAuth) as Array<Auth>).map(auth => {
|
||||
core.setSecret(auth.password); // redacted in workflow logs
|
||||
const registry = auth.registry || 'docker.io';
|
||||
return {
|
||||
registry: auth.registry || 'docker.io',
|
||||
registry,
|
||||
username: auth.username,
|
||||
password: auth.password,
|
||||
scope: auth.scope,
|
||||
ecr: auth.ecr || 'auto',
|
||||
configDir: scopeToConfigDir(auth.registry || 'docker.io', auth.scope)
|
||||
configDir: scopeToConfigDir(registry, auth.scope)
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
61
yarn.lock
61
yarn.lock
@@ -2647,13 +2647,6 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"agent-base@npm:8.0.0":
|
||||
version: 8.0.0
|
||||
resolution: "agent-base@npm:8.0.0"
|
||||
checksum: 10/a660ae60d389c4ce0f5a178efd5e6ebeefeddf0f6defbb105c638056ec0ebd3828d00d029cf5b26e3ce52d09c393735bf9c187ed1000a0be2c6cf5d95ac15bff
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"agent-base@npm:^7.0.2, agent-base@npm:^7.1.0":
|
||||
version: 7.1.0
|
||||
resolution: "agent-base@npm:7.1.0"
|
||||
@@ -3165,8 +3158,8 @@ __metadata:
|
||||
eslint-config-prettier: "npm:^10.1.8"
|
||||
eslint-plugin-prettier: "npm:^5.5.5"
|
||||
globals: "npm:^17.3.0"
|
||||
http-proxy-agent: "npm:^8.0.0"
|
||||
https-proxy-agent: "npm:^8.0.0"
|
||||
http-proxy-agent: "npm:^7.0.2"
|
||||
https-proxy-agent: "npm:^7.0.6"
|
||||
js-yaml: "npm:^4.1.1"
|
||||
prettier: "npm:^3.8.1"
|
||||
typescript: "npm:^5.9.3"
|
||||
@@ -3582,7 +3575,7 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"fast-xml-parser@npm:5.3.6":
|
||||
"fast-xml-parser@npm:5.3.6, fast-xml-parser@npm:^5.0.7":
|
||||
version: 5.3.6
|
||||
resolution: "fast-xml-parser@npm:5.3.6"
|
||||
dependencies:
|
||||
@@ -3593,17 +3586,6 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"fast-xml-parser@npm:^5.0.7":
|
||||
version: 5.3.4
|
||||
resolution: "fast-xml-parser@npm:5.3.4"
|
||||
dependencies:
|
||||
strnum: "npm:^2.1.0"
|
||||
bin:
|
||||
fxparser: src/cli/cli.js
|
||||
checksum: 10/0d7e6872fed7c3065641400d43cdf24c03177f05c343bfb31df53b79f0900b085c103f647852d0b00693125aa3f0e9d8b8cfc4273b168d4da0308f857dafe830
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"fdir@npm:^6.5.0":
|
||||
version: 6.5.0
|
||||
resolution: "fdir@npm:6.5.0"
|
||||
@@ -3646,9 +3628,9 @@ __metadata:
|
||||
linkType: hard
|
||||
|
||||
"flatted@npm:^3.2.9":
|
||||
version: 3.3.3
|
||||
resolution: "flatted@npm:3.3.3"
|
||||
checksum: 10/8c96c02fbeadcf4e8ffd0fa24983241e27698b0781295622591fc13585e2f226609d95e422bcf2ef044146ffacb6b68b1f20871454eddf75ab3caa6ee5f4a1fe
|
||||
version: 3.4.2
|
||||
resolution: "flatted@npm:3.4.2"
|
||||
checksum: 10/a9e78fe5c2c1fcd98209a015ccee3a6caa953e01729778e83c1fe92e68601a63e1e69cd4e573010ca99eaf585a581b80ccf1018b99283e6cbc2117bcba1e030f
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
@@ -3834,7 +3816,7 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"http-proxy-agent@npm:^7.0.0":
|
||||
"http-proxy-agent@npm:^7.0.0, http-proxy-agent@npm:^7.0.2":
|
||||
version: 7.0.2
|
||||
resolution: "http-proxy-agent@npm:7.0.2"
|
||||
dependencies:
|
||||
@@ -3844,17 +3826,7 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"http-proxy-agent@npm:^8.0.0":
|
||||
version: 8.0.0
|
||||
resolution: "http-proxy-agent@npm:8.0.0"
|
||||
dependencies:
|
||||
agent-base: "npm:8.0.0"
|
||||
debug: "npm:^4.3.4"
|
||||
checksum: 10/ad68856d85c58b654cbe238dc00dde177b5085271e2ff174be65c5b58f6f4e782199683771e8c6b697127620da5dda6643008fd508627414950261a482416347
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"https-proxy-agent@npm:^7.0.0":
|
||||
"https-proxy-agent@npm:^7.0.0, https-proxy-agent@npm:^7.0.6":
|
||||
version: 7.0.6
|
||||
resolution: "https-proxy-agent@npm:7.0.6"
|
||||
dependencies:
|
||||
@@ -3874,16 +3846,6 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"https-proxy-agent@npm:^8.0.0":
|
||||
version: 8.0.0
|
||||
resolution: "https-proxy-agent@npm:8.0.0"
|
||||
dependencies:
|
||||
agent-base: "npm:8.0.0"
|
||||
debug: "npm:^4.3.4"
|
||||
checksum: 10/0de830cb33a47d521783479ef6d1ff256c7bfcee7109bbda279c66bb1ba220ef025a2f25b73e187d9cbf5691a2dd9336a779b389f9fdd29ad772f1dbc51aaaf0
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"iconv-lite@npm:^0.6.2":
|
||||
version: 0.6.3
|
||||
resolution: "iconv-lite@npm:0.6.3"
|
||||
@@ -5267,13 +5229,6 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"strnum@npm:^2.1.0":
|
||||
version: 2.1.1
|
||||
resolution: "strnum@npm:2.1.1"
|
||||
checksum: 10/d5fe6e4333cddc17569331048e403e876ffcf629989815f0359b0caf05dae9441b7eef3d7dd07427313ac8b3f05a8f60abc1f61efc15f97245dbc24028362bc9
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"strnum@npm:^2.1.2":
|
||||
version: 2.2.0
|
||||
resolution: "strnum@npm:2.2.0"
|
||||
|
||||
Reference in New Issue
Block a user