mirror of
https://github.com/Azure/k8s-deploy.git
synced 2026-04-11 16:52:18 +08:00
Review comment changes
This commit is contained in:
parent
d8b8394d0c
commit
87732d1861
@ -150,8 +150,8 @@ function getFilePathsConfigs() {
|
||||
const CONTAINER_REG_KEY = 'containerRegistryServer';
|
||||
let inputManifestFiles = inputParams.manifests || [];
|
||||
filePathsConfig[MANIFEST_PATHS_KEY] = JSON.stringify(inputManifestFiles);
|
||||
let helmChartPath = process.env.HELM_CHART_PATH || '';
|
||||
filePathsConfig[HELM_CHART_KEY] = helmChartPath;
|
||||
let helmChartPaths = process.env.HELM_CHART_PATHS || '';
|
||||
filePathsConfig[HELM_CHART_KEY] = helmChartPaths;
|
||||
//Fetch labels from each image
|
||||
let imageToBuildConfigMap = {};
|
||||
let imageNames = core.getInput('images').split('\n');
|
||||
@ -180,7 +180,7 @@ function getFilePathsConfigs() {
|
||||
if (res.stderr != '' && !res.success) {
|
||||
throw new Error(`docker inspect call failed with: ${res.stderr.match(/(.*)\s*$/)[0]}`);
|
||||
}
|
||||
if (res.stdout != null && res.stdout != '') {
|
||||
if (!res.stdout) {
|
||||
resultObj = JSON.parse(res.stdout);
|
||||
}
|
||||
});
|
||||
@ -188,14 +188,14 @@ function getFilePathsConfigs() {
|
||||
catch (ex) {
|
||||
core.warning(`Failed to get dockerfile paths for image ${image.toString()} | ` + ex);
|
||||
}
|
||||
if (resultObj != null) {
|
||||
if (!resultObj) {
|
||||
resultObj = resultObj[0];
|
||||
if (resultObj.Config != null && resultObj.Config.Labels != null && resultObj.Config.Labels[DOCKERFILE_PATH_LABEL_KEY] != null) {
|
||||
if (!(resultObj.Config) && !(resultObj.Config.Labels) && !(resultObj.Config.Labels[DOCKERFILE_PATH_LABEL_KEY])) {
|
||||
buildConfigMap[DOCKERFILE_PATH_KEY] = resultObj.Config.Labels[DOCKERFILE_PATH_LABEL_KEY];
|
||||
}
|
||||
//Add CR server name to build config
|
||||
buildConfigMap[CONTAINER_REG_KEY] = containerRegistryName;
|
||||
if (resultObj.Id != null) {
|
||||
if (!resultObj.Id) {
|
||||
imageToBuildConfigMap[resultObj.Id] = buildConfigMap;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
import * as aexec from '@actions/exec';
|
||||
import {ExecOptions} from '@actions/exec';
|
||||
|
||||
export interface ExecResult {
|
||||
success: boolean;
|
||||
@ -11,7 +10,7 @@ export const exec = async (command: string, args: string[] = [], silent?: boolea
|
||||
let stdout: string = '';
|
||||
let stderr: string = '';
|
||||
|
||||
const options: ExecOptions = {
|
||||
const options: aexec.ExecOptions = {
|
||||
silent: silent,
|
||||
ignoreReturnCode: true
|
||||
};
|
||||
|
||||
@ -142,8 +142,8 @@ export async function getFilePathsConfigs(): Promise<any> {
|
||||
let inputManifestFiles = inputParams.manifests || [];
|
||||
filePathsConfig[MANIFEST_PATHS_KEY] = JSON.stringify(inputManifestFiles);
|
||||
|
||||
let helmChartPath = process.env.HELM_CHART_PATH || '';
|
||||
filePathsConfig[HELM_CHART_KEY] = helmChartPath;
|
||||
let helmChartPaths = process.env.HELM_CHART_PATHS || '';
|
||||
filePathsConfig[HELM_CHART_KEY] = helmChartPaths;
|
||||
|
||||
//Fetch labels from each image
|
||||
let imageToBuildConfigMap: any = {};
|
||||
@ -156,7 +156,6 @@ export async function getFilePathsConfigs(): Promise<any> {
|
||||
let containerRegistryName = image.toString().split('/')[0];
|
||||
|
||||
try{
|
||||
|
||||
let usrname = process.env.CR_USERNAME || null;
|
||||
let pwd = process.env.CR_PASSWORD || null;
|
||||
if(pwd && usrname)
|
||||
@ -180,7 +179,7 @@ export async function getFilePathsConfigs(): Promise<any> {
|
||||
throw new Error(`docker inspect call failed with: ${res.stderr.match(/(.*)\s*$/)![0]}`);
|
||||
}
|
||||
|
||||
if(res.stdout!= null && res.stdout != ''){
|
||||
if(!res.stdout){
|
||||
resultObj = JSON.parse(res.stdout);
|
||||
}
|
||||
});
|
||||
@ -189,16 +188,16 @@ export async function getFilePathsConfigs(): Promise<any> {
|
||||
core.warning(`Failed to get dockerfile paths for image ${image.toString()} | ` + ex);
|
||||
}
|
||||
|
||||
if(resultObj != null){
|
||||
if(!resultObj){
|
||||
resultObj = resultObj[0];
|
||||
|
||||
if(resultObj.Config != null && resultObj.Config.Labels != null && resultObj.Config.Labels[DOCKERFILE_PATH_LABEL_KEY] !=null){
|
||||
if(!(resultObj.Config) && !(resultObj.Config.Labels) && !(resultObj.Config.Labels[DOCKERFILE_PATH_LABEL_KEY])){
|
||||
buildConfigMap[DOCKERFILE_PATH_KEY] = resultObj.Config.Labels[DOCKERFILE_PATH_LABEL_KEY];
|
||||
}
|
||||
|
||||
//Add CR server name to build config
|
||||
buildConfigMap[CONTAINER_REG_KEY] = containerRegistryName;
|
||||
if(resultObj.Id != null){
|
||||
if(!resultObj.Id){
|
||||
imageToBuildConfigMap[resultObj.Id] = buildConfigMap;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user