mirror of
https://github.com/Azure/k8s-deploy.git
synced 2026-04-11 16:52:18 +08:00
bug fixes
This commit is contained in:
parent
faf09632f3
commit
c3ad59d720
@ -38,7 +38,7 @@ function getWorkflowAnnotationsJson(lastSuccessRunSha, workflowFilePath, filePat
|
||||
+ `'lastSuccessRunCommit': '${lastSuccessRunSha}',`
|
||||
+ `'branch': '${process.env.GITHUB_REF}',`
|
||||
+ `'deployTimestamp': '${Date.now()}',`
|
||||
+ `'filePathConfigs': '${JSON.stringify(filePathConfigs)}',`
|
||||
+ `'filePathConfigs': ${JSON.stringify(filePathConfigs)},`
|
||||
+ `'provider': 'GitHub'`
|
||||
+ `}`;
|
||||
}
|
||||
|
||||
@ -148,8 +148,8 @@ function getFilePathsConfigs() {
|
||||
const DOCKERFILE_PATH_LABEL_KEY = 'dockerfile-path';
|
||||
const DOCKERFILE_PATH_KEY = 'dockerfilePath';
|
||||
const CONTAINER_REG_KEY = 'containerRegistryServer';
|
||||
let inputManifestFiles = inputParams.manifests;
|
||||
filePathsConfig[MANIFEST_PATHS_KEY] = inputManifestFiles || '';
|
||||
let inputManifestFiles = inputParams.manifests || [];
|
||||
filePathsConfig[MANIFEST_PATHS_KEY] = inputManifestFiles;
|
||||
let helmChartPath = process.env.HELM_CHART_PATH || '';
|
||||
filePathsConfig[HELM_CHART_KEY] = helmChartPath;
|
||||
//Fetch labels from each image
|
||||
@ -180,19 +180,24 @@ function getFilePathsConfigs() {
|
||||
if (res.stderr != '' && !res.success) {
|
||||
throw new Error(`docker inspect call failed with: ${res.stderr.match(/(.*)\s*$/)[0]}`);
|
||||
}
|
||||
resultObj = JSON.parse(res.stdout)[0];
|
||||
if (res.stdout != null && res.stdout != '') {
|
||||
resultObj = JSON.parse(res.stdout);
|
||||
}
|
||||
});
|
||||
}
|
||||
catch (ex) {
|
||||
core.warning(`Failed to get dockerfile paths for image ${image.toString()} | ` + ex);
|
||||
}
|
||||
if (resultObj != null && resultObj.Config != null && resultObj.Config.Labels != null) {
|
||||
if (resultObj.Config.Labels[DOCKERFILE_PATH_LABEL_KEY] != null) {
|
||||
if (resultObj != null) {
|
||||
resultObj = resultObj[0];
|
||||
if (resultObj.Config != null && resultObj.Config.Labels != null && resultObj.Config.Labels[DOCKERFILE_PATH_LABEL_KEY] != null) {
|
||||
buildConfigMap[DOCKERFILE_PATH_KEY] = resultObj.Config.Labels[DOCKERFILE_PATH_LABEL_KEY];
|
||||
}
|
||||
//Add CR server name to build config
|
||||
buildConfigMap[CONTAINER_REG_KEY] = containerRegistryName;
|
||||
imageToBuildConfigMap[resultObj.Id] = buildConfigMap;
|
||||
if (resultObj.Id != null) {
|
||||
imageToBuildConfigMap[resultObj.Id] = buildConfigMap;
|
||||
}
|
||||
}
|
||||
}
|
||||
filePathsConfig[BUILD_CONFIG_KEY] = imageToBuildConfigMap;
|
||||
|
||||
@ -38,7 +38,7 @@ export function getWorkflowAnnotationsJson(lastSuccessRunSha: string, workflowFi
|
||||
+ `'lastSuccessRunCommit': '${lastSuccessRunSha}',`
|
||||
+ `'branch': '${process.env.GITHUB_REF}',`
|
||||
+ `'deployTimestamp': '${Date.now()}',`
|
||||
+ `'filePathConfigs': '${JSON.stringify(filePathConfigs)}',`
|
||||
+ `'filePathConfigs': ${JSON.stringify(filePathConfigs)},`
|
||||
+ `'provider': 'GitHub'`
|
||||
+ `}`;
|
||||
}
|
||||
|
||||
@ -139,8 +139,8 @@ export async function getFilePathsConfigs(): Promise<any> {
|
||||
const DOCKERFILE_PATH_KEY = 'dockerfilePath';
|
||||
const CONTAINER_REG_KEY = 'containerRegistryServer';
|
||||
|
||||
let inputManifestFiles = inputParams.manifests;
|
||||
filePathsConfig[MANIFEST_PATHS_KEY] = inputManifestFiles || '';
|
||||
let inputManifestFiles = inputParams.manifests || [];
|
||||
filePathsConfig[MANIFEST_PATHS_KEY] = inputManifestFiles;
|
||||
|
||||
let helmChartPath = process.env.HELM_CHART_PATH || '';
|
||||
filePathsConfig[HELM_CHART_KEY] = helmChartPath;
|
||||
@ -179,23 +179,31 @@ export async function getFilePathsConfigs(): Promise<any> {
|
||||
if (res.stderr != '' && !res.success) {
|
||||
throw new Error(`docker inspect call failed with: ${res.stderr.match(/(.*)\s*$/)![0]}`);
|
||||
}
|
||||
resultObj = JSON.parse(res.stdout)[0];
|
||||
|
||||
if(res.stdout!= null && res.stdout != ''){
|
||||
resultObj = JSON.parse(res.stdout);
|
||||
}
|
||||
});
|
||||
}
|
||||
catch (ex) {
|
||||
core.warning(`Failed to get dockerfile paths for image ${image.toString()} | ` + ex);
|
||||
}
|
||||
|
||||
if(resultObj != null && resultObj.Config != null && resultObj.Config.Labels != null ){
|
||||
if(resultObj.Config.Labels[DOCKERFILE_PATH_LABEL_KEY] !=null){
|
||||
if(resultObj != null){
|
||||
resultObj = resultObj[0];
|
||||
|
||||
if(resultObj.Config != null && resultObj.Config.Labels != null && resultObj.Config.Labels[DOCKERFILE_PATH_LABEL_KEY] !=null){
|
||||
buildConfigMap[DOCKERFILE_PATH_KEY] = resultObj.Config.Labels[DOCKERFILE_PATH_LABEL_KEY];
|
||||
}
|
||||
|
||||
//Add CR server name to build config
|
||||
buildConfigMap[CONTAINER_REG_KEY] = containerRegistryName;
|
||||
imageToBuildConfigMap[resultObj.Id] = buildConfigMap;
|
||||
if(resultObj.Id != null){
|
||||
imageToBuildConfigMap[resultObj.Id] = buildConfigMap;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
filePathsConfig[BUILD_CONFIG_KEY] = imageToBuildConfigMap;
|
||||
|
||||
return Promise.resolve(filePathsConfig);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user