Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// get app kind
if(!!taskParams.endpoint) {
await taskParams.getResourceDetails();
type = DEPLOYMENT_PROVIDER_TYPES.SPN;
}
var deploymentProvider = new WebAppDeploymentProvider(type);
core.debug("Predeployment Step Started");
await deploymentProvider.PreDeploymentStep();
core.debug("Deployment Step Started");
await deploymentProvider.DeployWebAppStep();
}
catch(error) {
isDeploymentSuccess = false;
core.error("Deployment Failed with Error: " + error);
core.setFailed(error);
}
finally {
if(deploymentProvider != null) {
await deploymentProvider.UpdateDeploymentStatus(isDeploymentSuccess);
}
// Reset AZURE_HTTP_USER_AGENT
core.exportVariable('AZURE_HTTP_USER_AGENT', prefix);
core.debug(isDeploymentSuccess ? "Deployment Succeeded" : "Deployment failed");
}
}
}
podStatus = getPodStatus(kubectl, podName);
switch (podStatus.phase) {
case 'Succeeded':
case 'Running':
if (isPodReady(podStatus)) {
console.log(`pod/${podName} is successfully rolled out`);
}
break;
case 'Pending':
if (!isPodReady(podStatus)) {
core.warning(`pod/${podName} rollout status check timedout`);
}
break;
case 'Failed':
core.error(`pod/${podName} rollout failed`);
break;
default:
core.warning(`pod/${podName} rollout status: ${podStatus.phase}`);
}
}
function setFailed(error) {
core.error(error);
core.setFailed(error.message);
}
stderr: (data) => { core.error(data.toString()) }
}
throw new Error(`Coverage run exited with code ${lastExitCode}`);
}
debug('✅ Coverage run completed...');
} catch (err) {
error(err);
setFailed('🚨 Coverage run failed!');
return reject(err);
}
try {
const commands = ['after-build', '--exit-code', lastExitCode.toString()];
if (codeClimateDebug === 'true') commands.push('--debug');
await exec(executable, commands, execOpts);
debug('✅ CC Reporter after-build checkin completed!');
return resolve();
} catch (err) {
error(err);
setFailed('🚨 CC Reporter after-build checkin failed!');
return reject(err);
}
});
}
...context.repo,
deployment_id: context.payload.deployment.id,
state,
log_url: url,
target_url: url,
description,
};
if (env) {
params.environment = env;
}
if (envUrl) {
params.environment_url = envUrl;
}
await client.repos.createDeploymentStatus(params);
} catch (error) {
core.error(error);
core.setFailed(error.message);
}
}
core.info('\nAnalyzing image: ' + imageReference);
await exec(cmd);
let rawdata = fs.readFileSync('./anchore-reports/policy_evaluation.json');
let policyEval = JSON.parse(rawdata);
let imageId = Object.keys(policyEval[0]);
let imageTag = Object.keys(policyEval[0][imageId[0]]);
let policyStatus = policyEval[0][imageId[0]][imageTag][0]['status'];
try {
let billOfMaterials = {
"packages": mergeResults(loadContent(findContent("./anchore-reports/")))
};
fs.writeFileSync(billOfMaterialsPath, JSON.stringify(billOfMaterials));
} catch (error) {
core.error("Error constructing bill of materials from anchore output: " + error);
throw error;
}
core.setOutput('billofmaterials', billOfMaterialsPath);
core.setOutput('vulnerabilities', './anchore-reports/vulnerabilities.json');
core.setOutput('policycheck', policyStatus);
if (failBuild === "true" && policyStatus === "fail") {
core.setFailed("Image failed Anchore policy evaluation");
}
} catch (error) {
core.setFailed(error.message);
}
}
const branchErrors = validateBaseBranch(pr.title, pr.baseRefName);
if (titleErrors.length) {
core.setFailed(titleErrors.join('\n'));
}
if (bodyErrors.length) {
core.setFailed(bodyErrors.join('\n'));
}
if (branchErrors.length) {
core.setFailed(branchErrors.join('\n'));
}
}
} catch (err) {
core.error(err);
core.setFailed('Error getting Pull Request data.');
}
}
function setFailed(error) {
core.error(error);
core.setFailed(error.message);
}
private async initializeForPublishProfile() {
let scmCreds: scmCredentials;
try {
scmCreds = await this.getCredsFromXml(TaskParameters.getTaskParams().publishProfileContent);
} catch(error) {
core.error("Failed to fetch credentials from Publish Profile. For more details on how to set publish profile credentials refer https://aka.ms/create-secrets-for-GitHub-workflows");
throw error;
}
this.kuduService = new Kudu(scmCreds.uri, scmCreds.username, scmCreds.password);
this.kuduServiceUtility = new KuduServiceUtility(this.kuduService);
}