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

Fix template max #568

Merged
merged 2 commits into from
Oct 8, 2024
Merged

Fix template max #568

merged 2 commits into from
Oct 8, 2024

Conversation

kmalino66
Copy link
Contributor

@kmalino66 kmalino66 commented Oct 8, 2024

This pull request adds a JenkinsTemplateTag tag to the ARM templates for creating the virtual machines in Azure with the value of the template name. Fixes #563 and Fixes #378.

With existing state, whenever AzureVMManagementServiceDelegate.getVirtualMachineCountsByTemplate() is run, it is looking for this tag to build a map to track the number of existing agents (lines 1843-1854). Since this tag does not exist, the resulting map does not correctly reflect the count of VMs which exist.

Testing done

First started creating a Jenkins server using the existing released version of the plugin. Confirmed we were able to reproduce the error, in this case by running multiple pipelines scoped to the agent label with a configured maximum template limit of 1. Was able to successfully reproduce the issue.

Built and installed plugin with existing code into same instance of Jenkins and recreated the agents. Performed same test as above, and only 1 agent was able to be created. I confirmed the presence of log messages similar to the following: Wanted to create 1 nodes from template jnksagtqa3 but cannot create any, have template limit of 1 but have 1 VMs already so we can have 0 more, currently have 1 VMs in cloud. Continued to run this to ensure we meet a scheduled run of the verification task, which would historically break the counts.

The templates used are configured with a custom image, managed disks, and startup script. This means customImageTemplateWithScriptAndManagedDisk.json is the main template tested so far.

Submitter checklist

  • Make sure you are opening from a topic/feature/bugfix branch (right side) and not your main branch!
  • Ensure that the pull request title represents the desired changelog entry
  • Please describe what you did
  • Link to relevant issues in GitHub or Jira
  • Link to relevant pull requests, esp. upstream and downstream changes
  • Ensure you have provided tests - that demonstrates feature works or fixes the issue

@timja timja added the bug label Oct 8, 2024
Copy link
Member

@timja timja left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! (untested)

@timja timja merged commit 655c495 into jenkinsci:master Oct 8, 2024
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants