Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added advanced input field Packer version, used to build the image. #10413

Merged
merged 12 commits into from
Jun 7, 2019
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,5 @@
"loc.messages.CouldNotFetchAccessTokenforMSIDueToMSINotConfiguredProperlyStatusCode": "Could not fetch access token for Managed Service Principal. Please configure Managed Service Identity (MSI) for virtual machine 'https://aka.ms/azure-msi-docs'. Status code: %s, status message: %s",
"loc.messages.CouldNotFetchAccessTokenforMSIStatusCode": "Could not fetch access token for Managed Service Principal. Status code: %s, status message: %s",
"loc.messages.CreateManagedImageNotSupportedForVHDSource": "Creating managed image from a source VHD is not supported. You must set 'Base image source' input value to 'Gallery'.",
"loc.messages.ExpiredServicePrincipal": "Could not fetch access token for Azure. Verify if the Service Principal used is valid and not expired.",
"loc.messages.ResolvedPackerVersion": "Resolved packer build version: %s",
"loc.messages.ResolvingPackerVersionInput": "Resolving packer build version"
"loc.messages.ExpiredServicePrincipal": "Could not fetch access token for Azure. Verify if the Service Principal used is valid and not expired."
}
7 changes: 4 additions & 3 deletions Tasks/PackerBuildV1/src/packerHost.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,10 @@ export default class PackerHost implements definitions.IPackerHost {
var installedPackerPath = tl.which("packer", false);
var installedPackerVersion = this._getPackerVersion(installedPackerPath);
console.log(tl.loc("InstalledPackerVersion", installedPackerVersion));

var packerVersionString = this._taskParameters.packerVersionString ? this._taskParameters.packerVersionString : constants.CurrentSupportedPackerVersionString;

var packerVersionString = constants.CurrentSupportedPackerVersionString;
if(this._taskParameters.templateType == constants.TemplateTypeCustom) {
packerVersionString = this._taskParameters.packerVersionString ? this._taskParameters.packerVersionString : constants.CurrentSupportedPackerVersionString;
}
if(!installedPackerVersion ||
utils.isGreaterVersion(utils.PackerVersion.convertFromString(packerVersionString), utils.PackerVersion.convertFromString(installedPackerVersion))) {
anuragc617 marked this conversation as resolved.
Show resolved Hide resolved

Expand Down
5 changes: 1 addition & 4 deletions Tasks/PackerBuildV1/src/taskParameters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export default class TaskParameters {
this.customTemplateLocation = tl.getPathInput(constants.CustomTemplateLocationInputType, true, true);
console.log(tl.loc("ParsingCustomTemplateParameters"));
this.customTemplateParameters = JSON.parse(tl.getInput("customTemplateParameters"));
this.packerVersionString = tl.getInput(constants.PackerVersionInputName);
anuragc617 marked this conversation as resolved.
Show resolved Hide resolved
} else {
this.serviceEndpoint = tl.getInput(constants.ConnectedServiceInputName, true);
this.resourceGroup = tl.getInput(constants.ResourceGroupInputName, true);
Expand Down Expand Up @@ -86,10 +87,6 @@ export default class TaskParameters {

anuragc617 marked this conversation as resolved.
Show resolved Hide resolved
}

console.log(tl.loc("ResolvingPackerVersionInput"))
this.packerVersionString = tl.getInput(constants.PackerVersionInputName);
console.log(tl.loc("ResolvedPackerVersion", this.packerVersionString));

console.log(tl.loc("ParsingAdditionalBuilderParameters"));
this.additionalBuilderParameters = JSON.parse(tl.getInput("additionalBuilderParameters"));
this.skipTempFileCleanupDuringVMDeprovision = tl.getBoolInput("skipTempFileCleanupDuringVMDeprovision", false);
Expand Down
7 changes: 3 additions & 4 deletions Tasks/PackerBuildV1/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"version": {
"Major": 1,
"Minor": 0,
"Patch": 13
"Patch": 16
},
"demands": [],
"minimumAgentVersion": "2.0.0",
Expand Down Expand Up @@ -245,6 +245,7 @@
"required": false,
"defaultValue": "",
"groupName": "Advanced",
"visibleRule": "templateType = custom",
"helpMarkDown": "Specify the version of Packer to install."
anuragc617 marked this conversation as resolved.
Show resolved Hide resolved
},
{
Expand Down Expand Up @@ -345,8 +346,6 @@
"CouldNotFetchAccessTokenforMSIDueToMSINotConfiguredProperlyStatusCode": "Could not fetch access token for Managed Service Principal. Please configure Managed Service Identity (MSI) for virtual machine 'https://aka.ms/azure-msi-docs'. Status code: %s, status message: %s",
"CouldNotFetchAccessTokenforMSIStatusCode": "Could not fetch access token for Managed Service Principal. Status code: %s, status message: %s",
"CreateManagedImageNotSupportedForVHDSource": "Creating managed image from a source VHD is not supported. You must set 'Base image source' input value to 'Gallery'.",
"ExpiredServicePrincipal": "Could not fetch access token for Azure. Verify if the Service Principal used is valid and not expired.",
"ResolvedPackerVersion": "Resolved packer build version: %s",
"ResolvingPackerVersionInput": "Resolving packer build version"
"ExpiredServicePrincipal": "Could not fetch access token for Azure. Verify if the Service Principal used is valid and not expired."
}
}
7 changes: 3 additions & 4 deletions Tasks/PackerBuildV1/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"version": {
"Major": 1,
"Minor": 0,
"Patch": 13
"Patch": 16
},
"demands": [],
"minimumAgentVersion": "2.0.0",
Expand Down Expand Up @@ -245,6 +245,7 @@
"required": false,
"defaultValue": "",
"groupName": "Advanced",
"visibleRule": "templateType = custom",
"helpMarkDown": "ms-resource:loc.input.help.packerVersion"
},
{
Expand Down Expand Up @@ -345,8 +346,6 @@
"CouldNotFetchAccessTokenforMSIDueToMSINotConfiguredProperlyStatusCode": "ms-resource:loc.messages.CouldNotFetchAccessTokenforMSIDueToMSINotConfiguredProperlyStatusCode",
"CouldNotFetchAccessTokenforMSIStatusCode": "ms-resource:loc.messages.CouldNotFetchAccessTokenforMSIStatusCode",
"CreateManagedImageNotSupportedForVHDSource": "ms-resource:loc.messages.CreateManagedImageNotSupportedForVHDSource",
"ExpiredServicePrincipal": "ms-resource:loc.messages.ExpiredServicePrincipal",
"ResolvedPackerVersion": "ms-resource:loc.messages.ResolvedPackerVersion",
"ResolvingPackerVersionInput": "ms-resource:loc.messages.ResolvingPackerVersionInput"
"ExpiredServicePrincipal": "ms-resource:loc.messages.ExpiredServicePrincipal"
}
}