jenkinsci / azure-vm-agents-plugin

This repo is for azure vm agents plugin for jenkins. Azure devops CICD is the team which owns it for now
https://plugins.jenkins.io/azure-vm-agents/
46 stars 102 forks source link

Receiving a conflict when trying to deploy a Windows Agent in Azure #327

Closed jnewton03 closed 3 years ago

jnewton03 commented 3 years ago

Version report

Jenkins and plugins versions report:

Jenkins: 2.317
OS: Linux - 2.6.32-754.35.1.el6.x86_64
---
ace-editor:1.1
analysis-core:1.96
ansicolor:1.0.0
ant:1.12
antisamy-markup-formatter:2.4
apache-httpcomponents-client-4-api:4.5.13-1.0
artifactdeployer:1.2
artifactory:3.13.2
audit-trail:3.10
authentication-tokens:1.4
aws-credentials:1.32
aws-java-sdk:1.12.89-292.v2712528e879c
aws-java-sdk-cloudformation:1.12.89-292.v2712528e879c
aws-java-sdk-codebuild:1.12.89-292.v2712528e879c
aws-java-sdk-ec2:1.12.89-292.v2712528e879c
aws-java-sdk-ecr:1.12.89-292.v2712528e879c
aws-java-sdk-ecs:1.12.89-292.v2712528e879c
aws-java-sdk-elasticbeanstalk:1.12.89-292.v2712528e879c
aws-java-sdk-iam:1.12.89-292.v2712528e879c
aws-java-sdk-logs:1.12.89-292.v2712528e879c
aws-java-sdk-minimal:1.12.89-292.v2712528e879c
aws-java-sdk-ssm:1.12.89-292.v2712528e879c
azure-commons:1.1.3
azure-credentials:198.vf9c2fdfde55c
azure-sdk:61.v6a8af1f5f5b6
azure-vm-agents:797.v31f530348574
badge:1.8
blueocean:1.25.1
blueocean-autofavorite:1.2.4
blueocean-bitbucket-pipeline:1.25.1
blueocean-commons:1.25.1
blueocean-config:1.25.1
blueocean-core-js:1.25.1
blueocean-dashboard:1.25.1
blueocean-display-url:2.4.1
blueocean-events:1.25.1
blueocean-executor-info:1.25.1
blueocean-git-pipeline:1.25.1
blueocean-github-pipeline:1.25.1
blueocean-i18n:1.25.1
blueocean-jira:1.25.1
blueocean-jwt:1.25.1
blueocean-personalization:1.25.1
blueocean-pipeline-api-impl:1.25.1
blueocean-pipeline-editor:1.25.1
blueocean-pipeline-scm-api:1.25.1
blueocean-rest:1.25.1
blueocean-rest-impl:1.25.1
blueocean-web:1.25.1
bootstrap4-api:4.6.0-3
bootstrap5-api:5.1.1-1
bouncycastle-api:2.25
branch-api:2.7.0
buckminster:1.1.1
build-blocker-plugin:1.7.7
build-pipeline-plugin:1.5.8
caffeine-api:2.9.2-29.v717aac953ff3
checks-api:1.7.2
claim:2.18.2
cloud-stats:0.27
cloudbees-bitbucket-branch-source:2.9.11
cloudbees-folder:6.16
codedeploy:1.23
command-launcher:1.6
conditional-buildstep:1.4.1
config-file-provider:3.8.1
configurationslicing:1.52
convert-to-pipeline:1.0
copy-to-slave:1.4.4
copyartifact:1.46.2
credentials:2.6.2
credentials-binding:1.27
cucumber-reports:5.6.1-SNAPSHOT (private-bb126593-jake)
cvs:2.19
datadog:3.2.0
delta-cloud:1.0.1
dependencyanalyzer:0.7
depgraph-view:1.0.5
description-setter:1.10
disk-usage:0.28
display-url-api:2.3.5
docker-commons:1.17
docker-workflow:1.26
durable-task:1.39
ec2:1.66
echarts-api:5.2.1-2
envfile:1.2
envinject:2.4.0
envinject-api:1.7
extended-read-permission:3.2
external-monitor-job:1.7
favorite:2.3.3
file-leak-detector:1.6
file-operations:1.11
flaky-test-handler:1.2.0
font-awesome-api:5.15.4-1
git:4.9.0
git-client:3.10.0
git-server:1.10
github:1.34.1
github-api:1.133
github-branch-source:2.11.3
github-oauth:0.34
github-pullrequest:0.3.0
gradle:1.37.1
groovy:2.4
groovy-postbuild:2.5
handlebars:3.0.8
handy-uri-templates-2-api:2.1.8-1.0
htmlpublisher:1.27
icon-shim:3.0.0
ivy:2.1
jackson2-api:2.13.0-230.v59243c64b0a5
jacoco:3.3.0
javadoc:1.6
jaxb:2.3.0.1
jclouds-jenkins:2.25
jdepend:1.3.0
jdk-tool:1.5
jenkins-design-language:1.25.1
jira:3.6
jjwt-api:0.11.2-9.c8b45b8bb173
jobConfigHistory:2.28.1
join:1.21
jquery:1.12.4-1
jquery-detached:1.2.1
jquery-ui:1.0.2
jquery3-api:3.6.0-2
jsch:0.1.55.2
junit:1.53
ldap:2.7
lockable-resources:2.6-SNAPSHOT (private-4648352c-steve)
locks-and-latches:0.6
log-parser:2.1
mailer:1.34
mapdb-api:1.0.9.0
matrix-auth:2.6.8
matrix-combinations-parameter:1.3.1
matrix-project:1.19
maven-dependency-update-trigger:1.5
maven-info:0.3.0
maven-plugin:3.15
maven-repo-cleaner:1.2
mercurial:2.15
metrics:4.0.2.8
momentjs:1.1.1
monitoring:1.88.0
multiple-scms:0.8
next-build-number:1.7
node-iterator-api:1.5.1
okhttp-api:3.14.9
pam-auth:1.6
parallel-test-executor:1.13
parameterized-trigger:2.41
performance:3.20
pipeline-aws:1.43
pipeline-build-step:2.15
pipeline-graph-analysis:1.11
pipeline-input-step:2.12
pipeline-milestone-step:1.3.2
pipeline-model-api:1.9.2
pipeline-model-declarative-agent:1.1.1
pipeline-model-definition:1.9.2
pipeline-model-extensions:1.9.2
pipeline-rest-api:2.19
pipeline-stage-step:2.5
pipeline-stage-tags-metadata:1.9.2
pipeline-stage-view:2.19
pipeline-utility-steps:2.10.0
plain-credentials:1.7
plugin-util-api:2.5.0
popper-api:1.16.1-2
popper2-api:2.10.2-1
postbuild-task:1.9
publish-over:0.22
publish-over-ftp:1.16
publish-over-ssh:1.22
pubsub-light:1.16
radiatorviewplugin:1.29
resource-disposer:0.16
role-strategy:3.2.0
ruby:1.2
ruby-runtime:0.12
run-condition:1.5
schedule-failed-builds:1.1
scm-api:2.6.5
script-security:1.78
slack:2.48
snakeyaml-api:1.29.1
snyk-security-scanner:3.2.3
sonar:2.13.1
sse-gateway:1.24
ssh:2.6.1
ssh-agent:1.23
ssh-credentials:1.19
ssh-slaves:1.33.0
ssh-steps:2.0.0
sshd:3.1.0
structs:1.23
subversion:2.15.0
support-core:2.76
tasks:4.53
terraform:1.0.10
thinBackup:1.10
timestamper:1.13
token-macro:266.v44a80cf277fd
translation:1.16
trilead-api:1.0.13
variant:1.4
windows-slaves:1.8
workflow-aggregator:2.6
workflow-api:2.47
workflow-basic-steps:2.24
workflow-cps:2.94
workflow-cps-global-lib:2.21
workflow-durable-task-step:2.39
workflow-job:2.42
workflow-multibranch:2.26
workflow-scm-step:2.13
workflow-step-api:2.24
workflow-support:3.8
ws-cleanup:0.39
xshell:0.10
Controller:  Centos 6 Linux Server
Agents:  Windows Server 2019 Custom Image

Reproduction steps

Results

Expected result:

Agent successfully deploys

Actual result:

AzureVMAgentCleanUpTask: registerDeployment: Registering deployment jenkinsagent1117100836267 in liquibase-dev
Nov 17, 2021 10:08:36 AM FINE com.microsoft.azure.vmagent.AzureVMManagementServiceDelegate createDeployment
{"$schema":"https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json","contentVersion":"2.0.0.0","parameters":{"storageAccountKey":{"type":"secureString","defaultValue":"OHuu9vXmPSBn6J8HRRvNEETwc49OdkeVj28Rasd9qX+I8A4FAHJ7t2LVNz0nB6k5woUCK2p37iPGfJ5a7rLuoA=="},"count":{"type":"int","defaultValue":1},"adminPassword":{"type":"secureString"}},"variables":{"virtualNetworkName":"jenkinsarm-vnet","virtualNetworkResourceGroupName":"liquibase-dev","subnetName":"jenkinsarm-snet","nsgName":"","storageAccountName":"liquibasedevjenkins","vnetID":"[resourceId(variables('virtualNetworkResourceGroupName'), 'Microsoft.Network/virtualNetworks', variables('virtualNetworkName'))]","subnetRef":"[concat(variables('vnetID'),'/subnets/',variables('subnetName'))]","publicIPAddressType":"Dynamic","storageAccountContainerName":"vhds","storageAccountType":"Standard_LRS","startupScriptURI":"https://liquibasedevjenkins.blob.core.windows.net/jenkinsconfig/jenkinsagent1117100836267init.ps1","startupScriptName":"jenkinsagent1117100836267init.ps1","jenkinsServerURL":"http://ec2-54-204-29-237.compute-1.amazonaws.com:8080/","clientSecrets":["6bca2f5b5e2400f6d26880982fa3048885d918608cd34db6c9f24f99eac81a19"],"jenkinsTag":"ManagedByAzureVMAgents","resourceTag":"98acc6fae9f1896a44865780039e7c08/1637165316","cloudTag":"azurevsps","blobEndpointSuffix":".blob.core.windows.net/","vmName":"jenkinsabeff4","location":"southcentralus","osDiskStorageAccountType":"StandardSSD_LRS","imageId":"/subscriptions/a38e082e-9dfc-49dd-a5e8-9d13e908b010/resourceGroups/liquibase-dev/providers/Microsoft.Compute/images/jenkinsTestAgent-image-20211116101739","osType":"Windows","ephemeralOSDisk":"true","vmSize":"Standard_B8ms","adminUsername":"lbadmin"},"resources":[{"apiVersion":"2019-04-01","type":"Microsoft.Network/networkInterfaces","name":"[concat(variables('vmName'), copyIndex(), 'NIC')]","location":"[variables('location')]","copy":{"name":"vmcopy","count":"[parameters('count')]"},"dependsOn":["[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]","[concat('Microsoft.Network/publicIPAddresses/',variables('vmName'), copyIndex(), 'IPName')]"],"properties":{"ipConfigurations":[{"name":"ipconfig1","properties":{"privateIPAllocationMethod":"Dynamic","subnet":{"id":"[variables('subnetRef')]"},"publicIPAddress":{"id":"[resourceId('Microsoft.Network/publicIPAddresses', concat(variables('vmName'), copyIndex(), 'IPName'))]"}}}]},"tags":{"JenkinsManagedTag":"[variables('jenkinsTag')]","JenkinsResourceTag":"[variables('resourceTag')]"}},{"apiVersion":"2019-03-01","type":"Microsoft.Compute/virtualMachines","name":"[concat(variables('vmName'), copyIndex())]","location":"[variables('location')]","copy":{"name":"vmcopy","count":"[parameters('count')]"},"dependsOn":["[concat('Microsoft.Network/networkInterfaces/', variables('vmName'), copyIndex(), 'NIC')]"],"properties":{"hardwareProfile":{"vmSize":"[variables('vmSize')]"},"osProfile":{"computerName":"[concat(variables('vmName'), copyIndex())]","adminUsername":"[variables('adminUsername')]","adminPassword":"[parameters('adminPassword')]"},"storageProfile":{"imageReference":{"id":"[variables('imageId')]"},"osDisk":{"createOption":"FromImage","caching":"[if(bool(variables('ephemeralOSDisk')), 'ReadOnly', json('null'))]","diffDiskSettings":"[if(bool(variables('ephemeralOSDisk')), json('{\"option\": \"Local\"}'), json('null'))]","managedDisk":{"storageAccountType":"[variables('osDiskStorageAccountType')]"}}},"networkProfile":{"networkInterfaces":[{"id":"[resourceId('Microsoft.Network/networkInterfaces', concat(variables('vmName'), copyIndex(), 'NIC'))]"}]}},"resources":[{"type":"extensions","name":"[concat('customScript', variables('vmName'), copyIndex())]","apiVersion":"2019-03-01","location":"[variables('location')]","dependsOn":["[concat('Microsoft.Compute/virtualMachines/', variables('vmName'), copyIndex())]"],"properties":{"publisher":"Microsoft.Compute","type":"CustomScriptExtension","typeHandlerVersion":"1.7","autoUpgradeMinorVersion":true,"settings":{"fileUris":["[variables('startupScriptURI')]"],"commandToExecute":"[concat('powershell.exe -ExecutionPolicy Unrestricted -File ', variables('startupScriptName'),' ', variables('jenkinsServerURL'),' ', variables('vmName'),copyIndex(),' ', variables('clientSecrets')[copyIndex()])]"},"protectedSettings":{"storageAccountName":"[variables('storageAccountName')]","storageAccountKey":"[parameters('storageAccountKey')]"}}}],"tags":{"JenkinsManagedTag":"[variables('jenkinsTag')]","JenkinsResourceTag":"[variables('resourceTag')]","JenkinsCloudTag":"[variables('cloudTag')]"}},{"apiVersion":"2019-04-01","type":"Microsoft.Network/virtualNetworks","name":"[variables('virtualNetworkName')]","location":"[variables('location')]","tags":{"JenkinsManagedTag":"[variables('jenkinsTag')]","JenkinsResourceTag":"[variables('resourceTag')]"},"properties":{"addressSpace":{"addressPrefixes":["10.0.0.0/16"]},"subnets":[{"name":"[variables('subnetName')]","properties":{"addressPrefix":"10.0.0.0/24"}}]}},{"apiVersion":"2019-04-01","type":"Microsoft.Network/publicIPAddresses","name":"[concat(variables('vmName'), copyIndex(), 'IPName')]","location":"[variables('location')]","copy":{"name":"vmcopy","count":"[parameters('count')]"},"properties":{"publicIPAllocationMethod":"[variables('publicIPAddressType')]","dnsSettings":{"domainNameLabel":"[concat(variables('vmName'), copyIndex())]"}},"tags":{"JenkinsManagedTag":"[variables('jenkinsTag')]","JenkinsResourceTag":"[variables('resourceTag')]"}}]}
Nov 17, 2021 10:08:38 AM INFO com.microsoft.azure.vmagent.AzureVMCloud createProvisionedAgent
AzureVMCloud: createProvisionedAgent: Waiting for deployment jenkinsagent1117100836267 with VM jenkinsabeff40 to be completed
Nov 17, 2021 10:08:40 AM FINE hudson.model.AsyncPeriodicWork lambda$doRun$1
Started Azure VM Maintainer Pool Size
Nov 17, 2021 10:08:40 AM FINE hudson.model.AsyncPeriodicWork lambda$doRun$1
Finished Azure VM Maintainer Pool Size. 0 ms
Nov 17, 2021 10:09:08 AM SEVERE com.microsoft.azure.vmagent.AzureVMCloud$2 call
Failure creating provisioned agent 'jenkinsabeff40'
com.microsoft.azure.vmagent.exceptions.AzureCloudException: AzureVMCloud: createProvisionedAgent: Deployment Failed: Microsoft.Compute/virtualMachines:jenkinsabeff40 - Conflict - com.azure.resourcemanager.resources.models.StatusMessage@101ac4dc
    at com.microsoft.azure.vmagent.exceptions.AzureCloudException.create(AzureCloudException.java:37)
    at com.microsoft.azure.vmagent.AzureVMCloud.createProvisionedAgent(AzureVMCloud.java:530)
    at com.microsoft.azure.vmagent.AzureVMCloud$2.call(AzureVMCloud.java:761)
    at com.microsoft.azure.vmagent.AzureVMCloud$2.call(AzureVMCloud.java:738)
    at jenkins.util.ContextResettingExecutorService$2.call(ContextResettingExecutorService.java:46)
    at jenkins.security.ImpersonatingExecutorService$2.call(ImpersonatingExecutorService.java:80)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
timja commented 3 years ago

Check the azure deployment logs on the resource group or enable more logging in the plugin: https://github.com/jenkinsci/azure-vm-agents-plugin#troubleshooting

jnewton03 commented 3 years ago

turns out it was being VERY particular about using an existing resource group, so I just created a new one. I also created all new storage account. Several times I had to delete and re-add the configuration for the plugin to get it to recognize. Lastly, the image I was trying to use had not been properly generalized. I believe I am past this problem now. Closing issue.