Compare commits

...

34 Commits

Author SHA1 Message Date
CrazyMax
f4ef78c080 Merge pull request #299 from docker/dependabot/npm_and_yarn/aws-sdk/client-ecr-public-3.186.0
Bump @aws-sdk/client-ecr-public from 3.53.0 to 3.186.0
2022-10-07 19:46:23 +02:00
CrazyMax
9ad4ce3929 Update generated content
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2022-10-07 19:44:18 +02:00
dependabot[bot]
884eadd4f8 Bump @aws-sdk/client-ecr-public from 3.53.0 to 3.186.0
Bumps [@aws-sdk/client-ecr-public](https://github.com/aws/aws-sdk-js-v3/tree/HEAD/clients/client-ecr-public) from 3.53.0 to 3.186.0.
- [Release notes](https://github.com/aws/aws-sdk-js-v3/releases)
- [Changelog](https://github.com/aws/aws-sdk-js-v3/blob/main/clients/client-ecr-public/CHANGELOG.md)
- [Commits](https://github.com/aws/aws-sdk-js-v3/commits/v3.186.0/clients/client-ecr-public)

---
updated-dependencies:
- dependency-name: "@aws-sdk/client-ecr-public"
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-07 17:43:15 +00:00
CrazyMax
a266232f5c Merge pull request #298 from docker/dependabot/npm_and_yarn/aws-sdk/client-ecr-3.186.0
Bump @aws-sdk/client-ecr from 3.53.0 to 3.186.0
2022-10-07 19:41:49 +02:00
CrazyMax
f97efcfbf9 Update generated content
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2022-10-07 19:39:55 +02:00
dependabot[bot]
5ae789beac Bump @aws-sdk/client-ecr from 3.53.0 to 3.186.0
Bumps [@aws-sdk/client-ecr](https://github.com/aws/aws-sdk-js-v3/tree/HEAD/clients/client-ecr) from 3.53.0 to 3.186.0.
- [Release notes](https://github.com/aws/aws-sdk-js-v3/releases)
- [Changelog](https://github.com/aws/aws-sdk-js-v3/blob/main/clients/client-ecr/CHANGELOG.md)
- [Commits](https://github.com/aws/aws-sdk-js-v3/commits/v3.186.0/clients/client-ecr)

---
updated-dependencies:
- dependency-name: "@aws-sdk/client-ecr"
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-07 17:36:43 +00:00
CrazyMax
71c23b5b34 Merge pull request #292 from docker/dependabot/npm_and_yarn/actions/core-1.10.0
Bump @actions/core from 1.9.1 to 1.10.0
2022-10-07 19:35:19 +02:00
CrazyMax
6401d70aab Update generated content
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2022-10-07 19:32:35 +02:00
dependabot[bot]
67e8909cc6 Bump @actions/core from 1.9.1 to 1.10.0
Bumps [@actions/core](https://github.com/actions/toolkit/tree/HEAD/packages/core) from 1.9.1 to 1.10.0.
- [Release notes](https://github.com/actions/toolkit/releases)
- [Changelog](https://github.com/actions/toolkit/blob/main/packages/core/RELEASES.md)
- [Commits](https://github.com/actions/toolkit/commits/HEAD/packages/core)

---
updated-dependencies:
- dependency-name: "@actions/core"
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-09-30 05:26:30 +00:00
Tõnis Tiigi
21f251affc Merge pull request #275 from crazy-max/redact-aws-creds
aws: ensure temp credentials redacted in workflow logs
2022-09-08 18:44:05 -07:00
CrazyMax
07cad18854 aws: ensure temp credentials redacted in workflow logs
Just for good measure and extra safety, redact temporary
credentials when aws authorization token is retrieved using
IAM authentication credentials to access Amazon ECR.

Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2022-09-09 00:05:45 +02:00
CrazyMax
be010b4293 Merge pull request #252 from docker/dependabot/npm_and_yarn/actions/core-1.9.1
Bump @actions/core from 1.6.0 to 1.9.1
2022-08-24 13:16:26 +02:00
CrazyMax
f719196635 Update generated content
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2022-08-24 12:32:26 +02:00
dependabot[bot]
9607a71381 Bump @actions/core from 1.6.0 to 1.9.1
Bumps [@actions/core](https://github.com/actions/toolkit/tree/HEAD/packages/core) from 1.6.0 to 1.9.1.
- [Release notes](https://github.com/actions/toolkit/releases)
- [Changelog](https://github.com/actions/toolkit/blob/main/packages/core/RELEASES.md)
- [Commits](https://github.com/actions/toolkit/commits/HEAD/packages/core)

---
updated-dependencies:
- dependency-name: "@actions/core"
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-08-09 05:15:53 +00:00
CrazyMax
d398f07826 Merge pull request #200 from crazy-max/update-refs
Bump all Docker actions to latest major
2022-05-05 19:45:44 +02:00
CrazyMax
31aab9fb7e Bump all Docker actions to latest major
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2022-05-05 19:36:43 +02:00
CrazyMax
49ed152c8e Merge pull request #161 from crazy-max/node16-runtime
Node 16 as default runtime
2022-05-05 18:59:26 +02:00
CrazyMax
b61a9ce7bd Node 16 as default runtime
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2022-05-04 15:17:49 +02:00
CrazyMax
3a136a8631 Merge pull request #182 from docker/dependabot/npm_and_yarn/https-proxy-agent-5.0.1
Bump https-proxy-agent from 5.0.0 to 5.0.1
2022-04-28 07:51:49 +02:00
CrazyMax
b312880b69 Update generated content
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2022-04-28 07:50:23 +02:00
dependabot[bot]
795794e081 Bump https-proxy-agent from 5.0.0 to 5.0.1
Bumps [https-proxy-agent](https://github.com/TooTallNate/node-https-proxy-agent) from 5.0.0 to 5.0.1.
- [Release notes](https://github.com/TooTallNate/node-https-proxy-agent/releases)
- [Commits](https://github.com/TooTallNate/node-https-proxy-agent/compare/5.0.0...5.0.1)

---
updated-dependencies:
- dependency-name: https-proxy-agent
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-04-15 05:15:24 +00:00
CrazyMax
1edf6180e0 Merge pull request #179 from docker/dependabot/github_actions/codecov/codecov-action-3
Bump codecov/codecov-action from 2 to 3
2022-04-12 13:18:35 +02:00
dependabot[bot]
8e66ad4089 Bump codecov/codecov-action from 2 to 3
Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 2 to 3.
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Changelog](https://github.com/codecov/codecov-action/blob/master/CHANGELOG.md)
- [Commits](https://github.com/codecov/codecov-action/compare/v2...v3)

---
updated-dependencies:
- dependency-name: codecov/codecov-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-04-06 05:12:12 +00:00
CrazyMax
7c79b598ea Merge pull request #176 from docker/dependabot/npm_and_yarn/minimist-1.2.6
Bump minimist from 1.2.5 to 1.2.6
2022-03-28 15:57:28 +02:00
dependabot[bot]
24a38e0d6d Bump minimist from 1.2.5 to 1.2.6
Bumps [minimist](https://github.com/substack/minimist) from 1.2.5 to 1.2.6.
- [Release notes](https://github.com/substack/minimist/releases)
- [Commits](https://github.com/substack/minimist/compare/1.2.5...1.2.6)

---
updated-dependencies:
- dependency-name: minimist
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-27 13:30:24 +00:00
CrazyMax
70e1ff84cb Merge pull request #170 from crazy-max/eslint
dev: switch to eslint
2022-03-21 11:01:12 +01:00
CrazyMax
0828e0e718 dev: switch to eslint
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2022-03-21 10:58:19 +01:00
CrazyMax
56f72fcef0 dev: update bins and frontend
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2022-03-21 10:58:18 +01:00
CrazyMax
f169e16aaa Merge pull request #168 from docker/dependabot/npm_and_yarn/actions/io-1.1.2
Bump @actions/io from 1.1.1 to 1.1.2
2022-03-21 09:18:08 +01:00
dependabot[bot]
fa178e4710 Bump @actions/io from 1.1.1 to 1.1.2
Bumps [@actions/io](https://github.com/actions/toolkit/tree/HEAD/packages/io) from 1.1.1 to 1.1.2.
- [Release notes](https://github.com/actions/toolkit/releases)
- [Changelog](https://github.com/actions/toolkit/blob/main/packages/io/RELEASES.md)
- [Commits](https://github.com/actions/toolkit/commits/HEAD/packages/io)

---
updated-dependencies:
- dependency-name: "@actions/io"
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-21 08:15:07 +00:00
CrazyMax
a4bf4e934e Merge pull request #167 from docker/dependabot/npm_and_yarn/actions/exec-1.1.1
Bump @actions/exec from 1.1.0 to 1.1.1
2022-03-21 09:12:58 +01:00
dependabot[bot]
2bbd6e81e1 Bump @actions/exec from 1.1.0 to 1.1.1
Bumps [@actions/exec](https://github.com/actions/toolkit/tree/HEAD/packages/exec) from 1.1.0 to 1.1.1.
- [Release notes](https://github.com/actions/toolkit/releases)
- [Changelog](https://github.com/actions/toolkit/blob/main/packages/exec/RELEASES.md)
- [Commits](https://github.com/actions/toolkit/commits/@actions/tool-cache@1.1.1/packages/exec)

---
updated-dependencies:
- dependency-name: "@actions/exec"
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-18 05:14:07 +00:00
CrazyMax
f6d32ad023 Merge pull request #162 from docker/dependabot/github_actions/actions/checkout-3
Bump actions/checkout from 2 to 3
2022-03-02 07:24:37 +01:00
dependabot[bot]
b4595c8bf9 Bump actions/checkout from 2 to 3
Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 3.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v2...v3)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-02 05:15:17 +00:00
20 changed files with 10995 additions and 33011 deletions

23
.eslintrc.json Normal file
View File

@@ -0,0 +1,23 @@
{
"env": {
"node": true,
"es2021": true,
"jest/globals": true
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:jest/recommended",
"plugin:prettier/recommended"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"plugins": [
"@typescript-eslint",
"jest",
"prettier"
]
}

View File

@@ -15,7 +15,7 @@ jobs:
steps: steps:
- -
name: Checkout name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v3
- -
name: Stop docker name: Stop docker
run: | run: |
@@ -39,7 +39,7 @@ jobs:
steps: steps:
- -
name: Checkout name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v3
- -
name: Login to GitHub Container Registry name: Login to GitHub Container Registry
uses: ./ uses: ./
@@ -56,7 +56,7 @@ jobs:
steps: steps:
- -
name: Checkout name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v3
- -
name: Login to GitHub Container Registry name: Login to GitHub Container Registry
uses: ./ uses: ./
@@ -81,7 +81,7 @@ jobs:
steps: steps:
- -
name: Checkout name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v3
- -
name: Login to ACR name: Login to ACR
uses: ./ uses: ./
@@ -101,7 +101,7 @@ jobs:
steps: steps:
- -
name: Checkout name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v3
- -
name: Login to Docker Hub name: Login to Docker Hub
uses: ./ uses: ./
@@ -120,7 +120,7 @@ jobs:
steps: steps:
- -
name: Checkout name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v3
- -
name: Login to ECR name: Login to ECR
uses: ./ uses: ./
@@ -140,7 +140,7 @@ jobs:
steps: steps:
- -
name: Checkout name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v3
- -
name: Configure AWS Credentials name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1 uses: aws-actions/configure-aws-credentials@v1
@@ -165,7 +165,7 @@ jobs:
steps: steps:
- -
name: Checkout name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v3
- -
name: Login to Public ECR name: Login to Public ECR
uses: ./ uses: ./
@@ -187,7 +187,7 @@ jobs:
steps: steps:
- -
name: Checkout name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v3
- -
name: Configure AWS Credentials name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1 uses: aws-actions/configure-aws-credentials@v1
@@ -212,7 +212,7 @@ jobs:
steps: steps:
- -
name: Checkout name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v3
- -
name: Login to GitHub Container Registry name: Login to GitHub Container Registry
uses: ./ uses: ./
@@ -232,7 +232,7 @@ jobs:
steps: steps:
- -
name: Checkout name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v3
- -
name: Login to GitLab name: Login to GitLab
uses: ./ uses: ./
@@ -252,7 +252,7 @@ jobs:
steps: steps:
- -
name: Checkout name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v3
- -
name: Login to Google Artifact Registry name: Login to Google Artifact Registry
uses: ./ uses: ./
@@ -272,7 +272,7 @@ jobs:
steps: steps:
- -
name: Checkout name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v3
- -
name: Login to Google Container Registry name: Login to Google Container Registry
uses: ./ uses: ./

View File

@@ -16,19 +16,19 @@ jobs:
steps: steps:
- -
name: Checkout name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v3
- -
name: Validate name: Validate
uses: docker/bake-action@v1 uses: docker/bake-action@v2
with: with:
targets: validate targets: validate
- -
name: Test name: Test
uses: docker/bake-action@v1 uses: docker/bake-action@v2
with: with:
targets: test targets: test
- -
name: Upload coverage name: Upload coverage
uses: codecov/codecov-action@v2 uses: codecov/codecov-action@v3
with: with:
file: ./coverage/clover.xml file: ./coverage/clover.xml

View File

@@ -47,7 +47,7 @@ jobs:
steps: steps:
- -
name: Login to Docker Hub name: Login to Docker Hub
uses: docker/login-action@v1 uses: docker/login-action@v2
with: with:
username: ${{ secrets.DOCKERHUB_USERNAME }} username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }} password: ${{ secrets.DOCKERHUB_TOKEN }}
@@ -72,7 +72,7 @@ jobs:
steps: steps:
- -
name: Login to GitHub Container Registry name: Login to GitHub Container Registry
uses: docker/login-action@v1 uses: docker/login-action@v2
with: with:
registry: ghcr.io registry: ghcr.io
username: ${{ github.actor }} username: ${{ github.actor }}
@@ -100,7 +100,7 @@ jobs:
steps: steps:
- -
name: Login to GitLab name: Login to GitLab
uses: docker/login-action@v1 uses: docker/login-action@v2
with: with:
registry: registry.gitlab.com registry: registry.gitlab.com
username: ${{ secrets.GITLAB_USERNAME }} username: ${{ secrets.GITLAB_USERNAME }}
@@ -126,7 +126,7 @@ jobs:
steps: steps:
- -
name: Login to ACR name: Login to ACR
uses: docker/login-action@v1 uses: docker/login-action@v2
with: with:
registry: <registry-name>.azurecr.io registry: <registry-name>.azurecr.io
username: ${{ secrets.AZURE_CLIENT_ID }} username: ${{ secrets.AZURE_CLIENT_ID }}
@@ -168,7 +168,7 @@ jobs:
service_account: '<service_account>' service_account: '<service_account>'
- name: Login to GCR - name: Login to GCR
uses: docker/login-action@v1 uses: docker/login-action@v2
with: with:
registry: gcr.io registry: gcr.io
username: oauth2accesstoken username: oauth2accesstoken
@@ -200,7 +200,7 @@ jobs:
steps: steps:
- -
name: Login to GCR name: Login to GCR
uses: docker/login-action@v1 uses: docker/login-action@v2
with: with:
registry: gcr.io registry: gcr.io
username: _json_key username: _json_key
@@ -235,7 +235,7 @@ jobs:
service_account: '<service_account>' service_account: '<service_account>'
- name: Login to GAR - name: Login to GAR
uses: docker/login-action@v1 uses: docker/login-action@v2
with: with:
registry: <location>-docker.pkg.dev registry: <location>-docker.pkg.dev
username: oauth2accesstoken username: oauth2accesstoken
@@ -269,7 +269,7 @@ jobs:
steps: steps:
- -
name: Login to GAR name: Login to GAR
uses: docker/login-action@v1 uses: docker/login-action@v2
with: with:
registry: <location>-docker.pkg.dev registry: <location>-docker.pkg.dev
username: _json_key username: _json_key
@@ -298,7 +298,7 @@ jobs:
steps: steps:
- -
name: Login to ECR name: Login to ECR
uses: docker/login-action@v1 uses: docker/login-action@v2
with: with:
registry: <aws-account-number>.dkr.ecr.<region>.amazonaws.com registry: <aws-account-number>.dkr.ecr.<region>.amazonaws.com
username: ${{ secrets.AWS_ACCESS_KEY_ID }} username: ${{ secrets.AWS_ACCESS_KEY_ID }}
@@ -321,7 +321,7 @@ jobs:
steps: steps:
- -
name: Login to ECR name: Login to ECR
uses: docker/login-action@v1 uses: docker/login-action@v2
with: with:
registry: <aws-account-number>.dkr.ecr.<region>.amazonaws.com registry: <aws-account-number>.dkr.ecr.<region>.amazonaws.com
username: ${{ secrets.AWS_ACCESS_KEY_ID }} username: ${{ secrets.AWS_ACCESS_KEY_ID }}
@@ -355,7 +355,7 @@ jobs:
aws-region: <region> aws-region: <region>
- -
name: Login to ECR name: Login to ECR
uses: docker/login-action@v1 uses: docker/login-action@v2
with: with:
registry: <aws-account-number>.dkr.ecr.<region>.amazonaws.com registry: <aws-account-number>.dkr.ecr.<region>.amazonaws.com
``` ```
@@ -381,7 +381,7 @@ jobs:
steps: steps:
- -
name: Login to Public ECR name: Login to Public ECR
uses: docker/login-action@v1 uses: docker/login-action@v2
with: with:
registry: public.ecr.aws registry: public.ecr.aws
username: ${{ secrets.AWS_ACCESS_KEY_ID }} username: ${{ secrets.AWS_ACCESS_KEY_ID }}
@@ -415,7 +415,7 @@ jobs:
steps: steps:
- -
name: Login to OCIR name: Login to OCIR
uses: docker/login-action@v1 uses: docker/login-action@v2
with: with:
registry: <region>.ocir.io registry: <region>.ocir.io
username: ${{ secrets.OCI_USERNAME }} username: ${{ secrets.OCI_USERNAME }}
@@ -441,7 +441,7 @@ jobs:
steps: steps:
- -
name: Login to Quay.io name: Login to Quay.io
uses: docker/login-action@v1 uses: docker/login-action@v2
with: with:
registry: quay.io registry: quay.io
username: ${{ secrets.QUAY_USERNAME }} username: ${{ secrets.QUAY_USERNAME }}

View File

@@ -6,6 +6,7 @@ import * as exec from '@actions/exec';
process.env['RUNNER_TEMP'] = path.join(__dirname, 'runner'); process.env['RUNNER_TEMP'] = path.join(__dirname, 'runner');
test('loginStandard calls exec', async () => { test('loginStandard calls exec', async () => {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore // @ts-ignore
const execSpy = jest.spyOn(exec, 'getExecOutput').mockImplementation(async () => { const execSpy = jest.spyOn(exec, 'getExecOutput').mockImplementation(async () => {
return { return {
@@ -15,9 +16,9 @@ test('loginStandard calls exec', async () => {
}; };
}); });
const username: string = 'dbowie'; const username = 'dbowie';
const password: string = 'groundcontrol'; const password = 'groundcontrol';
const registry: string = 'https://ghcr.io'; const registry = 'https://ghcr.io';
await loginStandard(registry, username, password); await loginStandard(registry, username, password);
@@ -29,6 +30,7 @@ test('loginStandard calls exec', async () => {
}); });
test('logout calls exec', async () => { test('logout calls exec', async () => {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore // @ts-ignore
const execSpy = jest.spyOn(exec, 'getExecOutput').mockImplementation(async () => { const execSpy = jest.spyOn(exec, 'getExecOutput').mockImplementation(async () => {
return { return {
@@ -38,7 +40,7 @@ test('logout calls exec', async () => {
}; };
}); });
const registry: string = 'https://ghcr.io'; const registry = 'https://ghcr.io';
await logout(registry); await logout(registry);

View File

@@ -8,8 +8,7 @@ import * as stateHelper from '../src/state-helper';
import * as core from '@actions/core'; import * as core from '@actions/core';
test('errors without username and password', async () => { test('errors without username and password', async () => {
const platSpy = jest.spyOn(osm, 'platform').mockImplementation(() => 'linux'); jest.spyOn(osm, 'platform').mockImplementation(() => 'linux');
process.env['INPUT_LOGOUT'] = 'true'; // default value process.env['INPUT_LOGOUT'] = 'true'; // default value
const coreSpy = jest.spyOn(core, 'setFailed'); const coreSpy = jest.spyOn(core, 'setFailed');
@@ -18,21 +17,21 @@ test('errors without username and password', async () => {
}); });
test('successful with username and password', async () => { test('successful with username and password', async () => {
const platSpy = jest.spyOn(osm, 'platform').mockImplementation(() => 'linux'); jest.spyOn(osm, 'platform').mockImplementation(() => 'linux');
const setRegistrySpy = jest.spyOn(stateHelper, 'setRegistry'); const setRegistrySpy = jest.spyOn(stateHelper, 'setRegistry');
const setLogoutSpy = jest.spyOn(stateHelper, 'setLogout'); const setLogoutSpy = jest.spyOn(stateHelper, 'setLogout');
const dockerSpy = jest.spyOn(docker, 'login').mockImplementation(jest.fn()); const dockerSpy = jest.spyOn(docker, 'login').mockImplementation(jest.fn());
const username: string = 'dbowie'; const username = 'dbowie';
process.env[`INPUT_USERNAME`] = username; process.env[`INPUT_USERNAME`] = username;
const password: string = 'groundcontrol'; const password = 'groundcontrol';
process.env[`INPUT_PASSWORD`] = password; process.env[`INPUT_PASSWORD`] = password;
const ecr: string = 'auto'; const ecr = 'auto';
process.env['INPUT_ECR'] = ecr; process.env['INPUT_ECR'] = ecr;
const logout: boolean = false; const logout = false;
process.env['INPUT_LOGOUT'] = String(logout); process.env['INPUT_LOGOUT'] = String(logout);
await run(); await run();
@@ -43,25 +42,25 @@ test('successful with username and password', async () => {
}); });
test('calls docker login', async () => { test('calls docker login', async () => {
const platSpy = jest.spyOn(osm, 'platform').mockImplementation(() => 'linux'); jest.spyOn(osm, 'platform').mockImplementation(() => 'linux');
const setRegistrySpy = jest.spyOn(stateHelper, 'setRegistry'); const setRegistrySpy = jest.spyOn(stateHelper, 'setRegistry');
const setLogoutSpy = jest.spyOn(stateHelper, 'setLogout'); const setLogoutSpy = jest.spyOn(stateHelper, 'setLogout');
const dockerSpy = jest.spyOn(docker, 'login'); const dockerSpy = jest.spyOn(docker, 'login');
dockerSpy.mockImplementation(jest.fn()); dockerSpy.mockImplementation(jest.fn());
const username: string = 'dbowie'; const username = 'dbowie';
process.env[`INPUT_USERNAME`] = username; process.env[`INPUT_USERNAME`] = username;
const password: string = 'groundcontrol'; const password = 'groundcontrol';
process.env[`INPUT_PASSWORD`] = password; process.env[`INPUT_PASSWORD`] = password;
const registry: string = 'ghcr.io'; const registry = 'ghcr.io';
process.env[`INPUT_REGISTRY`] = registry; process.env[`INPUT_REGISTRY`] = registry;
const ecr: string = 'auto'; const ecr = 'auto';
process.env['INPUT_ECR'] = ecr; process.env['INPUT_ECR'] = ecr;
const logout: boolean = true; const logout = true;
process.env['INPUT_LOGOUT'] = String(logout); process.env['INPUT_LOGOUT'] = String(logout);
await run(); await run();

View File

@@ -26,6 +26,6 @@ inputs:
required: false required: false
runs: runs:
using: 'node12' using: 'node16'
main: 'dist/index.js' main: 'dist/index.js'
post: 'dist/index.js' post: 'dist/index.js'

View File

@@ -1,8 +1,8 @@
# syntax=docker/dockerfile:1.3-labs # syntax=docker/dockerfile:1
ARG NODE_VERSION=12 ARG NODE_VERSION=16
ARG DOCKER_VERSION=20.10.10 ARG DOCKER_VERSION=20.10.13
ARG BUILDX_VERSION=0.7.0 ARG BUILDX_VERSION=0.8.1
FROM node:${NODE_VERSION}-alpine AS base FROM node:${NODE_VERSION}-alpine AS base
RUN apk add --no-cache cpio findutils git RUN apk add --no-cache cpio findutils git
@@ -57,10 +57,10 @@ RUN --mount=type=bind,target=.,rw \
FROM scratch AS format-update FROM scratch AS format-update
COPY --from=format /out / COPY --from=format /out /
FROM deps AS format-validate FROM deps AS lint
RUN --mount=type=bind,target=.,rw \ RUN --mount=type=bind,target=.,rw \
--mount=type=cache,target=/src/node_modules \ --mount=type=cache,target=/src/node_modules \
yarn run format-check yarn run lint
FROM docker:${DOCKER_VERSION} as docker FROM docker:${DOCKER_VERSION} as docker
FROM docker/buildx-bin:${BUILDX_VERSION} as buildx FROM docker/buildx-bin:${BUILDX_VERSION} as buildx

32397
dist/index.js generated vendored

File diff suppressed because one or more lines are too long

1
dist/index.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

9673
dist/licenses.txt generated vendored Normal file

File diff suppressed because it is too large Load Diff

1
dist/sourcemap-register.js generated vendored Normal file

File diff suppressed because one or more lines are too long

View File

@@ -7,7 +7,7 @@ group "pre-checkin" {
} }
group "validate" { group "validate" {
targets = ["format-validate", "build-validate", "vendor-validate"] targets = ["lint", "build-validate", "vendor-validate"]
} }
target "build" { target "build" {
@@ -28,9 +28,9 @@ target "format" {
output = ["."] output = ["."]
} }
target "format-validate" { target "lint" {
dockerfile = "dev.Dockerfile" dockerfile = "dev.Dockerfile"
target = "format-validate" target = "lint"
output = ["type=cacheonly"] output = ["type=cacheonly"]
} }

View File

@@ -6,5 +6,5 @@ module.exports = {
transform: { transform: {
'^.+\\.ts$': 'ts-jest' '^.+\\.ts$': 'ts-jest'
}, },
verbose: false verbose: true
} }

View File

@@ -3,11 +3,11 @@
"description": "GitHub Action to login against a Docker registry", "description": "GitHub Action to login against a Docker registry",
"main": "lib/main.js", "main": "lib/main.js",
"scripts": { "scripts": {
"build": "tsc && ncc build", "build": "ncc build src/main.ts --source-map --minify --license licenses.txt",
"format": "prettier --write '**/*.ts'", "lint": "eslint src/**/*.ts __tests__/**/*.ts",
"format-check": "prettier --check '**/*.ts'", "format": "eslint --fix src/**/*.ts __tests__/**/*.ts",
"test": "jest --coverage", "test": "jest --coverage",
"pre-checkin": "yarn run format && yarn run build" "all": "yarn run build && yarn run format && yarn test"
}, },
"repository": { "repository": {
"type": "git", "type": "git",
@@ -27,21 +27,28 @@
], ],
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@actions/core": "^1.6.0", "@actions/core": "^1.10.0",
"@actions/exec": "^1.1.0", "@actions/exec": "^1.1.1",
"@actions/io": "^1.1.1", "@actions/io": "^1.1.2",
"@aws-sdk/client-ecr": "^3.53.0", "@aws-sdk/client-ecr": "^3.186.0",
"@aws-sdk/client-ecr-public": "^3.53.0", "@aws-sdk/client-ecr-public": "^3.186.0",
"http-proxy-agent": "^5.0.0", "http-proxy-agent": "^5.0.0",
"https-proxy-agent": "^5.0.0" "https-proxy-agent": "^5.0.1"
}, },
"devDependencies": { "devDependencies": {
"@types/node": "^16.11.26", "@types/node": "^16.11.26",
"@typescript-eslint/eslint-plugin": "^5.14.0",
"@typescript-eslint/parser": "^5.14.0",
"@vercel/ncc": "^0.33.3", "@vercel/ncc": "^0.33.3",
"dotenv": "^16.0.0", "dotenv": "^16.0.0",
"eslint": "^8.11.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-jest": "^26.1.1",
"eslint-plugin-prettier": "^4.0.0",
"jest": "^27.2.5", "jest": "^27.2.5",
"prettier": "^2.5.1", "prettier": "^2.3.1",
"ts-jest": "^27.1.2", "ts-jest": "^27.1.2",
"ts-node": "^10.7.0",
"typescript": "^4.4.4" "typescript": "^4.4.4"
} }
} }

View File

@@ -34,7 +34,7 @@ export const getAccountIDs = (registry: string): string[] => {
if (!matches) { if (!matches) {
return []; return [];
} }
let accountIDs: Array<string> = [matches[2]]; const accountIDs: Array<string> = [matches[2]];
if (process.env.AWS_ACCOUNT_IDS) { if (process.env.AWS_ACCOUNT_IDS) {
accountIDs.push(...process.env.AWS_ACCOUNT_IDS.split(',')); accountIDs.push(...process.env.AWS_ACCOUNT_IDS.split(','));
} }
@@ -57,14 +57,14 @@ export const getRegistriesData = async (registry: string, username?: string, pas
authTokenRequest['registryIds'] = accountIDs; authTokenRequest['registryIds'] = accountIDs;
} }
let httpProxyAgent: any = null; let httpProxyAgent;
const httpProxy = process.env.http_proxy || process.env.HTTP_PROXY || ''; const httpProxy = process.env.http_proxy || process.env.HTTP_PROXY || '';
if (httpProxy) { if (httpProxy) {
core.debug(`Using http proxy ${httpProxy}`); core.debug(`Using http proxy ${httpProxy}`);
httpProxyAgent = new HttpProxyAgent(httpProxy); httpProxyAgent = new HttpProxyAgent(httpProxy);
} }
let httpsProxyAgent: any = null; let httpsProxyAgent;
const httpsProxy = process.env.https_proxy || process.env.HTTPS_PROXY || ''; const httpsProxy = process.env.https_proxy || process.env.HTTPS_PROXY || '';
if (httpsProxy) { if (httpsProxy) {
core.debug(`Using https proxy ${httpsProxy}`); core.debug(`Using https proxy ${httpsProxy}`);
@@ -96,6 +96,8 @@ export const getRegistriesData = async (registry: string, username?: string, pas
} }
const authToken = Buffer.from(authTokenResponse.authorizationData.authorizationToken, 'base64').toString('utf-8'); const authToken = Buffer.from(authTokenResponse.authorizationData.authorizationToken, 'base64').toString('utf-8');
const creds = authToken.split(':', 2); const creds = authToken.split(':', 2);
core.setSecret(creds[0]); // redacted in workflow logs
core.setSecret(creds[1]); // redacted in workflow logs
return [ return [
{ {
registry: 'public.ecr.aws', registry: 'public.ecr.aws',
@@ -122,6 +124,8 @@ export const getRegistriesData = async (registry: string, username?: string, pas
for (const authData of authTokenResponse.authorizationData) { for (const authData of authTokenResponse.authorizationData) {
const authToken = Buffer.from(authData.authorizationToken || '', 'base64').toString('utf-8'); const authToken = Buffer.from(authData.authorizationToken || '', 'base64').toString('utf-8');
const creds = authToken.split(':', 2); const creds = authToken.split(':', 2);
core.setSecret(creds[0]); // redacted in workflow logs
core.setSecret(creds[1]); // redacted in workflow logs
regDatas.push({ regDatas.push({
registry: authData.proxyEndpoint || '', registry: authData.proxyEndpoint || '',
username: creds[0], username: creds[0],

View File

@@ -27,7 +27,7 @@ export async function loginStandard(registry: string, username: string, password
throw new Error('Username and password required'); throw new Error('Username and password required');
} }
let loginArgs: Array<string> = ['login', '--password-stdin']; const loginArgs: Array<string> = ['login', '--password-stdin'];
loginArgs.push('--username', username); loginArgs.push('--username', username);
loginArgs.push(registry); loginArgs.push(registry);

View File

@@ -9,7 +9,7 @@ export async function run(): Promise<void> {
stateHelper.setRegistry(input.registry); stateHelper.setRegistry(input.registry);
stateHelper.setLogout(input.logout); stateHelper.setLogout(input.logout);
await docker.login(input.registry, input.username, input.password, input.ecr); await docker.login(input.registry, input.username, input.password, input.ecr);
} catch (error: any) { } catch (error) {
core.setFailed(error.message); core.setFailed(error.message);
} }
} }

View File

@@ -1,14 +1,19 @@
{ {
"compilerOptions": { "compilerOptions": {
"target": "esnext", "target": "es6",
"module": "commonjs", "module": "commonjs",
"newLine": "lf", "newLine": "lf",
"outDir": "./lib", "outDir": "./lib",
"rootDir": "./src", "rootDir": "./src",
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"strict": true, "strict": true,
"noImplicitAny": false, "noImplicitAny": false,
"esModuleInterop": true, "useUnknownInCatchVariables": false,
"sourceMap": true
}, },
"exclude": ["node_modules", "**/*.test.ts"] "exclude": [
"node_modules",
"**/*.test.ts",
"jest.config.ts"
]
} }

1736
yarn.lock

File diff suppressed because it is too large Load Diff