chore: fix imports
parent
8346abff41
commit
bee47ead58
|
|
@ -58,6 +58,8 @@
|
|||
// For this project only use kebab-case
|
||||
"unicorn/filename-case": ["error", { "cases": { "kebabCase": true } }],
|
||||
// Allow Array.from(set) mitigate TS2569 which would require '--downlevelIteration'
|
||||
"unicorn/prefer-spread": "off"
|
||||
"unicorn/prefer-spread": "off",
|
||||
// Deno has dependencies file, this rule enforces it's named re-exports
|
||||
"unicorn/prevent-abbreviations": "off"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,19 +1,28 @@
|
|||
// These are the packages from Deno that replace the ones from Node.
|
||||
import * as assert from 'https://deno.land/std@0.142.0/testing/mod.ts';
|
||||
import * as aws from 'https://deno.land/x/aws_sdk@v3.32.0-1/mod.ts';
|
||||
import * as assert from 'https://deno.land/std@0.144.0/testing/asserts.ts';
|
||||
import * as aws from 'https://deno.land/x/aws_api/client/mod.ts';
|
||||
import * as base64 from 'https://deno.land/std@0.145.0/encoding/base64.ts';
|
||||
import * as compress from 'https://deno.land/x/compress@v0.3.3/mod.ts';
|
||||
import * as core from 'https://deno.land/x/deno_actions_core/mod.ts';
|
||||
// import * as core from 'https://deno.land/x/deno_actions_core/mod.ts';
|
||||
import * as fs from 'https://deno.land/std@0.142.0/node/fs/promises.ts';
|
||||
import * as fsSync from 'https://deno.land/std@0.142.0/node/fs/mod.ts';
|
||||
import * as fsSync from 'https://deno.land/std@0.142.0/fs/mod.ts';
|
||||
import * as k8s from 'https://deno.land/x/kubernetes_client/mod.ts';
|
||||
import * as nanoid from 'https://deno.land/x/nanoid/mod.ts';
|
||||
import * as k8sTypes from 'https://deno.land/x/kubernetes_apis/builtin/core@v1/mod.ts';
|
||||
import * as nanoid from 'https://deno.land/x/nanoid@v3.0.0/mod.ts';
|
||||
import * as path from 'https://deno.land/std@0.142.0/path/mod.ts';
|
||||
import * as process from 'https://deno.land/std@0.104.0/node/process.ts';
|
||||
import * as semver from 'https://deno.land/x/semver@v1.4.0/mod.ts';
|
||||
import * as waitUntil from 'async-wait-until';
|
||||
import * as yaml from 'https://deno.land/x/yaml@v2.1.1/mod.ts';
|
||||
import * as waitUntil from './helpers/waitUntil.ts';
|
||||
import * as yaml from 'https://deno.land/std@0.145.0/encoding/yaml.ts';
|
||||
import { crypto } from 'https://deno.land/std@0.142.0/crypto/mod.ts';
|
||||
import { v4 as uuid } from 'https://deno.land/std@0.142.0/uuid/mod.ts';
|
||||
import * as http from 'https://deno.land/std@0.145.0/node/http.ts';
|
||||
|
||||
const core = {
|
||||
setFailed: () => {},
|
||||
info: () => {},
|
||||
error: () => {},
|
||||
};
|
||||
|
||||
const exec = () => {
|
||||
throw new Error('exec is not implemented'); // @actions/exec'
|
||||
|
|
@ -38,14 +47,29 @@ class Writable {
|
|||
}
|
||||
}
|
||||
|
||||
class Command {
|
||||
constructor() {
|
||||
throw new Error('Command is not implemented'); // commander-ts
|
||||
}
|
||||
}
|
||||
|
||||
const __filename = path.fromFileUrl(import.meta.url);
|
||||
const __dirname = path.dirname(path.fromFileUrl(import.meta.url));
|
||||
|
||||
const { V1EnvVar, V1EnvVarSource, V1SecretKeySelector } = k8s;
|
||||
|
||||
export {
|
||||
__dirname,
|
||||
__filename,
|
||||
k8s,
|
||||
k8sTypes,
|
||||
V1EnvVar,
|
||||
V1EnvVarSource,
|
||||
V1SecretKeySelector,
|
||||
assert,
|
||||
aws,
|
||||
base64,
|
||||
Command,
|
||||
compress,
|
||||
core,
|
||||
crypto,
|
||||
|
|
@ -53,7 +77,7 @@ export {
|
|||
fs,
|
||||
fsSync,
|
||||
getUnityChangeSet,
|
||||
k8s,
|
||||
http,
|
||||
nanoid,
|
||||
path,
|
||||
process,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { core, process } from './dependencies.ts';
|
||||
import { Action, BuildParameters, Cache, CloudRunner, Docker, ImageTag, Output } from './model.ts';
|
||||
import { Action, BuildParameters, Cache, CloudRunner, Docker, ImageTag, Output } from './model/index.ts';
|
||||
import { Cli } from './model/cli/cli.ts';
|
||||
import MacBuilder from './model/mac-builder.ts';
|
||||
import PlatformSetup from './model/platform-setup.ts';
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { core, semver } from '../../dependencies.ts';
|
||||
import { core, semver } from '../dependencies.ts';
|
||||
|
||||
export default class AndroidVersioning {
|
||||
static determineVersionCode(version, inputVersionCode) {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { customAlphabet } from '../../../node_modules/nanoid';
|
||||
import { nanoid } from '../dependencies.ts';
|
||||
import AndroidVersioning from './android-versioning.ts';
|
||||
import CloudRunnerConstants from './cloud-runner/services/cloud-runner-constants.ts';
|
||||
import CloudRunnerBuildGuid from './cloud-runner/services/cloud-runner-guid.ts';
|
||||
|
|
@ -133,7 +133,7 @@ class BuildParameters {
|
|||
isCliMode: Cli.isCliMode,
|
||||
awsStackName: Input.awsBaseStackName,
|
||||
gitSha: Input.gitSha,
|
||||
logId: customAlphabet(CloudRunnerConstants.alphabet, 9)(),
|
||||
logId: nanoid.customAlphabet(CloudRunnerConstants.alphabet, 9)(),
|
||||
buildGuid: CloudRunnerBuildGuid.generateGuid(Input.runNumber, Input.targetPlatform),
|
||||
customJobHooks: Input.customJobHooks(),
|
||||
cachePullOverrideCommand: Input.cachePullOverrideCommand(),
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { Command } from '../../../node_modules/commander-ts';
|
||||
import { Command } from '../../dependencies.ts';
|
||||
import { BuildParameters, CloudRunner, ImageTag, Input } from '../index.ts';
|
||||
import { core } from '../../dependencies.ts';
|
||||
import { ActionYamlReader } from '../input-readers/action-yaml.ts';
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import CloudRunnerLogger from '../../services/cloud-runner-logger.ts';
|
||||
import { core, aws } from '../../dependencies.ts';
|
||||
import { core, aws } from '../../../../dependencies.ts';
|
||||
import CloudRunner from '../../cloud-runner.ts';
|
||||
|
||||
export class AWSError {
|
||||
|
|
|
|||
|
|
@ -1,9 +1,8 @@
|
|||
import * as AWS from 'aws-sdk';
|
||||
import { aws, core, compress } from '../../../../dependencies.ts';
|
||||
import CloudRunnerEnvironmentVariable from '../../services/cloud-runner-environment-variable.ts';
|
||||
import { core, compress } from '../../dependencies.ts';
|
||||
import CloudRunnerAWSTaskDef from './cloud-runner-aws-task-def.ts';
|
||||
import CloudRunnerLogger from '../../services/cloud-runner-logger.ts';
|
||||
import { Input } from '../../...ts';
|
||||
import { Input } from '../../../index.ts';
|
||||
import CloudRunner from '../../cloud-runner.ts';
|
||||
import { CloudRunnerBuildCommandProcessor } from '../../services/cloud-runner-build-command-process.ts';
|
||||
import { FollowLogStreamService } from '../../services/follow-log-stream-service.ts';
|
||||
|
|
@ -11,8 +10,8 @@ import { FollowLogStreamService } from '../../services/follow-log-stream-service
|
|||
class AWSTaskRunner {
|
||||
static async runTask(
|
||||
taskDef: CloudRunnerAWSTaskDef,
|
||||
ECS: AWS.ECS,
|
||||
CF: AWS.CloudFormation,
|
||||
ECS: aws.ECS,
|
||||
CF: aws.CloudFormation,
|
||||
environment: CloudRunnerEnvironmentVariable[],
|
||||
buildGuid: string,
|
||||
commands: string,
|
||||
|
|
@ -84,7 +83,7 @@ class AWSTaskRunner {
|
|||
}
|
||||
}
|
||||
|
||||
private static async waitUntilTaskRunning(ECS: AWS.ECS, taskArn: string, cluster: string) {
|
||||
private static async waitUntilTaskRunning(ECS: aws.ECS, taskArn: string, cluster: string) {
|
||||
try {
|
||||
await ECS.waitFor('tasksRunning', { tasks: [taskArn], cluster }).promise();
|
||||
} catch (error_) {
|
||||
|
|
@ -101,7 +100,7 @@ class AWSTaskRunner {
|
|||
}
|
||||
}
|
||||
|
||||
static async describeTasks(ECS: AWS.ECS, clusterName: string, taskArn: string) {
|
||||
static async describeTasks(ECS: aws.ECS, clusterName: string, taskArn: string) {
|
||||
const tasks = await ECS.describeTasks({
|
||||
cluster: clusterName,
|
||||
tasks: [taskArn],
|
||||
|
|
@ -114,14 +113,14 @@ class AWSTaskRunner {
|
|||
}
|
||||
|
||||
static async streamLogsUntilTaskStops(
|
||||
ECS: AWS.ECS,
|
||||
CF: AWS.CloudFormation,
|
||||
ECS: aws.ECS,
|
||||
CF: aws.CloudFormation,
|
||||
taskDef: CloudRunnerAWSTaskDef,
|
||||
clusterName: string,
|
||||
taskArn: string,
|
||||
kinesisStreamName: string,
|
||||
) {
|
||||
const kinesis = new AWS.Kinesis();
|
||||
const kinesis = new aws.Kinesis();
|
||||
const stream = await AWSTaskRunner.getLogStream(kinesis, kinesisStreamName);
|
||||
let iterator = await AWSTaskRunner.getLogIterator(kinesis, stream);
|
||||
|
||||
|
|
@ -149,7 +148,7 @@ class AWSTaskRunner {
|
|||
}
|
||||
|
||||
private static async handleLogStreamIteration(
|
||||
kinesis: AWS.Kinesis,
|
||||
kinesis: aws.Kinesis,
|
||||
iterator: string,
|
||||
shouldReadLogs: boolean,
|
||||
taskDef: CloudRunnerAWSTaskDef,
|
||||
|
|
@ -174,7 +173,7 @@ class AWSTaskRunner {
|
|||
return { iterator, shouldReadLogs, output, shouldCleanup };
|
||||
}
|
||||
|
||||
private static checkStreamingShouldContinue(taskData: AWS.ECS.Task, timestamp: number, shouldReadLogs: boolean) {
|
||||
private static checkStreamingShouldContinue(taskData: aws.ECS.Task, timestamp: number, shouldReadLogs: boolean) {
|
||||
if (taskData?.lastStatus === 'UNKNOWN') {
|
||||
CloudRunnerLogger.log('## Cloud runner job unknwon');
|
||||
}
|
||||
|
|
@ -223,7 +222,7 @@ class AWSTaskRunner {
|
|||
return { shouldReadLogs, output, shouldCleanup };
|
||||
}
|
||||
|
||||
private static async getLogStream(kinesis: AWS.Kinesis, kinesisStreamName: string) {
|
||||
private static async getLogStream(kinesis: aws.Kinesis, kinesisStreamName: string) {
|
||||
return await kinesis
|
||||
.describeStream({
|
||||
StreamName: kinesisStreamName,
|
||||
|
|
@ -231,7 +230,7 @@ class AWSTaskRunner {
|
|||
.promise();
|
||||
}
|
||||
|
||||
private static async getLogIterator(kinesis: AWS.Kinesis, stream) {
|
||||
private static async getLogIterator(kinesis: aws.Kinesis, stream) {
|
||||
return (
|
||||
(
|
||||
await kinesis
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
import * as AWS from 'aws-sdk';
|
||||
import { aws } from '../../../../dependencies.ts';
|
||||
|
||||
class CloudRunnerAWSTaskDef {
|
||||
public taskDefStackName!: string;
|
||||
public taskDefCloudFormation!: string;
|
||||
public taskDefResources: AWS.CloudFormation.StackResources | undefined;
|
||||
public baseResources: AWS.CloudFormation.StackResources | undefined;
|
||||
public taskDefResources: aws.CloudFormation.StackResources | undefined;
|
||||
public baseResources: aws.CloudFormation.StackResources | undefined;
|
||||
}
|
||||
export default CloudRunnerAWSTaskDef;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import AWS from 'aws-sdk';
|
||||
import { aws } from '../../../../../dependencies.ts';
|
||||
import { CliFunction } from '../../../../cli/cli-functions-repository.ts';
|
||||
import Input from '../../../../input.ts';
|
||||
import CloudRunnerLogger from '../../../services/cloud-runner-logger.ts';
|
||||
|
|
@ -34,7 +34,7 @@ export class AwsCliCommands {
|
|||
@CliFunction(`aws-list-stacks`, `List stacks`)
|
||||
static async awsListStacks(perResultCallback: any = false, verbose: boolean = false) {
|
||||
Deno.env.set('AWS_REGION', Input.region);
|
||||
const CF = new AWS.CloudFormation();
|
||||
const CF = new aws.CloudFormation();
|
||||
const stacks =
|
||||
(await CF.listStacks().promise()).StackSummaries?.filter(
|
||||
(_x) => _x.StackStatus !== 'DELETE_COMPLETE', // &&
|
||||
|
|
@ -72,17 +72,17 @@ export class AwsCliCommands {
|
|||
@CliFunction(`aws-list-tasks`, `List tasks`)
|
||||
static async awsListTasks(perResultCallback: any = false) {
|
||||
Deno.env.set('AWS_REGION', Input.region);
|
||||
const ecs = new AWS.ECS();
|
||||
const ecs = new aws.ECS();
|
||||
const clusters = (await ecs.listClusters().promise()).clusterArns || [];
|
||||
CloudRunnerLogger.log(`Clusters ${clusters.length}`);
|
||||
for (const element of clusters) {
|
||||
const input: AWS.ECS.ListTasksRequest = {
|
||||
const input: aws.ECS.ListTasksRequest = {
|
||||
cluster: element,
|
||||
};
|
||||
|
||||
const list = (await ecs.listTasks(input).promise()).taskArns || [];
|
||||
if (list.length > 0) {
|
||||
const describeInput: AWS.ECS.DescribeTasksRequest = { tasks: list, cluster: element };
|
||||
const describeInput: aws.ECS.DescribeTasksRequest = { tasks: list, cluster: element };
|
||||
const describeList = (await ecs.describeTasks(describeInput).promise()).tasks || [];
|
||||
if (describeList === []) {
|
||||
continue;
|
||||
|
|
@ -106,8 +106,8 @@ export class AwsCliCommands {
|
|||
@CliFunction(`aws-list-log-groups`, `List tasks`)
|
||||
static async awsListLogGroups(perResultCallback: any = false, verbose: boolean = false) {
|
||||
Deno.env.set('AWS_REGION', Input.region);
|
||||
const ecs = new AWS.CloudWatchLogs();
|
||||
let logStreamInput: AWS.CloudWatchLogs.DescribeLogGroupsRequest = {
|
||||
const ecs = new aws.CloudWatchLogs();
|
||||
let logStreamInput: aws.CloudWatchLogs.DescribeLogGroupsRequest = {
|
||||
/* logGroupNamePrefix: 'game-ci' */
|
||||
};
|
||||
let logGroupsDescribe = await ecs.describeLogGroups(logStreamInput).promise();
|
||||
|
|
@ -139,9 +139,9 @@ export class AwsCliCommands {
|
|||
|
||||
private static async cleanup(deleteResources = false, OneDayOlderOnly: boolean = false) {
|
||||
Deno.env.set('AWS_REGION', Input.region);
|
||||
const CF = new AWS.CloudFormation();
|
||||
const ecs = new AWS.ECS();
|
||||
const cwl = new AWS.CloudWatchLogs();
|
||||
const CF = new aws.CloudFormation();
|
||||
const ecs = new aws.ECS();
|
||||
const cwl = new aws.CloudWatchLogs();
|
||||
await AwsCliCommands.awsListStacks(async (element) => {
|
||||
if (deleteResources && (!OneDayOlderOnly || AwsCliCommands.isOlderThan1day(element.CreationTime))) {
|
||||
if (element.StackName === 'game-ci' || element.TemplateDescription === 'Game-CI base stack') {
|
||||
|
|
@ -150,7 +150,7 @@ export class AwsCliCommands {
|
|||
return;
|
||||
}
|
||||
CloudRunnerLogger.log(`Deleting ${element.logGroupName}`);
|
||||
const deleteStackInput: AWS.CloudFormation.DeleteStackInput = { StackName: element.StackName };
|
||||
const deleteStackInput: aws.CloudFormation.DeleteStackInput = { StackName: element.StackName };
|
||||
await CF.deleteStack(deleteStackInput).promise();
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import * as SDK from 'aws-sdk';
|
||||
import { aws } from '../../../../dependencies.ts';
|
||||
import CloudRunnerSecret from '../../services/cloud-runner-secret.ts';
|
||||
import CloudRunnerEnvironmentVariable from '../../services/cloud-runner-environment-variable.ts';
|
||||
import CloudRunnerAWSTaskDef from './cloud-runner-aws-task-def.ts';
|
||||
|
|
@ -8,7 +8,7 @@ import BuildParameters from '../../../build-parameters.ts';
|
|||
import CloudRunnerLogger from '../../services/cloud-runner-logger.ts';
|
||||
import { AWSJobStack } from './aws-job-stack.ts';
|
||||
import { AWSBaseStack } from './aws-base-stack.ts';
|
||||
import { Input } from '../../...ts';
|
||||
import { Input } from '../../../index.ts';
|
||||
|
||||
class AWSBuildEnvironment implements ProviderInterface {
|
||||
private baseStackName: string;
|
||||
|
|
@ -47,8 +47,8 @@ class AWSBuildEnvironment implements ProviderInterface {
|
|||
secrets: CloudRunnerSecret[],
|
||||
): Promise<string> {
|
||||
Deno.env.set('AWS_REGION', Input.region);
|
||||
const ECS = new SDK.ECS();
|
||||
const CF = new SDK.CloudFormation();
|
||||
const ECS = new aws.ECS();
|
||||
const CF = new aws.CloudFormation();
|
||||
CloudRunnerLogger.log(`AWS Region: ${CF.config.region}`);
|
||||
const entrypoint = ['/bin/sh'];
|
||||
const startTimeMs = Date.now();
|
||||
|
|
@ -86,7 +86,7 @@ class AWSBuildEnvironment implements ProviderInterface {
|
|||
}
|
||||
}
|
||||
|
||||
async cleanupResources(CF: SDK.CloudFormation, taskDef: CloudRunnerAWSTaskDef) {
|
||||
async cleanupResources(CF: aws.CloudFormation, taskDef: CloudRunnerAWSTaskDef) {
|
||||
CloudRunnerLogger.log('Cleanup starting');
|
||||
await CF.deleteStack({
|
||||
StackName: taskDef.taskDefStackName,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { BuildParameters, Output } from '../../../index.ts';
|
||||
import { core, k8s, waitUntil } from '../../dependencies.ts';
|
||||
import { k8sTypes, core, k8s, waitUntil } from '../../../../dependencies.ts';
|
||||
import { ProviderInterface } from '../provider-interface.ts';
|
||||
import CloudRunnerSecret from '../../services/cloud-runner-secret.ts';
|
||||
import KubernetesStorage from './kubernetes-storage.ts';
|
||||
|
|
@ -12,9 +12,9 @@ import CloudRunnerLogger from '../../services/cloud-runner-logger.ts';
|
|||
import DependencyOverrideService from '../../services/depdency-override-service.ts';
|
||||
|
||||
class Kubernetes implements ProviderInterface {
|
||||
private kubeConfig: k8s.KubeConfig;
|
||||
private kubeClient: k8s.CoreV1Api;
|
||||
private kubeClientBatch: k8s.BatchV1Api;
|
||||
private kubeConfig: k8sTypes.KubeConfig;
|
||||
private kubeClient: k8sTypes.CoreV1Api;
|
||||
private kubeClientBatch: k8sTypes.BatchV1Api;
|
||||
private buildGuid: string = '';
|
||||
private buildParameters: BuildParameters;
|
||||
private pvcName: string = '';
|
||||
|
|
@ -29,7 +29,7 @@ class Kubernetes implements ProviderInterface {
|
|||
constructor(buildParameters: BuildParameters) {
|
||||
this.kubeConfig = new k8s.KubeConfig();
|
||||
this.kubeConfig.loadFromDefault();
|
||||
this.kubeClient = this.kubeConfig.makeApiClient(k8s.CoreV1Api);
|
||||
this.kubeClient = this.kubeConfig.makeApiClient(k8sTypes.CoreV1Api);
|
||||
this.kubeClientBatch = this.kubeConfig.makeApiClient(k8s.BatchV1Api);
|
||||
CloudRunnerLogger.log('Loaded default Kubernetes configuration for this environment');
|
||||
|
||||
|
|
@ -187,7 +187,7 @@ class Kubernetes implements ProviderInterface {
|
|||
process.exit();
|
||||
}
|
||||
|
||||
static async findPodFromJob(kubeClient: k8s.CoreV1Api, jobName: string, namespace: string) {
|
||||
static async findPodFromJob(kubeClient: k8sTypes.CoreV1Api, jobName: string, namespace: string) {
|
||||
const namespacedPods = await kubeClient.listNamespacedPod(namespace);
|
||||
const pod = namespacedPods.body.items.find((x) => x.metadata?.labels?.['job-name'] === jobName);
|
||||
if (pod === undefined) {
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
import { V1EnvVar, V1EnvVarSource, V1SecretKeySelector } from '@kubernetes/client-node';
|
||||
import { V1EnvVar, V1EnvVarSource, V1SecretKeySelector } from '../../../../dependencies.ts';
|
||||
import BuildParameters from '../../../build-parameters.ts';
|
||||
import { CloudRunnerBuildCommandProcessor } from '../../services/cloud-runner-build-command-process.ts';
|
||||
import CloudRunnerEnvironmentVariable from '../../services/cloud-runner-environment-variable';
|
||||
import CloudRunnerSecret from '../../services/cloud-runner-secret';
|
||||
import CloudRunner from '../../cloud-runner';
|
||||
import CloudRunnerEnvironmentVariable from '../../services/cloud-runner-environment-variable.ts';
|
||||
import CloudRunnerSecret from '../../services/cloud-runner-secret.ts';
|
||||
import CloudRunner from '../../cloud-runner.ts';
|
||||
|
||||
class KubernetesJobSpecFactory {
|
||||
static getJobSpec(
|
||||
|
|
@ -114,7 +114,7 @@ class KubernetesJobSpecFactory {
|
|||
},
|
||||
env: [
|
||||
...environment.map((x) => {
|
||||
const environmentVariable = new V1EnvVar();
|
||||
const environmentVariable = new k8s.V1EnvVar();
|
||||
environmentVariable.name = x.name;
|
||||
environmentVariable.value = x.value;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,14 +1,12 @@
|
|||
import { CoreV1Api } from '@kubernetes/client-node';
|
||||
import { k8sTypes, k8s, base64 } from '../../../../dependencies.ts';
|
||||
import CloudRunnerSecret from '../../services/cloud-runner-secret.ts';
|
||||
import * as k8s from '@kubernetes/client-node';
|
||||
const base64 = require('base-64');
|
||||
|
||||
class KubernetesSecret {
|
||||
static async createSecret(
|
||||
secrets: CloudRunnerSecret[],
|
||||
secretName: string,
|
||||
namespace: string,
|
||||
kubeClient: CoreV1Api,
|
||||
kubeClient: k8sTypes.CoreV1Api,
|
||||
) {
|
||||
const secret = new k8s.V1Secret();
|
||||
secret.apiVersion = 'v1';
|
||||
|
|
|
|||
|
|
@ -1,8 +1,7 @@
|
|||
import { CoreV1Api } from '@kubernetes/client-node';
|
||||
import * as k8s from '@kubernetes/client-node';
|
||||
import { k8s, k8sTypes } from '../../../../dependencies.ts';
|
||||
|
||||
class KubernetesServiceAccount {
|
||||
static async createServiceAccount(serviceAccountName: string, namespace: string, kubeClient: CoreV1Api) {
|
||||
static async createServiceAccount(serviceAccountName: string, namespace: string, kubeClient: k8sTypes.CoreV1Api) {
|
||||
const serviceAccount = new k8s.V1ServiceAccount();
|
||||
serviceAccount.apiVersion = 'v1';
|
||||
serviceAccount.kind = 'ServiceAccount';
|
||||
|
|
|
|||
|
|
@ -1,14 +1,12 @@
|
|||
import { k8s, core, YAML } from '../../../../dependencies.ts';
|
||||
import waitUntil from 'async-wait-until';
|
||||
import { k8sTypes, k8s, core, yaml, waitUntil, http } from '../../../../dependencies.ts';
|
||||
import BuildParameters from '../../../build-parameters.ts';
|
||||
import CloudRunnerLogger from '../../services/cloud-runner-logger.ts';
|
||||
import { IncomingMessage } from '../../../node_modules/http';
|
||||
|
||||
class KubernetesStorage {
|
||||
public static async createPersistentVolumeClaim(
|
||||
buildParameters: BuildParameters,
|
||||
pvcName: string,
|
||||
kubeClient: k8s.CoreV1Api,
|
||||
kubeClient: k8sTypes.CoreV1Api,
|
||||
namespace: string,
|
||||
) {
|
||||
if (buildParameters.kubeVolume) {
|
||||
|
|
@ -35,7 +33,7 @@ class KubernetesStorage {
|
|||
await KubernetesStorage.handleResult(result, kubeClient, namespace, pvcName);
|
||||
}
|
||||
|
||||
public static async getPVCPhase(kubeClient: k8s.CoreV1Api, name: string, namespace: string) {
|
||||
public static async getPVCPhase(kubeClient: k8sTypes.CoreV1Api, name: string, namespace: string) {
|
||||
try {
|
||||
return (await kubeClient.readNamespacedPersistentVolumeClaim(name, namespace)).body.status?.phase;
|
||||
} catch (error) {
|
||||
|
|
@ -45,7 +43,7 @@ class KubernetesStorage {
|
|||
}
|
||||
}
|
||||
|
||||
public static async watchUntilPVCNotPending(kubeClient: k8s.CoreV1Api, name: string, namespace: string) {
|
||||
public static async watchUntilPVCNotPending(kubeClient: k8sTypes.CoreV1Api, name: string, namespace: string) {
|
||||
try {
|
||||
CloudRunnerLogger.log(`watch Until PVC Not Pending ${name} ${namespace}`);
|
||||
CloudRunnerLogger.log(`${await this.getPVCPhase(kubeClient, name, namespace)}`);
|
||||
|
|
@ -75,7 +73,7 @@ class KubernetesStorage {
|
|||
private static async createPVC(
|
||||
pvcName: string,
|
||||
buildParameters: BuildParameters,
|
||||
kubeClient: k8s.CoreV1Api,
|
||||
kubeClient: k8sTypes.CoreV1Api,
|
||||
namespace: string,
|
||||
) {
|
||||
const pvc = new k8s.V1PersistentVolumeClaim();
|
||||
|
|
@ -94,7 +92,7 @@ class KubernetesStorage {
|
|||
},
|
||||
};
|
||||
if (Deno.env.get('K8s_STORAGE_PVC_SPEC')) {
|
||||
YAML.parse(Deno.env.get('K8s_STORAGE_PVC_SPEC'));
|
||||
yaml.parse(Deno.env.get('K8s_STORAGE_PVC_SPEC'));
|
||||
}
|
||||
const result = await kubeClient.createNamespacedPersistentVolumeClaim(namespace, pvc);
|
||||
|
||||
|
|
@ -102,8 +100,8 @@ class KubernetesStorage {
|
|||
}
|
||||
|
||||
private static async handleResult(
|
||||
result: { response: IncomingMessage; body: k8s.V1PersistentVolumeClaim },
|
||||
kubeClient: k8s.CoreV1Api,
|
||||
result: { response: http.IncomingMessage; body: k8s.V1PersistentVolumeClaim },
|
||||
kubeClient: k8sTypes.CoreV1Api,
|
||||
namespace: string,
|
||||
pvcName: string,
|
||||
) {
|
||||
|
|
|
|||
|
|
@ -1,13 +1,12 @@
|
|||
import { CoreV1Api, KubeConfig, Log } from '@kubernetes/client-node';
|
||||
import CloudRunnerLogger from '../../services/cloud-runner-logger.ts';
|
||||
import { core, Writable, waitUntil } from '../../../../dependencies.ts';
|
||||
import { k8sTypes, k8s, core, Writable, waitUntil } from '../../../../dependencies.ts';
|
||||
import { CloudRunnerStatics } from '../../cloud-runner-statics.ts';
|
||||
import { FollowLogStreamService } from '../../services/follow-log-stream-service.ts';
|
||||
|
||||
class KubernetesTaskRunner {
|
||||
static async runTask(
|
||||
kubeConfig: KubeConfig,
|
||||
kubeClient: CoreV1Api,
|
||||
kubeConfig: k8sTypes.KubeConfig,
|
||||
kubeClient: k8sTypes.CoreV1Api,
|
||||
jobName: string,
|
||||
podName: string,
|
||||
containerName: string,
|
||||
|
|
@ -38,7 +37,7 @@ class KubernetesTaskRunner {
|
|||
};
|
||||
try {
|
||||
const resultError = await new Promise((resolve) =>
|
||||
new Log(kubeConfig).log(namespace, podName, containerName, stream, resolve, logOptions),
|
||||
new k8s.Log(kubeConfig).log(namespace, podName, containerName, stream, resolve, logOptions),
|
||||
);
|
||||
stream.destroy();
|
||||
if (resultError) {
|
||||
|
|
@ -78,7 +77,7 @@ class KubernetesTaskRunner {
|
|||
return output;
|
||||
}
|
||||
|
||||
static async watchUntilPodRunning(kubeClient: CoreV1Api, podName: string, namespace: string) {
|
||||
static async watchUntilPodRunning(kubeClient: k8sTypes.CoreV1Api, podName: string, namespace: string) {
|
||||
let success: boolean = false;
|
||||
CloudRunnerLogger.log(`Watching ${podName} ${namespace}`);
|
||||
await waitUntil(
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { BuildParameters } from '../../index.ts';
|
||||
import YAML from '../../../../node_modules/yaml';
|
||||
import { yaml } from '../../../dependencies.ts';
|
||||
import CloudRunnerSecret from './cloud-runner-secret.ts';
|
||||
import CloudRunner from '../cloud-runner.ts';
|
||||
|
||||
|
|
@ -25,7 +25,7 @@ export class CloudRunnerBuildCommandProcessor {
|
|||
let output = new Array<Hook>();
|
||||
if (experimentHooks && experimentHooks !== '') {
|
||||
try {
|
||||
output = YAML.parse(experimentHooks);
|
||||
output = yaml.parse(experimentHooks);
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import * as path from 'https://deno.land/std@0.141.0/path/mod.ts';
|
||||
import { CloudRunner } from '../...ts';
|
||||
import { path } from '../../../dependencies.ts';
|
||||
import { CloudRunner } from '../../index.ts';
|
||||
|
||||
export class CloudRunnerFolders {
|
||||
public static readonly repositoryFolder = 'repo';
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { core } from '../../dependencies.ts';
|
||||
import { core } from '../../../dependencies.ts';
|
||||
|
||||
class CloudRunnerLogger {
|
||||
private static timestamp: number;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { exec } from '../../../../node_modules/child_process';
|
||||
import { exec } from '../../../dependencies.ts';
|
||||
import { RemoteClientLogger } from '../remote-client/remote-client-logger.ts';
|
||||
|
||||
export class CloudRunnerSystem {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import CloudRunnerLogger from './cloud-runner-logger.ts';
|
||||
import { core } from '../../dependencies.ts';
|
||||
import { core } from '../../../dependencies.ts';
|
||||
import CloudRunner from '../cloud-runner.ts';
|
||||
import { CloudRunnerStatics } from '../cloud-runner-statics.ts';
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import CloudRunnerLogger from '../services/cloud-runner-logger.ts';
|
||||
import CloudRunnerSecret from '../services/cloud-runner-secret.ts';
|
||||
import { CloudRunnerFolders } from '../services/cloud-runner-folders.ts';
|
||||
import YAML from '../../../../node_modules/yaml';
|
||||
import { yaml } from '../../../dependencies.ts';
|
||||
import { CloudRunner, Input } from '../../index.ts';
|
||||
|
||||
export class CustomWorkflow {
|
||||
|
|
@ -12,7 +12,7 @@ export class CustomWorkflow {
|
|||
CloudRunnerLogger.log(`Parsing build steps: ${buildSteps}`);
|
||||
}
|
||||
try {
|
||||
buildSteps = YAML.parse(buildSteps);
|
||||
buildSteps = yaml.parse(buildSteps);
|
||||
} catch (error) {
|
||||
CloudRunnerLogger.log(`failed to parse a custom job "${buildSteps}"`);
|
||||
throw error;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { fsSync as fs, path, YAML, __dirname } from '../../dependencies.ts';
|
||||
import { fsSync as fs, path, yaml, __dirname } from '../../dependencies.ts';
|
||||
|
||||
export class ActionYamlReader {
|
||||
private actionYamlParsed: any;
|
||||
|
|
@ -7,7 +7,7 @@ export class ActionYamlReader {
|
|||
if (!fs.existsSync(filename)) {
|
||||
filename = path.join(__dirname, `..`, filename);
|
||||
}
|
||||
this.actionYamlParsed = YAML.parse(fs.readFileSync(filename).toString());
|
||||
this.actionYamlParsed = yaml.parse(fs.readFileSync(filename).toString());
|
||||
}
|
||||
public GetActionYamlValue(key: string) {
|
||||
return this.actionYamlParsed.inputs[key]?.description || 'No description found in action.yml';
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { fsSync as fs, path, YAML, __dirname } from '../../dependencies.ts';
|
||||
import { fsSync as fs, path, yaml, __dirname } from '../../dependencies.ts';
|
||||
import Input from '../input.ts';
|
||||
|
||||
export function ReadLicense() {
|
||||
|
|
@ -7,5 +7,5 @@ export function ReadLicense() {
|
|||
}
|
||||
const pipelineFile = path.join(__dirname, `.github`, `workflows`, `cloud-runner-k8s-pipeline.yml`);
|
||||
|
||||
return fs.existsSync(pipelineFile) ? YAML.parse(fs.readFileSync(pipelineFile, 'utf8')).env.UNITY_LICENSE : '';
|
||||
return fs.existsSync(pipelineFile) ? yaml.parse(fs.readFileSync(pipelineFile, 'utf8')).env.UNITY_LICENSE : '';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,8 @@
|
|||
import { fs, path } from '../dependencies.ts';
|
||||
import { fs, path, core } from '../dependencies.ts';
|
||||
import { Cli } from './cli/cli.ts';
|
||||
import CloudRunnerQueryOverride from './cloud-runner/services/cloud-runner-query-override.ts';
|
||||
import Platform from './platform.ts';
|
||||
|
||||
const core = require('@actions/core');
|
||||
|
||||
/**
|
||||
* Input variables specified in workflows using "with" prop.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { exec } from '../../../node_modules/@actions/exec';
|
||||
import { exec } from '../dependencies.ts';
|
||||
import { BuildParameters } from './build-parameters.ts';
|
||||
|
||||
class MacBuilder {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
const core = require('@actions/core');
|
||||
import { core } from '../dependencies.ts';
|
||||
|
||||
class Output {
|
||||
static async setBuildVersion(buildVersion) {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { BuildParameters } from '../index.ts';
|
||||
import { fsSync as fs, exec, getUnityChangeset } from '../../dependencies.ts';
|
||||
import { fsSync as fs, exec, getUnityChangeSet } from '../../dependencies.ts';
|
||||
|
||||
class SetupMac {
|
||||
static unityHubPath = `"/Applications/Unity Hub.app/Contents/MacOS/Unity Hub"`;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { core } from '../../dependencies.ts';
|
||||
import { core } from '../dependencies.ts';
|
||||
import NotImplementedException from './error/not-implemented-exception.ts';
|
||||
import ValidationError from './error/validation-error.ts';
|
||||
import Input from './input.ts';
|
||||
|
|
|
|||
Loading…
Reference in New Issue