Merge pull request #961 from crazy-max/esm
switch to ESM and update config/test wiring
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright 2023 actions-toolkit authors
|
* Copyright 2025 actions-toolkit authors
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -14,6 +14,17 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {Context as GitHubContext} from '@actions/github/lib/context';
|
import {jest} from '@jest/globals';
|
||||||
|
import os from 'os';
|
||||||
|
|
||||||
export type Context = GitHubContext;
|
export const mockPlatform = (platform: NodeJS.Platform) => {
|
||||||
|
return jest.spyOn(os, 'platform').mockImplementation(() => platform);
|
||||||
|
};
|
||||||
|
|
||||||
|
export const mockArch = (arch: string) => {
|
||||||
|
return jest.spyOn(os, 'arch').mockImplementation(() => arch);
|
||||||
|
};
|
||||||
|
|
||||||
|
export const mockHomedir = (dir: string) => {
|
||||||
|
return jest.spyOn(os, 'homedir').mockImplementation(() => dir);
|
||||||
|
};
|
||||||
@@ -14,12 +14,13 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {describe, expect, it, jest, test, afterEach} from '@jest/globals';
|
import {describe, expect, it, test, afterEach} from '@jest/globals';
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
import os from 'os';
|
import os from 'os';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import * as rimraf from 'rimraf';
|
import * as rimraf from 'rimraf';
|
||||||
import osm = require('os');
|
|
||||||
|
import {mockArch, mockPlatform} from '../.helpers/os';
|
||||||
|
|
||||||
import {Install} from '../../src/buildx/install';
|
import {Install} from '../../src/buildx/install';
|
||||||
|
|
||||||
@@ -85,8 +86,8 @@ describe('download', () => {
|
|||||||
['linux', 's390x'],
|
['linux', 's390x'],
|
||||||
])(
|
])(
|
||||||
'acquires buildx for %s/%s', async (os, arch) => {
|
'acquires buildx for %s/%s', async (os, arch) => {
|
||||||
jest.spyOn(osm, 'platform').mockImplementation(() => os as NodeJS.Platform);
|
mockPlatform(os as NodeJS.Platform);
|
||||||
jest.spyOn(osm, 'arch').mockImplementation(() => arch);
|
mockArch(arch);
|
||||||
const install = new Install();
|
const install = new Install();
|
||||||
const buildxBin = await install.download('latest');
|
const buildxBin = await install.download('latest');
|
||||||
expect(fs.existsSync(buildxBin)).toBe(true);
|
expect(fs.existsSync(buildxBin)).toBe(true);
|
||||||
|
|||||||
@@ -14,12 +14,13 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {describe, expect, it, jest, test, afterEach} from '@jest/globals';
|
import {describe, expect, it, test, afterEach} from '@jest/globals';
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
import os from 'os';
|
import os from 'os';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import * as rimraf from 'rimraf';
|
import * as rimraf from 'rimraf';
|
||||||
import osm = require('os');
|
|
||||||
|
import {mockArch, mockPlatform} from '../.helpers/os';
|
||||||
|
|
||||||
import {Install} from '../../src/compose/install';
|
import {Install} from '../../src/compose/install';
|
||||||
|
|
||||||
@@ -85,8 +86,8 @@ describe('download', () => {
|
|||||||
['linux', 's390x'],
|
['linux', 's390x'],
|
||||||
])(
|
])(
|
||||||
'acquires compose for %s/%s', async (os, arch) => {
|
'acquires compose for %s/%s', async (os, arch) => {
|
||||||
jest.spyOn(osm, 'platform').mockImplementation(() => os as NodeJS.Platform);
|
mockPlatform(os as NodeJS.Platform);
|
||||||
jest.spyOn(osm, 'arch').mockImplementation(() => arch);
|
mockArch(arch);
|
||||||
const install = new Install();
|
const install = new Install();
|
||||||
const composeBin = await install.download('latest');
|
const composeBin = await install.download('latest');
|
||||||
expect(fs.existsSync(composeBin)).toBe(true);
|
expect(fs.existsSync(composeBin)).toBe(true);
|
||||||
|
|||||||
@@ -14,12 +14,13 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {describe, expect, it, jest, test, afterEach} from '@jest/globals';
|
import {describe, expect, it, test, afterEach} from '@jest/globals';
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
import os from 'os';
|
import os from 'os';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import * as rimraf from 'rimraf';
|
import * as rimraf from 'rimraf';
|
||||||
import osm = require('os');
|
|
||||||
|
import {mockArch, mockPlatform} from '../.helpers/os';
|
||||||
|
|
||||||
import {Install} from '../../src/cosign/install';
|
import {Install} from '../../src/cosign/install';
|
||||||
|
|
||||||
@@ -80,8 +81,8 @@ describe('download', () => {
|
|||||||
['linux', 'arm64']
|
['linux', 'arm64']
|
||||||
])(
|
])(
|
||||||
'acquires undock for %s/%s', async (os, arch) => {
|
'acquires undock for %s/%s', async (os, arch) => {
|
||||||
jest.spyOn(osm, 'platform').mockImplementation(() => os as NodeJS.Platform);
|
mockPlatform(os as NodeJS.Platform);
|
||||||
jest.spyOn(osm, 'arch').mockImplementation(() => arch);
|
mockArch(arch);
|
||||||
const install = new Install();
|
const install = new Install();
|
||||||
const cosignBin = await install.download({
|
const cosignBin = await install.download({
|
||||||
version: 'latest'
|
version: 'latest'
|
||||||
|
|||||||
@@ -19,9 +19,10 @@ import fs from 'fs';
|
|||||||
import os from 'os';
|
import os from 'os';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import * as io from '@actions/io';
|
import * as io from '@actions/io';
|
||||||
import osm = require('os');
|
|
||||||
import * as rimraf from 'rimraf';
|
import * as rimraf from 'rimraf';
|
||||||
|
|
||||||
|
import {mockHomedir} from '../.helpers/os';
|
||||||
|
|
||||||
import {Docker} from '../../src/docker/docker';
|
import {Docker} from '../../src/docker/docker';
|
||||||
|
|
||||||
import {ConfigFile} from '../../src/types/docker/docker';
|
import {ConfigFile} from '../../src/types/docker/docker';
|
||||||
@@ -47,7 +48,7 @@ describe('configDir', () => {
|
|||||||
});
|
});
|
||||||
it('returns default', async () => {
|
it('returns default', async () => {
|
||||||
process.env.DOCKER_CONFIG = '';
|
process.env.DOCKER_CONFIG = '';
|
||||||
jest.spyOn(osm, 'homedir').mockImplementation(() => path.join('/tmp', 'home'));
|
mockHomedir(path.join('/tmp', 'home'));
|
||||||
expect(Docker.configDir).toEqual(path.join('/tmp', 'home', '.docker'));
|
expect(Docker.configDir).toEqual(path.join('/tmp', 'home', '.docker'));
|
||||||
});
|
});
|
||||||
it('returns from env', async () => {
|
it('returns from env', async () => {
|
||||||
|
|||||||
@@ -19,7 +19,8 @@ import fs from 'fs';
|
|||||||
import os from 'os';
|
import os from 'os';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import * as rimraf from 'rimraf';
|
import * as rimraf from 'rimraf';
|
||||||
import osm = require('os');
|
|
||||||
|
import {mockArch, mockPlatform} from '../.helpers/os';
|
||||||
|
|
||||||
import {Install, InstallSourceArchive, InstallSourceImage} from '../../src/docker/install';
|
import {Install, InstallSourceArchive, InstallSourceImage} from '../../src/docker/install';
|
||||||
|
|
||||||
@@ -60,8 +61,8 @@ describe('download', () => {
|
|||||||
[image('27.3.1'), 'win32'],
|
[image('27.3.1'), 'win32'],
|
||||||
])(
|
])(
|
||||||
'acquires %p of docker (%s)', async (source, platformOS) => {
|
'acquires %p of docker (%s)', async (source, platformOS) => {
|
||||||
jest.spyOn(osm, 'platform').mockImplementation(() => platformOS as NodeJS.Platform);
|
mockPlatform(platformOS as NodeJS.Platform);
|
||||||
jest.spyOn(osm, 'arch').mockImplementation(() => 'x64');
|
mockArch('x64');
|
||||||
const install = new Install({
|
const install = new Install({
|
||||||
source: source,
|
source: source,
|
||||||
runDir: tmpDir
|
runDir: tmpDir
|
||||||
|
|||||||
@@ -14,12 +14,13 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {afterEach, describe, expect, jest, test} from '@jest/globals';
|
import {afterEach, describe, expect, test} from '@jest/globals';
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
import os from 'os';
|
import os from 'os';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import * as rimraf from 'rimraf';
|
import * as rimraf from 'rimraf';
|
||||||
import osm = require('os');
|
|
||||||
|
import {mockArch, mockPlatform} from '../.helpers/os';
|
||||||
|
|
||||||
import {OCI} from '../../src/oci/oci';
|
import {OCI} from '../../src/oci/oci';
|
||||||
|
|
||||||
@@ -44,8 +45,8 @@ describe('defaultPlatform', () => {
|
|||||||
['linux', 'ppc64', {architecture: 'ppc64le', os: 'linux'}],
|
['linux', 'ppc64', {architecture: 'ppc64le', os: 'linux'}],
|
||||||
['linux', 's390x', {architecture: 's390x', os: 'linux'}]
|
['linux', 's390x', {architecture: 's390x', os: 'linux'}]
|
||||||
])('default platform for %s/%s', async (os: string, arch: string, expected: Platform) => {
|
])('default platform for %s/%s', async (os: string, arch: string, expected: Platform) => {
|
||||||
jest.spyOn(osm, 'platform').mockImplementation(() => os as NodeJS.Platform);
|
mockPlatform(os as NodeJS.Platform);
|
||||||
jest.spyOn(osm, 'arch').mockImplementation(() => arch);
|
mockArch(arch);
|
||||||
const res = OCI.defaultPlatform();
|
const res = OCI.defaultPlatform();
|
||||||
expect(res).toEqual(expected);
|
expect(res).toEqual(expected);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -14,12 +14,13 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {describe, expect, it, jest, test, afterEach} from '@jest/globals';
|
import {describe, expect, it, test, afterEach} from '@jest/globals';
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
import os from 'os';
|
import os from 'os';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import * as rimraf from 'rimraf';
|
import * as rimraf from 'rimraf';
|
||||||
import osm = require('os');
|
|
||||||
|
import {mockArch, mockPlatform} from '../.helpers/os';
|
||||||
|
|
||||||
import {Install} from '../../src/regclient/install';
|
import {Install} from '../../src/regclient/install';
|
||||||
|
|
||||||
@@ -75,8 +76,8 @@ describe('download', () => {
|
|||||||
['linux', 's390x'],
|
['linux', 's390x'],
|
||||||
])(
|
])(
|
||||||
'acquires regclient for %s/%s', async (os, arch) => {
|
'acquires regclient for %s/%s', async (os, arch) => {
|
||||||
jest.spyOn(osm, 'platform').mockImplementation(() => os as NodeJS.Platform);
|
mockPlatform(os as NodeJS.Platform);
|
||||||
jest.spyOn(osm, 'arch').mockImplementation(() => arch);
|
mockArch(arch);
|
||||||
const install = new Install();
|
const install = new Install();
|
||||||
const regclientBin = await install.download('latest');
|
const regclientBin = await install.download('latest');
|
||||||
expect(fs.existsSync(regclientBin)).toBe(true);
|
expect(fs.existsSync(regclientBin)).toBe(true);
|
||||||
|
|||||||
@@ -14,12 +14,13 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {describe, expect, it, jest, test, afterEach} from '@jest/globals';
|
import {describe, expect, it, test, afterEach} from '@jest/globals';
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
import os from 'os';
|
import os from 'os';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import * as rimraf from 'rimraf';
|
import * as rimraf from 'rimraf';
|
||||||
import osm = require('os');
|
|
||||||
|
import {mockArch, mockPlatform} from '../.helpers/os';
|
||||||
|
|
||||||
import {Install} from '../../src/undock/install';
|
import {Install} from '../../src/undock/install';
|
||||||
|
|
||||||
@@ -80,8 +81,8 @@ describe('download', () => {
|
|||||||
['linux', 's390x'],
|
['linux', 's390x'],
|
||||||
])(
|
])(
|
||||||
'acquires undock for %s/%s', async (os, arch) => {
|
'acquires undock for %s/%s', async (os, arch) => {
|
||||||
jest.spyOn(osm, 'platform').mockImplementation(() => os as NodeJS.Platform);
|
mockPlatform(os as NodeJS.Platform);
|
||||||
jest.spyOn(osm, 'arch').mockImplementation(() => arch);
|
mockArch(arch);
|
||||||
const install = new Install();
|
const install = new Install();
|
||||||
const undockBin = await install.download('latest');
|
const undockBin = await install.download('latest');
|
||||||
expect(fs.existsSync(undockBin)).toBe(true);
|
expect(fs.existsSync(undockBin)).toBe(true);
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ module.exports = defineConfig([
|
|||||||
},
|
},
|
||||||
parser: tsParser,
|
parser: tsParser,
|
||||||
ecmaVersion: 2023,
|
ecmaVersion: 2023,
|
||||||
sourceType: 'commonjs'
|
sourceType: 'module'
|
||||||
},
|
},
|
||||||
|
|
||||||
rules: {
|
rules: {
|
||||||
@@ -75,7 +75,7 @@ module.exports = defineConfig([
|
|||||||
'import/no-unresolved': [
|
'import/no-unresolved': [
|
||||||
'error',
|
'error',
|
||||||
{
|
{
|
||||||
ignore: ['csv-parse/sync', '@octokit/openapi-types']
|
ignore: ['\\.js$', 'csv-parse/sync', '@octokit/openapi-types', '@octokit/core', '@octokit/plugin-rest-endpoint-methods']
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
'jest/no-disabled-tests': 0
|
'jest/no-disabled-tests': 0
|
||||||
@@ -38,13 +38,20 @@ module.exports = {
|
|||||||
setupFiles: ['dotenv/config'],
|
setupFiles: ['dotenv/config'],
|
||||||
testMatch: ['**/*.test.ts'],
|
testMatch: ['**/*.test.ts'],
|
||||||
transform: {
|
transform: {
|
||||||
'^.+\\.ts$': 'ts-jest'
|
'^.+\\.ts$': [
|
||||||
|
'ts-jest',
|
||||||
|
{
|
||||||
|
useESM: true,
|
||||||
|
tsconfig: '<rootDir>/tsconfig.test.json'
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
moduleNameMapper: {
|
moduleNameMapper: {
|
||||||
'^csv-parse/sync': '<rootDir>/node_modules/csv-parse/dist/cjs/sync.cjs'
|
'^(\\.{1,2}/.*)\\.js$': '$1'
|
||||||
},
|
},
|
||||||
|
extensionsToTreatAsEsm: ['.ts'],
|
||||||
collectCoverageFrom: ['src/**/{!(index.ts),}.ts'],
|
collectCoverageFrom: ['src/**/{!(index.ts),}.ts'],
|
||||||
coveragePathIgnorePatterns: ['lib/', 'node_modules/', '__mocks__/', '__tests__/'],
|
coveragePathIgnorePatterns: ['lib/', 'node_modules/', '__mocks__/', '__tests__/'],
|
||||||
testResultsProcessor: '<rootDir>/__tests__/testResultsProcessor.js',
|
testResultsProcessor: '<rootDir>/__tests__/testResultsProcessor.cjs',
|
||||||
verbose: true
|
verbose: true
|
||||||
};
|
};
|
||||||
@@ -21,11 +21,18 @@ module.exports = {
|
|||||||
testMatch: ['**/*.test.itg.ts'],
|
testMatch: ['**/*.test.itg.ts'],
|
||||||
testTimeout: 1800000, // 30 minutes
|
testTimeout: 1800000, // 30 minutes
|
||||||
transform: {
|
transform: {
|
||||||
'^.+\\.ts$': 'ts-jest'
|
'^.+\\.ts$': [
|
||||||
|
'ts-jest',
|
||||||
|
{
|
||||||
|
useESM: true,
|
||||||
|
tsconfig: '<rootDir>/tsconfig.test.json'
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
moduleNameMapper: {
|
moduleNameMapper: {
|
||||||
'^csv-parse/sync': '<rootDir>/node_modules/csv-parse/dist/cjs/sync.cjs'
|
'^(\\.{1,2}/.*)\\.js$': '$1'
|
||||||
},
|
},
|
||||||
testResultsProcessor: '<rootDir>/__tests__/testResultsProcessor.js',
|
extensionsToTreatAsEsm: ['.ts'],
|
||||||
|
testResultsProcessor: '<rootDir>/__tests__/testResultsProcessor.cjs',
|
||||||
verbose: false
|
verbose: false
|
||||||
};
|
};
|
||||||
@@ -2,6 +2,7 @@
|
|||||||
"name": "@docker/actions-toolkit",
|
"name": "@docker/actions-toolkit",
|
||||||
"version": "0.0.0+unknown",
|
"version": "0.0.0+unknown",
|
||||||
"description": "Toolkit for Docker (GitHub) Actions",
|
"description": "Toolkit for Docker (GitHub) Actions",
|
||||||
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "tsc",
|
"build": "tsc",
|
||||||
"lint": "yarn run prettier && yarn run eslint",
|
"lint": "yarn run prettier && yarn run eslint",
|
||||||
@@ -12,9 +13,9 @@
|
|||||||
"prettier:fix": "prettier --write \"./**/*.ts\"",
|
"prettier:fix": "prettier --write \"./**/*.ts\"",
|
||||||
"test": "jest",
|
"test": "jest",
|
||||||
"test:coverage": "jest --coverage",
|
"test:coverage": "jest --coverage",
|
||||||
"test:itg": "jest -c jest.config.itg.js --runInBand",
|
"test:itg": "jest -c jest.config.itg.cjs --runInBand",
|
||||||
"test:itg-list": "jest -c jest.config.itg.js --listTests",
|
"test:itg-list": "jest -c jest.config.itg.cjs --listTests",
|
||||||
"test:itg-coverage": "jest -c jest.config.itg.js --coverage --runInBand"
|
"test:itg-coverage": "jest -c jest.config.itg.cjs --coverage --runInBand"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
|||||||
@@ -17,12 +17,12 @@
|
|||||||
import * as core from '@actions/core';
|
import * as core from '@actions/core';
|
||||||
import * as semver from 'semver';
|
import * as semver from 'semver';
|
||||||
|
|
||||||
import {Buildx} from '../buildx/buildx';
|
import {Buildx} from '../buildx/buildx.js';
|
||||||
import {Builder} from '../buildx/builder';
|
import {Builder} from '../buildx/builder.js';
|
||||||
import {Docker} from '../docker/docker';
|
import {Docker} from '../docker/docker.js';
|
||||||
import {Config} from './config';
|
import {Config} from './config.js';
|
||||||
|
|
||||||
import {BuilderInfo, NodeInfo} from '../types/buildx/builder';
|
import {BuilderInfo, NodeInfo} from '../types/buildx/builder.js';
|
||||||
|
|
||||||
export interface BuildKitOpts {
|
export interface BuildKitOpts {
|
||||||
buildx?: Buildx;
|
buildx?: Buildx;
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
|
|
||||||
import {Context} from '../context';
|
import {Context} from '../context.js';
|
||||||
|
|
||||||
export class Config {
|
export class Config {
|
||||||
public resolveFromString(s: string): string {
|
public resolveFromString(s: string): string {
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {GitRef, GitURL, GitURLFragment, URLUserInfo} from '../types/buildkit/git';
|
import {GitRef, GitURL, GitURLFragment, URLUserInfo} from '../types/buildkit/git.js';
|
||||||
|
|
||||||
export class Git {
|
export class Git {
|
||||||
private static protoRegexp = new RegExp('^[a-zA-Z0-9]+://');
|
private static protoRegexp = new RegExp('^[a-zA-Z0-9]+://');
|
||||||
|
|||||||
@@ -18,15 +18,15 @@ import fs from 'fs';
|
|||||||
import path from 'path';
|
import path from 'path';
|
||||||
import {parse} from 'csv-parse/sync';
|
import {parse} from 'csv-parse/sync';
|
||||||
|
|
||||||
import {Buildx} from './buildx';
|
import {Buildx} from './buildx.js';
|
||||||
import {Context} from '../context';
|
import {Context} from '../context.js';
|
||||||
import {Exec} from '../exec';
|
import {Exec} from '../exec.js';
|
||||||
import {Util} from '../util';
|
import {Util} from '../util.js';
|
||||||
|
|
||||||
import {ExecOptions} from '@actions/exec';
|
import {ExecOptions} from '@actions/exec';
|
||||||
import {AttestEntry, BakeDefinition, CacheEntry, ExportEntry, SecretEntry, SSHEntry} from '../types/buildx/bake';
|
import {AttestEntry, BakeDefinition, CacheEntry, ExportEntry, SecretEntry, SSHEntry} from '../types/buildx/bake.js';
|
||||||
import {BuildMetadata} from '../types/buildx/build';
|
import {BuildMetadata} from '../types/buildx/build.js';
|
||||||
import {VertexWarning} from '../types/buildkit/client';
|
import {VertexWarning} from '../types/buildkit/client.js';
|
||||||
|
|
||||||
export interface BakeOpts {
|
export interface BakeOpts {
|
||||||
buildx?: Buildx;
|
buildx?: Buildx;
|
||||||
|
|||||||
@@ -19,14 +19,14 @@ import path from 'path';
|
|||||||
import * as core from '@actions/core';
|
import * as core from '@actions/core';
|
||||||
import {parse} from 'csv-parse/sync';
|
import {parse} from 'csv-parse/sync';
|
||||||
|
|
||||||
import {Buildx} from './buildx';
|
import {Buildx} from './buildx.js';
|
||||||
import {Context} from '../context';
|
import {Context} from '../context.js';
|
||||||
import {GitHub} from '../github';
|
import {GitHub} from '../github.js';
|
||||||
import {Util} from '../util';
|
import {Util} from '../util.js';
|
||||||
|
|
||||||
import {BuildMetadata} from '../types/buildx/build';
|
import {BuildMetadata} from '../types/buildx/build.js';
|
||||||
import {VertexWarning} from '../types/buildkit/client';
|
import {VertexWarning} from '../types/buildkit/client.js';
|
||||||
import {ProvenancePredicate} from '../types/intoto/slsa_provenance/v0.2/provenance';
|
import {ProvenancePredicate} from '../types/intoto/slsa_provenance/v0.2/provenance.js';
|
||||||
|
|
||||||
export interface BuildOpts {
|
export interface BuildOpts {
|
||||||
buildx?: Buildx;
|
buildx?: Buildx;
|
||||||
|
|||||||
@@ -16,10 +16,10 @@
|
|||||||
|
|
||||||
import * as core from '@actions/core';
|
import * as core from '@actions/core';
|
||||||
|
|
||||||
import {Buildx} from './buildx';
|
import {Buildx} from './buildx.js';
|
||||||
import {Exec} from '../exec';
|
import {Exec} from '../exec.js';
|
||||||
|
|
||||||
import {BuilderInfo, Device, GCPolicy, NodeInfo} from '../types/buildx/builder';
|
import {BuilderInfo, Device, GCPolicy, NodeInfo} from '../types/buildx/builder.js';
|
||||||
|
|
||||||
export interface BuilderOpts {
|
export interface BuilderOpts {
|
||||||
buildx?: Buildx;
|
buildx?: Buildx;
|
||||||
|
|||||||
@@ -19,16 +19,16 @@ import path from 'path';
|
|||||||
import * as core from '@actions/core';
|
import * as core from '@actions/core';
|
||||||
import * as semver from 'semver';
|
import * as semver from 'semver';
|
||||||
|
|
||||||
import {Git} from '../buildkit/git';
|
import {Git} from '../buildkit/git.js';
|
||||||
import {Docker} from '../docker/docker';
|
import {Docker} from '../docker/docker.js';
|
||||||
import {GitHub} from '../github';
|
import {GitHub} from '../github.js';
|
||||||
import {Exec} from '../exec';
|
import {Exec} from '../exec.js';
|
||||||
import {Util} from '../util';
|
import {Util} from '../util.js';
|
||||||
|
|
||||||
import {VertexWarning} from '../types/buildkit/client';
|
import {VertexWarning} from '../types/buildkit/client.js';
|
||||||
import {GitURL} from '../types/buildkit/git';
|
import {GitURL} from '../types/buildkit/git.js';
|
||||||
import {Cert, LocalRefsOpts, LocalRefsResponse, LocalState} from '../types/buildx/buildx';
|
import {Cert, LocalRefsOpts, LocalRefsResponse, LocalState} from '../types/buildx/buildx.js';
|
||||||
import {GitHubAnnotation} from '../types/github';
|
import {GitHubAnnotation} from '../types/github.js';
|
||||||
|
|
||||||
export interface BuildxOpts {
|
export interface BuildxOpts {
|
||||||
standalone?: boolean;
|
standalone?: boolean;
|
||||||
|
|||||||
@@ -21,14 +21,14 @@ import path from 'path';
|
|||||||
import {Readable, Writable} from 'stream';
|
import {Readable, Writable} from 'stream';
|
||||||
import * as core from '@actions/core';
|
import * as core from '@actions/core';
|
||||||
|
|
||||||
import {Buildx} from './buildx';
|
import {Buildx} from './buildx.js';
|
||||||
import {Context} from '../context';
|
import {Context} from '../context.js';
|
||||||
import {Docker} from '../docker/docker';
|
import {Docker} from '../docker/docker.js';
|
||||||
import {Exec} from '../exec';
|
import {Exec} from '../exec.js';
|
||||||
import {GitHub} from '../github';
|
import {GitHub} from '../github.js';
|
||||||
import {Util} from '../util';
|
import {Util} from '../util.js';
|
||||||
|
|
||||||
import {ExportOpts, ExportResponse, InspectOpts, InspectResponse, Summaries} from '../types/buildx/history';
|
import {ExportOpts, ExportResponse, InspectOpts, InspectResponse, Summaries} from '../types/buildx/history.js';
|
||||||
|
|
||||||
export interface HistoryOpts {
|
export interface HistoryOpts {
|
||||||
buildx?: Buildx;
|
buildx?: Buildx;
|
||||||
|
|||||||
@@ -14,13 +14,13 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {Buildx} from './buildx';
|
import {Buildx} from './buildx.js';
|
||||||
import {Exec} from '../exec';
|
import {Exec} from '../exec.js';
|
||||||
|
|
||||||
import {Manifest as ImageToolsManifest} from '../types/buildx/imagetools';
|
import {Manifest as ImageToolsManifest} from '../types/buildx/imagetools.js';
|
||||||
import {Image} from '../types/oci/config';
|
import {Image} from '../types/oci/config.js';
|
||||||
import {Descriptor, Platform} from '../types/oci/descriptor';
|
import {Descriptor, Platform} from '../types/oci/descriptor.js';
|
||||||
import {Digest} from '../types/oci/digest';
|
import {Digest} from '../types/oci/digest.js';
|
||||||
|
|
||||||
export interface ImageToolsOpts {
|
export interface ImageToolsOpts {
|
||||||
buildx?: Buildx;
|
buildx?: Buildx;
|
||||||
|
|||||||
@@ -22,17 +22,17 @@ import * as tc from '@actions/tool-cache';
|
|||||||
import * as semver from 'semver';
|
import * as semver from 'semver';
|
||||||
import * as util from 'util';
|
import * as util from 'util';
|
||||||
|
|
||||||
import {Buildx} from './buildx';
|
import {Buildx} from './buildx.js';
|
||||||
import {Cache} from '../cache';
|
import {Cache} from '../cache.js';
|
||||||
import {Context} from '../context';
|
import {Context} from '../context.js';
|
||||||
import {Exec} from '../exec';
|
import {Exec} from '../exec.js';
|
||||||
import {Docker} from '../docker/docker';
|
import {Docker} from '../docker/docker.js';
|
||||||
import {Git} from '../git';
|
import {Git} from '../git.js';
|
||||||
import {GitHub} from '../github';
|
import {GitHub} from '../github.js';
|
||||||
import {Util} from '../util';
|
import {Util} from '../util.js';
|
||||||
|
|
||||||
import {DownloadVersion} from '../types/buildx/buildx';
|
import {DownloadVersion} from '../types/buildx/buildx.js';
|
||||||
import {GitHubRelease} from '../types/github';
|
import {GitHubRelease} from '../types/github.js';
|
||||||
|
|
||||||
export interface InstallOpts {
|
export interface InstallOpts {
|
||||||
standalone?: boolean;
|
standalone?: boolean;
|
||||||
|
|||||||
@@ -16,8 +16,8 @@
|
|||||||
|
|
||||||
import * as core from '@actions/core';
|
import * as core from '@actions/core';
|
||||||
|
|
||||||
import {Docker} from '../docker/docker';
|
import {Docker} from '../docker/docker.js';
|
||||||
import {Exec} from '../exec';
|
import {Exec} from '../exec.js';
|
||||||
|
|
||||||
export interface ComposeOpts {
|
export interface ComposeOpts {
|
||||||
standalone?: boolean;
|
standalone?: boolean;
|
||||||
|
|||||||
@@ -22,13 +22,13 @@ import * as tc from '@actions/tool-cache';
|
|||||||
import * as semver from 'semver';
|
import * as semver from 'semver';
|
||||||
import * as util from 'util';
|
import * as util from 'util';
|
||||||
|
|
||||||
import {Cache} from '../cache';
|
import {Cache} from '../cache.js';
|
||||||
import {Context} from '../context';
|
import {Context} from '../context.js';
|
||||||
import {Docker} from '../docker/docker';
|
import {Docker} from '../docker/docker.js';
|
||||||
import {GitHub} from '../github';
|
import {GitHub} from '../github.js';
|
||||||
|
|
||||||
import {DownloadVersion} from '../types/compose/compose';
|
import {DownloadVersion} from '../types/compose/compose.js';
|
||||||
import {GitHubRelease} from '../types/github';
|
import {GitHubRelease} from '../types/github.js';
|
||||||
|
|
||||||
export interface InstallOpts {
|
export interface InstallOpts {
|
||||||
standalone?: boolean;
|
standalone?: boolean;
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ import path from 'path';
|
|||||||
import * as tmp from 'tmp';
|
import * as tmp from 'tmp';
|
||||||
import * as github from '@actions/github';
|
import * as github from '@actions/github';
|
||||||
|
|
||||||
import {GitHub} from './github';
|
import {GitHub} from './github.js';
|
||||||
|
|
||||||
export class Context {
|
export class Context {
|
||||||
private static readonly _tmpDir = fs.mkdtempSync(path.join(Context.ensureDirExists(process.env.RUNNER_TEMP || os.tmpdir()), 'docker-actions-toolkit-'));
|
private static readonly _tmpDir = fs.mkdtempSync(path.join(Context.ensureDirExists(process.env.RUNNER_TEMP || os.tmpdir()), 'docker-actions-toolkit-'));
|
||||||
|
|||||||
@@ -17,9 +17,9 @@
|
|||||||
import * as core from '@actions/core';
|
import * as core from '@actions/core';
|
||||||
import {BUNDLE_V03_MEDIA_TYPE, SerializedBundle} from '@sigstore/bundle';
|
import {BUNDLE_V03_MEDIA_TYPE, SerializedBundle} from '@sigstore/bundle';
|
||||||
|
|
||||||
import {Exec} from '../exec';
|
import {Exec} from '../exec.js';
|
||||||
import * as semver from 'semver';
|
import * as semver from 'semver';
|
||||||
import {MEDIATYPE_EMPTY_JSON_V1} from '../types/oci/mediatype';
|
import {MEDIATYPE_EMPTY_JSON_V1} from '../types/oci/mediatype.js';
|
||||||
|
|
||||||
export interface CosignOpts {
|
export interface CosignOpts {
|
||||||
binPath?: string;
|
binPath?: string;
|
||||||
|
|||||||
@@ -25,17 +25,17 @@ import {toSignedEntity, toTrustMaterial, Verifier} from '@sigstore/verify';
|
|||||||
import * as semver from 'semver';
|
import * as semver from 'semver';
|
||||||
import * as util from 'util';
|
import * as util from 'util';
|
||||||
|
|
||||||
import {Buildx} from '../buildx/buildx';
|
import {Buildx} from '../buildx/buildx.js';
|
||||||
import {Cache} from '../cache';
|
import {Cache} from '../cache.js';
|
||||||
import {Context} from '../context';
|
import {Context} from '../context.js';
|
||||||
import {Exec} from '../exec';
|
import {Exec} from '../exec.js';
|
||||||
import {Git} from '../git';
|
import {Git} from '../git.js';
|
||||||
import {GitHub} from '../github';
|
import {GitHub} from '../github.js';
|
||||||
import {Util} from '../util';
|
import {Util} from '../util.js';
|
||||||
|
|
||||||
import {DownloadVersion} from '../types/cosign/cosign';
|
import {DownloadVersion} from '../types/cosign/cosign.js';
|
||||||
import {GitHubRelease} from '../types/github';
|
import {GitHubRelease} from '../types/github.js';
|
||||||
import {dockerfileContent} from './dockerfile';
|
import {dockerfileContent} from './dockerfile.js';
|
||||||
|
|
||||||
export interface DownloadOpts {
|
export interface DownloadOpts {
|
||||||
version: string;
|
version: string;
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
import {Context} from '../context';
|
import {Context} from '../context.js';
|
||||||
|
|
||||||
export const setupDockerWinPs1 = (): string => {
|
export const setupDockerWinPs1 = (): string => {
|
||||||
return get('docker-setup-win.ps1', setupDockerWinPs1Data);
|
return get('docker-setup-win.ps1', setupDockerWinPs1Data);
|
||||||
|
|||||||
@@ -21,12 +21,12 @@ import * as core from '@actions/core';
|
|||||||
import {ExecOptions, ExecOutput} from '@actions/exec';
|
import {ExecOptions, ExecOutput} from '@actions/exec';
|
||||||
import * as io from '@actions/io';
|
import * as io from '@actions/io';
|
||||||
|
|
||||||
import {Context} from '../context';
|
import {Context} from '../context.js';
|
||||||
import {Cache} from '../cache';
|
import {Cache} from '../cache.js';
|
||||||
import {Exec} from '../exec';
|
import {Exec} from '../exec.js';
|
||||||
import {Util} from '../util';
|
import {Util} from '../util.js';
|
||||||
|
|
||||||
import {ConfigFile, ContextInfo} from '../types/docker/docker';
|
import {ConfigFile, ContextInfo} from '../types/docker/docker.js';
|
||||||
|
|
||||||
export class Docker {
|
export class Docker {
|
||||||
static get configDir(): string {
|
static get configDir(): string {
|
||||||
|
|||||||
@@ -25,18 +25,18 @@ import * as core from '@actions/core';
|
|||||||
import * as io from '@actions/io';
|
import * as io from '@actions/io';
|
||||||
import * as tc from '@actions/tool-cache';
|
import * as tc from '@actions/tool-cache';
|
||||||
|
|
||||||
import {Context} from '../context';
|
import {Context} from '../context.js';
|
||||||
import {Docker} from './docker';
|
import {Docker} from './docker.js';
|
||||||
import {Exec} from '../exec';
|
import {Exec} from '../exec.js';
|
||||||
import {GitHub} from '../github';
|
import {GitHub} from '../github.js';
|
||||||
import {Regctl} from '../regclient/regctl';
|
import {Regctl} from '../regclient/regctl.js';
|
||||||
import {Undock} from '../undock/undock';
|
import {Undock} from '../undock/undock.js';
|
||||||
import {Util} from '../util';
|
import {Util} from '../util.js';
|
||||||
|
|
||||||
import {limaYamlData, dockerServiceLogsPs1, setupDockerWinPs1} from './assets';
|
import {limaYamlData, dockerServiceLogsPs1, setupDockerWinPs1} from './assets.js';
|
||||||
|
|
||||||
import {GitHubRelease} from '../types/github';
|
import {GitHubRelease} from '../types/github.js';
|
||||||
import {Image} from '../types/oci/config';
|
import {Image} from '../types/oci/config.js';
|
||||||
|
|
||||||
export interface InstallSourceImage {
|
export interface InstallSourceImage {
|
||||||
type: 'image';
|
type: 'image';
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ import * as core from '@actions/core';
|
|||||||
import * as httpm from '@actions/http-client';
|
import * as httpm from '@actions/http-client';
|
||||||
import {HttpCodes} from '@actions/http-client';
|
import {HttpCodes} from '@actions/http-client';
|
||||||
|
|
||||||
import {RepositoryRequest, RepositoryResponse, RepositoryTagsRequest, RepositoryTagsResponse, TokenRequest, TokenResponse, UpdateRepoDescriptionRequest} from './types/dockerhub';
|
import {RepositoryRequest, RepositoryResponse, RepositoryTagsRequest, RepositoryTagsResponse, TokenRequest, TokenResponse, UpdateRepoDescriptionRequest} from './types/dockerhub.js';
|
||||||
|
|
||||||
export interface DockerHubOpts {
|
export interface DockerHubOpts {
|
||||||
credentials: TokenRequest;
|
credentials: TokenRequest;
|
||||||
|
|||||||
10
src/git.ts
10
src/git.ts
@@ -15,18 +15,18 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import * as core from '@actions/core';
|
import * as core from '@actions/core';
|
||||||
|
import * as github from '@actions/github';
|
||||||
import {Octokit} from '@octokit/core';
|
import {Octokit} from '@octokit/core';
|
||||||
import {restEndpointMethods} from '@octokit/plugin-rest-endpoint-methods';
|
import {restEndpointMethods} from '@octokit/plugin-rest-endpoint-methods';
|
||||||
|
|
||||||
import {Exec} from './exec';
|
import {Exec} from './exec.js';
|
||||||
import {GitHub} from './github';
|
import {GitHub} from './github.js';
|
||||||
import {Context} from '@actions/github/lib/context';
|
|
||||||
|
|
||||||
import {Context as GitContext} from './types/git';
|
export type GitContext = typeof github.context;
|
||||||
|
|
||||||
export class Git {
|
export class Git {
|
||||||
public static async context(): Promise<GitContext> {
|
public static async context(): Promise<GitContext> {
|
||||||
const ctx = new Context();
|
const ctx = {...github.context} as GitContext;
|
||||||
ctx.ref = await Git.ref();
|
ctx.ref = await Git.ref();
|
||||||
ctx.sha = await Git.fullCommit();
|
ctx.sha = await Git.fullCommit();
|
||||||
return ctx;
|
return ctx;
|
||||||
|
|||||||
@@ -27,18 +27,15 @@ import {getBackendIdsFromToken} from '@actions/artifact/lib/internal/shared/util
|
|||||||
import {getExpiration} from '@actions/artifact/lib/internal/upload/retention';
|
import {getExpiration} from '@actions/artifact/lib/internal/upload/retention';
|
||||||
import {InvalidResponseError, NetworkError} from '@actions/artifact';
|
import {InvalidResponseError, NetworkError} from '@actions/artifact';
|
||||||
import * as core from '@actions/core';
|
import * as core from '@actions/core';
|
||||||
import {SummaryTableCell} from '@actions/core/lib/summary';
|
|
||||||
import * as github from '@actions/github';
|
import * as github from '@actions/github';
|
||||||
import {GitHub as Octokit} from '@actions/github/lib/utils';
|
|
||||||
import {Context} from '@actions/github/lib/context';
|
|
||||||
import * as httpm from '@actions/http-client';
|
import * as httpm from '@actions/http-client';
|
||||||
import {TransferProgressEvent} from '@azure/core-rest-pipeline';
|
import {TransferProgressEvent} from '@azure/core-rest-pipeline';
|
||||||
import {BlobClient, BlobHTTPHeaders} from '@azure/storage-blob';
|
import {BlobClient, BlobHTTPHeaders} from '@azure/storage-blob';
|
||||||
import {jwtDecode, JwtPayload} from 'jwt-decode';
|
import {jwtDecode, JwtPayload} from 'jwt-decode';
|
||||||
|
|
||||||
import {Util} from './util';
|
import {Util} from './util.js';
|
||||||
|
|
||||||
import {BuildSummaryOpts, GitHubActionsRuntimeToken, GitHubActionsRuntimeTokenAC, GitHubContentOpts, GitHubRelease, GitHubRepo, UploadArtifactOpts, UploadArtifactResponse} from './types/github';
|
import {BuildSummaryOpts, GitHubActionsRuntimeToken, GitHubActionsRuntimeTokenAC, GitHubContentOpts, GitHubRelease, GitHubRepo, SummaryTableCell, UploadArtifactOpts, UploadArtifactResponse} from './types/github.js';
|
||||||
|
|
||||||
export interface GitHubOpts {
|
export interface GitHubOpts {
|
||||||
token?: string;
|
token?: string;
|
||||||
@@ -46,7 +43,7 @@ export interface GitHubOpts {
|
|||||||
|
|
||||||
export class GitHub {
|
export class GitHub {
|
||||||
private readonly githubToken?: string;
|
private readonly githubToken?: string;
|
||||||
public readonly octokit: InstanceType<typeof Octokit>;
|
public readonly octokit: ReturnType<typeof github.getOctokit>;
|
||||||
|
|
||||||
constructor(opts?: GitHubOpts) {
|
constructor(opts?: GitHubOpts) {
|
||||||
this.githubToken = opts?.token || process.env.GITHUB_TOKEN;
|
this.githubToken = opts?.token || process.env.GITHUB_TOKEN;
|
||||||
@@ -87,7 +84,7 @@ export class GitHub {
|
|||||||
return <Record<string, GitHubRelease>>JSON.parse(dt);
|
return <Record<string, GitHubRelease>>JSON.parse(dt);
|
||||||
}
|
}
|
||||||
|
|
||||||
static get context(): Context {
|
static get context(): typeof github.context {
|
||||||
return github.context;
|
return github.context;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
import * as core from '@actions/core';
|
import * as core from '@actions/core';
|
||||||
|
|
||||||
import {Cache} from './cache';
|
import {Cache} from './cache.js';
|
||||||
|
|
||||||
const isPost = !!process.env['STATE_isPost'];
|
const isPost = !!process.env['STATE_isPost'];
|
||||||
if (!isPost) {
|
if (!isPost) {
|
||||||
|
|||||||
@@ -20,13 +20,13 @@ import * as path from 'path';
|
|||||||
import {Readable} from 'stream';
|
import {Readable} from 'stream';
|
||||||
import * as tar from 'tar-stream';
|
import * as tar from 'tar-stream';
|
||||||
|
|
||||||
import {Archive, LoadArchiveOpts} from '../types/oci/oci';
|
import {Archive, LoadArchiveOpts} from '../types/oci/oci.js';
|
||||||
import {Index} from '../types/oci';
|
import {Index} from '../types/oci/index.js';
|
||||||
import {Platform} from '../types/oci/descriptor';
|
import {Platform} from '../types/oci/descriptor.js';
|
||||||
import {Manifest} from '../types/oci/manifest';
|
import {Manifest} from '../types/oci/manifest.js';
|
||||||
import {Image} from '../types/oci/config';
|
import {Image} from '../types/oci/config.js';
|
||||||
import {IMAGE_BLOBS_DIR_V1, IMAGE_INDEX_FILE_V1, IMAGE_LAYOUT_FILE_V1, ImageLayout} from '../types/oci/layout';
|
import {IMAGE_BLOBS_DIR_V1, IMAGE_INDEX_FILE_V1, IMAGE_LAYOUT_FILE_V1, ImageLayout} from '../types/oci/layout.js';
|
||||||
import {MEDIATYPE_IMAGE_INDEX_V1, MEDIATYPE_IMAGE_MANIFEST_V1} from '../types/oci/mediatype';
|
import {MEDIATYPE_IMAGE_INDEX_V1, MEDIATYPE_IMAGE_MANIFEST_V1} from '../types/oci/mediatype.js';
|
||||||
|
|
||||||
export class OCI {
|
export class OCI {
|
||||||
public static defaultPlatform(): Platform {
|
public static defaultPlatform(): Platform {
|
||||||
|
|||||||
@@ -22,12 +22,12 @@ import * as tc from '@actions/tool-cache';
|
|||||||
import * as semver from 'semver';
|
import * as semver from 'semver';
|
||||||
import * as util from 'util';
|
import * as util from 'util';
|
||||||
|
|
||||||
import {Cache} from '../cache';
|
import {Cache} from '../cache.js';
|
||||||
import {Context} from '../context';
|
import {Context} from '../context.js';
|
||||||
import {GitHub} from '../github';
|
import {GitHub} from '../github.js';
|
||||||
|
|
||||||
import {GitHubRelease} from '../types/github';
|
import {GitHubRelease} from '../types/github.js';
|
||||||
import {DownloadVersion} from '../types/regclient/regclient';
|
import {DownloadVersion} from '../types/regclient/regclient.js';
|
||||||
|
|
||||||
export interface InstallOpts {
|
export interface InstallOpts {
|
||||||
githubToken?: string;
|
githubToken?: string;
|
||||||
|
|||||||
@@ -17,9 +17,9 @@
|
|||||||
import * as core from '@actions/core';
|
import * as core from '@actions/core';
|
||||||
import * as semver from 'semver';
|
import * as semver from 'semver';
|
||||||
|
|
||||||
import {Exec} from '../exec';
|
import {Exec} from '../exec.js';
|
||||||
|
|
||||||
import {Manifest} from '../types/oci/manifest';
|
import {Manifest} from '../types/oci/manifest.js';
|
||||||
|
|
||||||
export interface RegctlOpts {
|
export interface RegctlOpts {
|
||||||
binPath?: string;
|
binPath?: string;
|
||||||
|
|||||||
@@ -22,13 +22,13 @@ import * as core from '@actions/core';
|
|||||||
import {bundleFromJSON, bundleToJSON} from '@sigstore/bundle';
|
import {bundleFromJSON, bundleToJSON} from '@sigstore/bundle';
|
||||||
import {Artifact, Bundle, CIContextProvider, DSSEBundleBuilder, FulcioSigner, RekorWitness, TSAWitness, Witness} from '@sigstore/sign';
|
import {Artifact, Bundle, CIContextProvider, DSSEBundleBuilder, FulcioSigner, RekorWitness, TSAWitness, Witness} from '@sigstore/sign';
|
||||||
|
|
||||||
import {Context} from '../context';
|
import {Context} from '../context.js';
|
||||||
import {Cosign} from '../cosign/cosign';
|
import {Cosign} from '../cosign/cosign.js';
|
||||||
import {Exec} from '../exec';
|
import {Exec} from '../exec.js';
|
||||||
import {GitHub} from '../github';
|
import {GitHub} from '../github.js';
|
||||||
import {ImageTools} from '../buildx/imagetools';
|
import {ImageTools} from '../buildx/imagetools.js';
|
||||||
|
|
||||||
import {MEDIATYPE_PAYLOAD as INTOTO_MEDIATYPE_PAYLOAD, Subject} from '../types/intoto/intoto';
|
import {MEDIATYPE_PAYLOAD as INTOTO_MEDIATYPE_PAYLOAD, Subject} from '../types/intoto/intoto.js';
|
||||||
import {
|
import {
|
||||||
Endpoints,
|
Endpoints,
|
||||||
FULCIO_URL,
|
FULCIO_URL,
|
||||||
@@ -44,7 +44,7 @@ import {
|
|||||||
VerifySignedArtifactsResult,
|
VerifySignedArtifactsResult,
|
||||||
VerifySignedManifestsOpts,
|
VerifySignedManifestsOpts,
|
||||||
VerifySignedManifestsResult
|
VerifySignedManifestsResult
|
||||||
} from '../types/sigstore/sigstore';
|
} from '../types/sigstore/sigstore.js';
|
||||||
|
|
||||||
export interface SigstoreOpts {
|
export interface SigstoreOpts {
|
||||||
cosign?: Cosign;
|
cosign?: Cosign;
|
||||||
|
|||||||
@@ -14,22 +14,22 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {GitHub} from './github';
|
import {GitHub} from './github.js';
|
||||||
import {Buildx} from './buildx/buildx';
|
import {Buildx} from './buildx/buildx.js';
|
||||||
import {Build as BuildxBuild} from './buildx/build';
|
import {Build as BuildxBuild} from './buildx/build.js';
|
||||||
import {Bake as BuildxBake} from './buildx/bake';
|
import {Bake as BuildxBake} from './buildx/bake.js';
|
||||||
import {Install as BuildxInstall} from './buildx/install';
|
import {Install as BuildxInstall} from './buildx/install.js';
|
||||||
import {Builder} from './buildx/builder';
|
import {Builder} from './buildx/builder.js';
|
||||||
import {BuildKit} from './buildkit/buildkit';
|
import {BuildKit} from './buildkit/buildkit.js';
|
||||||
import {Compose} from './compose/compose';
|
import {Compose} from './compose/compose.js';
|
||||||
import {Install as ComposeInstall} from './compose/install';
|
import {Install as ComposeInstall} from './compose/install.js';
|
||||||
import {Cosign} from './cosign/cosign';
|
import {Cosign} from './cosign/cosign.js';
|
||||||
import {Install as CosignInstall} from './cosign/install';
|
import {Install as CosignInstall} from './cosign/install.js';
|
||||||
import {Regctl} from './regclient/regctl';
|
import {Regctl} from './regclient/regctl.js';
|
||||||
import {Install as RegctlInstall} from './regclient/install';
|
import {Install as RegctlInstall} from './regclient/install.js';
|
||||||
import {Undock} from './undock/undock';
|
import {Undock} from './undock/undock.js';
|
||||||
import {Install as UndockInstall} from './undock/install';
|
import {Install as UndockInstall} from './undock/install.js';
|
||||||
import {Sigstore} from './sigstore/sigstore';
|
import {Sigstore} from './sigstore/sigstore.js';
|
||||||
|
|
||||||
export interface ToolkitOpts {
|
export interface ToolkitOpts {
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -14,8 +14,8 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {Digest} from '../oci/digest';
|
import {Digest} from '../oci/digest.js';
|
||||||
import {ProgressGroup, Range, SourceInfo} from './ops';
|
import {ProgressGroup, Range, SourceInfo} from './ops.js';
|
||||||
|
|
||||||
// https://github.com/moby/buildkit/blob/v0.14.0/client/graph.go#L10-L19
|
// https://github.com/moby/buildkit/blob/v0.14.0/client/graph.go#L10-L19
|
||||||
export interface Vertex {
|
export interface Vertex {
|
||||||
|
|||||||
@@ -14,10 +14,10 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {Descriptor} from '../oci/descriptor';
|
import {Descriptor} from '../oci/descriptor.js';
|
||||||
import {Digest} from '../oci/digest';
|
import {Digest} from '../oci/digest.js';
|
||||||
import {ProgressGroup, Range, SourceInfo} from './ops';
|
import {ProgressGroup, Range, SourceInfo} from './ops.js';
|
||||||
import {RpcStatus} from './rpc';
|
import {RpcStatus} from './rpc.js';
|
||||||
|
|
||||||
// https://github.com/moby/buildkit/blob/v0.14.0/api/services/control/control.pb.go#L1504-L1525
|
// https://github.com/moby/buildkit/blob/v0.14.0/api/services/control/control.pb.go#L1504-L1525
|
||||||
export interface BuildHistoryRecord {
|
export interface BuildHistoryRecord {
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {GitHubContentOpts} from '../github';
|
import {GitHubContentOpts} from '../github.js';
|
||||||
|
|
||||||
export interface Cert {
|
export interface Cert {
|
||||||
cacert?: string;
|
cacert?: string;
|
||||||
|
|||||||
@@ -14,9 +14,9 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {Versioned} from '../oci/versioned';
|
import {Versioned} from '../oci/versioned.js';
|
||||||
import {Descriptor} from '../oci/descriptor';
|
import {Descriptor} from '../oci/descriptor.js';
|
||||||
import {Digest} from '../oci/digest';
|
import {Digest} from '../oci/digest.js';
|
||||||
|
|
||||||
// https://github.com/docker/buildx/blob/62857022a08552bee5cad0c3044a9a3b185f0b32/util/imagetools/printers.go#L109-L123
|
// https://github.com/docker/buildx/blob/62857022a08552bee5cad0c3044a9a3b185f0b32/util/imagetools/printers.go#L109-L123
|
||||||
export interface Manifest extends Versioned {
|
export interface Manifest extends Versioned {
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {GitHubContentOpts} from '../github';
|
import {GitHubContentOpts} from '../github.js';
|
||||||
|
|
||||||
export interface DownloadVersion {
|
export interface DownloadVersion {
|
||||||
key: string;
|
key: string;
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {GitHubContentOpts} from '../github';
|
import {GitHubContentOpts} from '../github.js';
|
||||||
|
|
||||||
export interface DownloadVersion {
|
export interface DownloadVersion {
|
||||||
version: string;
|
version: string;
|
||||||
|
|||||||
@@ -14,12 +14,16 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import * as core from '@actions/core';
|
||||||
import {AnnotationProperties} from '@actions/core';
|
import {AnnotationProperties} from '@actions/core';
|
||||||
import {components as OctoOpenApiTypes} from '@octokit/openapi-types';
|
import {components as OctoOpenApiTypes} from '@octokit/openapi-types';
|
||||||
import {JwtPayload} from 'jwt-decode';
|
import {JwtPayload} from 'jwt-decode';
|
||||||
|
|
||||||
import {BakeDefinition} from './buildx/bake';
|
import {BakeDefinition} from './buildx/bake.js';
|
||||||
import {ExportResponse} from './buildx/history';
|
import {ExportResponse} from './buildx/history.js';
|
||||||
|
|
||||||
|
export type SummaryTableRow = Parameters<typeof core.summary.addTable>[0][number];
|
||||||
|
export type SummaryTableCell = Exclude<SummaryTableRow[number], string>;
|
||||||
|
|
||||||
export interface GitHubRelease {
|
export interface GitHubRelease {
|
||||||
id: number;
|
id: number;
|
||||||
|
|||||||
@@ -14,8 +14,8 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {Digest} from './digest';
|
import {Digest} from './digest.js';
|
||||||
import {Platform} from './descriptor';
|
import {Platform} from './descriptor.js';
|
||||||
|
|
||||||
export interface ImageConfig {
|
export interface ImageConfig {
|
||||||
User?: string;
|
User?: string;
|
||||||
|
|||||||
@@ -14,9 +14,9 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {Digest} from './digest';
|
import {Digest} from './digest.js';
|
||||||
|
|
||||||
import {MEDIATYPE_EMPTY_JSON_V1} from './mediatype';
|
import {MEDIATYPE_EMPTY_JSON_V1} from './mediatype.js';
|
||||||
|
|
||||||
export interface Descriptor {
|
export interface Descriptor {
|
||||||
mediaType: string;
|
mediaType: string;
|
||||||
|
|||||||
@@ -14,8 +14,8 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {Versioned} from './versioned';
|
import {Versioned} from './versioned.js';
|
||||||
import {Descriptor} from './descriptor';
|
import {Descriptor} from './descriptor.js';
|
||||||
|
|
||||||
export interface Index extends Versioned {
|
export interface Index extends Versioned {
|
||||||
mediaType?: string;
|
mediaType?: string;
|
||||||
|
|||||||
@@ -14,8 +14,8 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {Descriptor} from './descriptor';
|
import {Descriptor} from './descriptor.js';
|
||||||
import {Versioned} from './versioned';
|
import {Versioned} from './versioned.js';
|
||||||
|
|
||||||
export interface Manifest extends Versioned {
|
export interface Manifest extends Versioned {
|
||||||
mediaType?: string;
|
mediaType?: string;
|
||||||
|
|||||||
@@ -14,10 +14,10 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {Index} from './index';
|
import {Index} from './index.js';
|
||||||
import {ImageLayout} from './layout';
|
import {ImageLayout} from './layout.js';
|
||||||
import {Manifest} from './manifest';
|
import {Manifest} from './manifest.js';
|
||||||
import {Image} from './config';
|
import {Image} from './config.js';
|
||||||
|
|
||||||
export interface LoadArchiveOpts {
|
export interface LoadArchiveOpts {
|
||||||
file: string;
|
file: string;
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {GitHubContentOpts} from '../github';
|
import {GitHubContentOpts} from '../github.js';
|
||||||
|
|
||||||
export interface DownloadVersion {
|
export interface DownloadVersion {
|
||||||
version: string;
|
version: string;
|
||||||
|
|||||||
@@ -16,8 +16,8 @@
|
|||||||
|
|
||||||
import type {SerializedBundle} from '@sigstore/bundle';
|
import type {SerializedBundle} from '@sigstore/bundle';
|
||||||
|
|
||||||
import {Subject} from '../intoto/intoto';
|
import {Subject} from '../intoto/intoto.js';
|
||||||
import {Platform} from '../oci/descriptor';
|
import {Platform} from '../oci/descriptor.js';
|
||||||
|
|
||||||
export const FULCIO_URL = 'https://fulcio.sigstore.dev';
|
export const FULCIO_URL = 'https://fulcio.sigstore.dev';
|
||||||
export const REKOR_URL = 'https://rekor.sigstore.dev';
|
export const REKOR_URL = 'https://rekor.sigstore.dev';
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {GitHubContentOpts} from '../github';
|
import {GitHubContentOpts} from '../github.js';
|
||||||
|
|
||||||
export interface DownloadVersion {
|
export interface DownloadVersion {
|
||||||
version: string;
|
version: string;
|
||||||
|
|||||||
@@ -22,12 +22,12 @@ import * as tc from '@actions/tool-cache';
|
|||||||
import * as semver from 'semver';
|
import * as semver from 'semver';
|
||||||
import * as util from 'util';
|
import * as util from 'util';
|
||||||
|
|
||||||
import {Cache} from '../cache';
|
import {Cache} from '../cache.js';
|
||||||
import {Context} from '../context';
|
import {Context} from '../context.js';
|
||||||
import {GitHub} from '../github';
|
import {GitHub} from '../github.js';
|
||||||
|
|
||||||
import {GitHubRelease} from '../types/github';
|
import {GitHubRelease} from '../types/github.js';
|
||||||
import {DownloadVersion} from '../types/undock/undock';
|
import {DownloadVersion} from '../types/undock/undock.js';
|
||||||
|
|
||||||
export interface InstallOpts {
|
export interface InstallOpts {
|
||||||
githubToken?: string;
|
githubToken?: string;
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
import * as core from '@actions/core';
|
import * as core from '@actions/core';
|
||||||
import * as semver from 'semver';
|
import * as semver from 'semver';
|
||||||
|
|
||||||
import {Exec} from '../exec';
|
import {Exec} from '../exec.js';
|
||||||
|
|
||||||
export interface UndockOpts {
|
export interface UndockOpts {
|
||||||
binPath?: string;
|
binPath?: string;
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
|
"module": "es2020",
|
||||||
|
"moduleResolution": "bundler",
|
||||||
"esModuleInterop": true,
|
"esModuleInterop": true,
|
||||||
"target": "es6",
|
|
||||||
"module": "node16",
|
|
||||||
"isolatedModules": true,
|
"isolatedModules": true,
|
||||||
"strict": true,
|
"strict": true,
|
||||||
"declaration": true,
|
"declaration": true,
|
||||||
@@ -14,6 +14,7 @@
|
|||||||
"noImplicitAny": false,
|
"noImplicitAny": false,
|
||||||
"resolveJsonModule": true,
|
"resolveJsonModule": true,
|
||||||
"useUnknownInCatchVariables": false,
|
"useUnknownInCatchVariables": false,
|
||||||
|
"skipLibCheck": true,
|
||||||
},
|
},
|
||||||
"exclude": [
|
"exclude": [
|
||||||
"./__mocks__/**/*",
|
"./__mocks__/**/*",
|
||||||
|
|||||||
15
tsconfig.test.json
Normal file
15
tsconfig.test.json
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"extends": "./tsconfig.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"rootDir": ".",
|
||||||
|
"noEmit": true
|
||||||
|
},
|
||||||
|
"include": [
|
||||||
|
"src/**/*.ts",
|
||||||
|
"__tests__/**/*.ts"
|
||||||
|
],
|
||||||
|
"exclude": [
|
||||||
|
"lib",
|
||||||
|
"node_modules"
|
||||||
|
]
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user