in azurecontainerapps.ts [143:198]
private static validateSupportedScenarioArguments() {
// Get the path to the application source to build and run, if provided
this.appSourcePath = this.toolHelper.getInput('appSourcePath', false) as string;
// Get the name of the ACR instance to push images to, if provided
this.acrName = this.toolHelper.getInput('acrName', false) as string;
// Get the name of the RegistryUrl to push images to, if provided
this.registryUrl = this.toolHelper.getInput('registryUrl', false) as string;
// Get the previously built image to deploy, if provided
this.imageToDeploy = this.toolHelper.getInput('imageToDeploy', false) as string;
// Get the YAML configuration file, if provided
this.yamlConfigPath = this.toolHelper.getInput('yamlConfigPath', false) as string;
// Get the name of the image to build if it was provided, or generate it from build variables
this.imageToBuild = this.toolHelper.getInput('imageToBuild', false);
// Get the user defined build arguments, if provided
this.buildArguments = this.toolHelper.getInput('buildArguments', false);
// Ensure that one of appSourcePath, imageToDeploy, or yamlConfigPath is provided
if (this.util.isNullOrEmpty(this.appSourcePath) && this.util.isNullOrEmpty(this.imageToDeploy) && this.util.isNullOrEmpty(this.yamlConfigPath)) {
let requiredArgumentMessage = `One of the following arguments must be provided: 'appSourcePath', 'imageToDeploy', or 'yamlConfigPath'.`;
this.toolHelper.writeError(requiredArgumentMessage);
throw Error(requiredArgumentMessage);
}
// Ensure that an ACR name and registry URL are not both provided
if (!this.util.isNullOrEmpty(this.acrName) && !this.util.isNullOrEmpty(this.registryUrl)) {
let conflictingArgumentsMessage = `The 'acrName' and 'registryUrl' arguments cannot both be provided.`;
this.toolHelper.writeError(conflictingArgumentsMessage);
throw Error(conflictingArgumentsMessage);
}
// Set up the build arguments to pass to the Dockerfile or builder
if (!this.util.isNullOrEmpty(this.buildArguments)) {
// Ensure that the build arguments are in the format 'key1=value1 key2=value2'
const buildArguments = this.buildArguments.match(buildArgumentRegex);
let invalidBuildArgumentsMessage = `The 'buildArguments' argument must be in the format 'key1=value1 key2=value2'.`;
const invalidBuildArguments = buildArguments.some(variable => {
if (!this.util.isNullOrEmpty(variable)) {
return variable.indexOf('=') === -1;
}
else {
return false;
}
});
if (invalidBuildArguments) {
this.toolHelper.writeError(invalidBuildArgumentsMessage);
throw Error(invalidBuildArgumentsMessage);
}
}
}