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

[KubernetesManifestV0] Bug fixes #10102

Merged
merged 2 commits into from
Apr 12, 2019
Merged
Show file tree
Hide file tree
Changes from all 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 @@ -3,14 +3,12 @@
"loc.helpMarkDown": "[More Information](https://go.microsoft.com/fwlink/?linkid=851275)",
"loc.description": "Use Kubernetes manifest files to deploy to clusters or even bake the manifest files to be used for deployments using Helm charts",
"loc.instanceNameFormat": "$(action)",
"loc.group.displayName.config": "Config",
"loc.group.displayName.kubernetesCluster": "Kubernetes Cluster",
"loc.input.label.action": "Action",
"loc.input.help.action": "Choose the action to be performed.",
"loc.input.label.kubernetesServiceConnection": "Kubernetes service connection",
"loc.input.help.kubernetesServiceConnection": "Select a Kubernetes service connection.",
"loc.input.label.namespace": "Namespace",
"loc.input.help.namespace": "Sets the namespace for the commands by using the –namespace flag. If the namespace is not provided, the commands will run in the default namespace.",
"loc.input.label.action": "Action",
"loc.input.help.action": "Choose the action to be performed.",
"loc.input.label.strategy": "Strategy",
"loc.input.help.strategy": "Deployment strategy to be used",
"loc.input.label.percentage": "Percentage",
Expand Down
2 changes: 1 addition & 1 deletion Tasks/KubernetesManifestV0/Tests/TestSetup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ process.env["BUILD_BUILDNUMBER"] = BuildNumber;
process.env["BUILD_DEFINITIONNAME"] = DefinitionName;

process.env["AGENT_JOBNAME"] = JobName;
process.env["TF_BUILD"] = "True";
process.env["SYSTEM_HOSTTYPE"] = "build";

process.env[shared.TestEnvVars.manifests] = process.env[shared.TestEnvVars.manifests] || shared.ManifestFilesPath;
process.env["ENDPOINT_DATA_kubernetesConnection_AUTHORIZATIONTYPE"] = process.env[shared.TestEnvVars.endpointAuthorizationType] || shared.AuthorizationType.Kubeconfig;
Expand Down
20 changes: 10 additions & 10 deletions Tasks/KubernetesManifestV0/src/models/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,27 +14,27 @@ export class KubernetesWorkload {
export const recognizedWorkloadTypes: string[] = ["deployment", "replicaset", "daemonset", "pod", "statefulset"];
export const recognizedWorkloadTypesWithRolloutStatus: string[] = ["deployment", "daemonset", "statefulset"];

let isBuild = tl.getVariable("TF_BUILD");
let isRelease = utils.isEqual(tl.getVariable("SYSTEM_HOSTTYPE"), "release", utils.StringComparer.OrdinalIgnoreCase);

export let pipelineAnnotations: string[] = [];
if (isBuild && utils.isEqual(isBuild, "true", utils.StringComparer.OrdinalIgnoreCase)) {
if (isRelease) {
pipelineAnnotations = [
`azure-pipelines/execution=${tl.getVariable("Build.BuildNumber")}`,
`azure-pipelines/pipeline="${tl.getVariable("Build.DefinitionName")}"`,
`azure-pipelines/pipelineId="${tl.getVariable("System.DefinitionId")}"`,
`azure-pipelines/execution=${tl.getVariable("Release.ReleaseId")}`,
`azure-pipelines/pipeline="${tl.getVariable("Release.DefinitionName")}"`,
`azure-pipelines/pipelineId="${tl.getVariable("Release.DefinitionId")}"`,
`azure-pipelines/jobName="${tl.getVariable("Agent.JobName")}"`,
`azure-pipelines/executionuri=${tl.getVariable("System.TeamFoundationCollectionUri")}${tl.getVariable("System.TeamProject")}/_build/results?buildId=${tl.getVariable("Build.BuildId")}`,
`azure-pipelines/executionuri=${tl.getVariable("System.TeamFoundationCollectionUri")}${tl.getVariable("System.TeamProject")}/_releaseProgress?releaseId=${tl.getVariable("Release.ReleaseId")}`,
`azure-pipelines/project=${tl.getVariable("System.TeamProject")}`,
`azure-pipelines/org=${tl.getVariable("System.CollectionId")}`
];
}
else {
pipelineAnnotations = [
`azure-pipelines/execution=${tl.getVariable("Release.ReleaseId")}`,
`azure-pipelines/pipeline="${tl.getVariable("Release.DefinitionName")}"`,
`azure-pipelines/pipelineId="${tl.getVariable("Release.DefinitionId")}"`,
`azure-pipelines/execution=${tl.getVariable("Build.BuildNumber")}`,
`azure-pipelines/pipeline="${tl.getVariable("Build.DefinitionName")}"`,
`azure-pipelines/pipelineId="${tl.getVariable("System.DefinitionId")}"`,
`azure-pipelines/jobName="${tl.getVariable("Agent.JobName")}"`,
`azure-pipelines/executionuri=${tl.getVariable("System.TeamFoundationCollectionUri")}${tl.getVariable("System.TeamProject")}/_releaseProgress?releaseId=${tl.getVariable("Release.ReleaseId")}`,
`azure-pipelines/executionuri=${tl.getVariable("System.TeamFoundationCollectionUri")}${tl.getVariable("System.TeamProject")}/_build/results?buildId=${tl.getVariable("Build.BuildId")}`,
`azure-pipelines/project=${tl.getVariable("System.TeamProject")}`,
`azure-pipelines/org=${tl.getVariable("System.CollectionId")}`
];
Expand Down
74 changes: 20 additions & 54 deletions Tasks/KubernetesManifestV0/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,47 +15,17 @@
"version": {
"Major": 0,
"Minor": 151,
"Patch": 2
"Patch": 4
},
"demands": [],
"groups": [
{
"name": "config",
"displayName": "Config",
"isExpanded": true
},
{
"name": "kubernetesCluster",
"displayName": "Kubernetes Cluster",
"isExpanded": true,
"visibleRule": "action != bake"
}
],
"groups": [],
"inputs": [
{
"name": "kubernetesServiceConnection",
"type": "connectedService:kubernetes",
"label": "Kubernetes service connection",
"helpMarkDown": "Select a Kubernetes service connection.",
"groupName": "kubernetesCluster",
"required": true
},
{
"name": "namespace",
"type": "string",
"label": "Namespace",
"required": true,
"defaultValue": "default",
"groupName": "kubernetesCluster",
"helpMarkDown": "Sets the namespace for the commands by using the –namespace flag. If the namespace is not provided, the commands will run in the default namespace."
},
{
"name": "action",
"type": "pickList",
"label": "Action",
"required": false,
"defaultValue": "deploy",
"groupName": "config",
"options": {
"bake": "bake",
"createSecret": "create secret",
Expand All @@ -68,12 +38,28 @@
},
"helpMarkDown": "Choose the action to be performed."
},
{
"name": "kubernetesServiceConnection",
"type": "connectedService:kubernetes",
"label": "Kubernetes service connection",
"helpMarkDown": "Select a Kubernetes service connection.",
"visibleRule": "action != bake",
"required": true
},
{
"name": "namespace",
"type": "string",
"label": "Namespace",
"required": true,
"defaultValue": "default",
"visibleRule": "action != bake",
"helpMarkDown": "Sets the namespace for the commands by using the –namespace flag. If the namespace is not provided, the commands will run in the default namespace."
},
{
"name": "strategy",
"type": "pickList",
"label": "Strategy",
"required": false,
"groupName": "config",
"defaultValue": "none",
"options": {
"canary": "Canary",
Expand All @@ -87,7 +73,6 @@
"type": "string",
"label": "Percentage",
"required": true,
"groupName": "config",
"helpMarkDown": "",
"defaultValue": 0,
"visibleRule": "strategy = Canary && action = deploy",
Expand All @@ -102,7 +87,6 @@
"label": "Manifests",
"required": true,
"defaultValue": "",
"groupName": "config",
"helpMarkDown": "Manifests to deploy",
"visibleRule": "action = deploy || action = promote || action = reject"
},
Expand All @@ -112,7 +96,6 @@
"label": "Containers",
"required": false,
"defaultValue": "",
"groupName": "config",
"helpMarkDown": "Containers",
"visibleRule": "action = deploy || action = promote"
},
Expand All @@ -122,7 +105,6 @@
"label": "ImagePullSecrets",
"required": false,
"defaultValue": "",
"groupName": "config",
"helpMarkDown": "ImagePullSecret to pull image from private registry",
"visibleRule": "action = deploy || action = promote"
},
Expand All @@ -132,7 +114,6 @@
"label": "Render Engine",
"required": false,
"defaultValue": "helm2",
"groupName": "config",
"visibleRule": "action = bake",
"options": {
"helm2": "Helm 2"
Expand All @@ -145,7 +126,6 @@
"label": "Helm Chart",
"required": true,
"defaultValue": "",
"groupName": "config",
"helpMarkDown": "Helm chart path to bake",
"visibleRule": "action = bake && renderType = helm2"
},
Expand All @@ -155,7 +135,6 @@
"label": "Override Files",
"required": false,
"defaultValue": "",
"groupName": "config",
"helpMarkDown": "Override files to set",
"visibleRule": "action = bake && renderType = helm2"
},
Expand All @@ -165,7 +144,6 @@
"label": "Overrides",
"required": false,
"defaultValue": "",
"groupName": "config",
"helpMarkDown": "Override values to set",
"visibleRule": "action = bake && renderType = helm2"
},
Expand All @@ -179,7 +157,6 @@
"file": "file",
"name": "name"
},
"groupName": "config",
"helpMarkDown": "to identify the resource",
"visibleRule": "action = patch"
},
Expand All @@ -189,7 +166,6 @@
"label": "File path",
"required": true,
"defaultValue": "",
"groupName": "config",
"helpMarkDown": "Path to the file used for patch",
"visibleRule": "action = patch && resourceToPatch = file"
},
Expand All @@ -199,7 +175,6 @@
"label": "Kind",
"required": true,
"defaultValue": "",
"groupName": "config",
"helpMarkDown": "Kind of K8s object; deployment, replicaSet etc.",
"visibleRule": "action = scale || resourceToPatch = name"
},
Expand All @@ -209,7 +184,6 @@
"label": "Name",
"required": true,
"defaultValue": "",
"groupName": "config",
"helpMarkDown": "Name of the k8s object",
"visibleRule": "action = scale || resourceToPatch = name"
},
Expand All @@ -219,7 +193,6 @@
"label": "Replica count",
"required": true,
"defaultValue": "",
"groupName": "config",
"helpMarkDown": "Number of replicas to scale to",
"visibleRule": "action = scale"
},
Expand All @@ -234,7 +207,6 @@
"merge": "merge",
"strategic": "strategic"
},
"groupName": "config",
"helpMarkDown": "The type of patch being provided; one of [json merge strategic]",
"visibleRule": "action = patch"
},
Expand All @@ -243,16 +215,14 @@
"type": "string",
"label": "Arguments",
"defaultValue": "",
"groupName": "config",
"helpMarkDown": "Arguments for `kubectl delete` command",
"visibleRule": "action = delete || action = reject"
"visibleRule": "action = delete"
},
{
"name": "patch",
"type": "string",
"label": "Patch",
"required": true,
"groupName": "config",
"helpMarkDown": "Contents of patch",
"visibleRule": "action = patch"
},
Expand All @@ -263,7 +233,6 @@
"defaultValue": "dockerRegistry",
"required": true,
"visibleRule": "action = createSecret",
"groupName": "config",
"options": {
"dockerRegistry": "dockerRegistry",
"generic": "generic"
Expand All @@ -275,15 +244,13 @@
"type": "string",
"label": "Secret name",
"required": false,
"groupName": "config",
"visibleRule": "action = createSecret",
"defaultValue": "",
"helpMarkDown": "Name of the secret. You can use this secret name in the Kubernetes YAML configuration file."
},
{
"name": "secretArguments",
"type": "multiLine",
"groupName": "config",
"properties": {
"resizable": "true",
"rows": "2",
Expand All @@ -297,7 +264,6 @@
{
"name": "dockerRegistryEndpoint",
"type": "connectedService:dockerregistry",
"groupName": "config",
"label": "Docker registry service connection",
"helpMarkDown": "Select a Docker registry service connection. Required for commands that need to authenticate with a registry.",
"visibleRule": "action = createSecret && secretType = dockerRegistry"
Expand Down
Loading