diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 00000000..12301490 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,6 @@ +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "daily" diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml new file mode 100644 index 00000000..0d0b1c99 --- /dev/null +++ b/.github/release-drafter.yml @@ -0,0 +1 @@ +_extends: .github diff --git a/.github/workflows/cd.yaml b/.github/workflows/cd.yaml new file mode 100644 index 00000000..ff6a66d5 --- /dev/null +++ b/.github/workflows/cd.yaml @@ -0,0 +1,58 @@ +# Note: additional setup is required, see https://github.com/jenkinsci/incrementals-tools#automatic-deployment + +name: cd +on: + workflow_dispatch: + check_run: + types: + - completed + +jobs: + validate: + runs-on: ubuntu-latest + outputs: + should_release: ${{ steps.verify-ci-status.outputs.result == 'success' && steps.interesting-categories.outputs.interesting == 'true' }} + steps: + - name: Verify CI status + uses: jenkins-infra/verify-ci-status-action@v1.2.0 + id: verify-ci-status + with: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + output_result: true + + - name: Release Drafter + uses: release-drafter/release-drafter@v5 + if: steps.verify-ci-status.outputs.result == 'success' + with: + name: next + tag: next + version: next + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Check interesting categories + uses: jenkins-infra/interesting-category-action@v1.0.0 + id: interesting-categories + if: steps.verify-ci-status.outputs.result == 'success' + with: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + release: + runs-on: ubuntu-latest + needs: [validate] + if: needs.validate.outputs.should_release == 'true' + steps: + - name: Check out + uses: actions/checkout@v2.3.4 + with: + fetch-depth: 0 + - name: Set up JDK 8 + uses: actions/setup-java@v1 + with: + java-version: 1.8 + - name: Release + uses: jenkins-infra/jenkins-maven-cd-action@v1.1.0 + with: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} + MAVEN_TOKEN: ${{ secrets.MAVEN_TOKEN }} diff --git a/.mvn/extensions.xml b/.mvn/extensions.xml index 94863e60..43d62816 100644 --- a/.mvn/extensions.xml +++ b/.mvn/extensions.xml @@ -2,6 +2,6 @@ io.jenkins.tools.incrementals git-changelist-maven-extension - 1.0-beta-7 + 1.2 diff --git a/.mvn/maven.config b/.mvn/maven.config index 2a0299c4..f7daf60d 100644 --- a/.mvn/maven.config +++ b/.mvn/maven.config @@ -1,2 +1,3 @@ -Pconsume-incrementals -Pmight-produce-incrementals +-Dchangelist.format=%d.v%s diff --git a/checkstyle.xml b/checkstyle.xml index dfb961eb..daa2e461 100644 --- a/checkstyle.xml +++ b/checkstyle.xml @@ -45,6 +45,10 @@ + + + + @@ -73,9 +77,6 @@ - - - @@ -133,9 +134,8 @@ - + - diff --git a/pom.xml b/pom.xml index 0090701c..86e16b9f 100644 --- a/pom.xml +++ b/pom.xml @@ -5,11 +5,11 @@ org.jenkins-ci.plugins plugin - 4.13 + 4.17 azure-vm-agents - ${revision}${changelist} + ${changelist} hpi Azure VM Agents @@ -36,15 +36,15 @@ - scm:git:ssh://git@github.com/jenkinsci/azure-vm-agents-plugin.git - scm:git:ssh://git@github.com/jenkinsci/azure-vm-agents-plugin.git - https://github.com/jenkinsci/azure-vm-agents-plugin + scm:git:ssh://git@github.com/${gitHubRepo}.git + scm:git:ssh://git@github.com/${gitHubRepo}.git + https://github.com/${gitHubRepo} ${scmTag} - 1.5.4 - -SNAPSHOT + 9999-SNAPSHOT + jenkinsci/azure-vm-agents-plugin UTF-8 UTF-8 1.19.0 @@ -58,7 +58,6 @@ 1.6.1 1.1.0 24.1.1-jre - 1.35 @@ -66,7 +65,7 @@ io.jenkins.tools.bom bom-2.263.x - 17 + 26 import pom @@ -288,7 +287,14 @@ org.apache.maven.plugins maven-checkstyle-plugin - 2.17 + 3.1.1 + + + com.puppycrawl.tools + checkstyle + 8.41 + + validate diff --git a/src/main/java/com/microsoft/azure/vmagent/builders/AdvancedImageFluent.java b/src/main/java/com/microsoft/azure/vmagent/builders/AdvancedImageFluent.java index c89c183d..a5a91486 100644 --- a/src/main/java/com/microsoft/azure/vmagent/builders/AdvancedImageFluent.java +++ b/src/main/java/com/microsoft/azure/vmagent/builders/AdvancedImageFluent.java @@ -159,13 +159,13 @@ public T withDoNotUseMachineIfInitFails(boolean doNotUseMachineIfInitFails) { public T withEnableMSI(boolean enableMSI) { this.enableMSI = enableMSI; return (T) this; - } - + } + public T withEnableUAMI(boolean enableUAMI) { this.enableUAMI = enableUAMI; return (T) this; } - + public T withGetUamiID(String uamiID) { this.uamiID = uamiID; return (T) this; diff --git a/src/main/resources/com/microsoft/azure/vmagent/Messages.properties b/src/main/resources/com/microsoft/azure/vmagent/Messages.properties index 566fb12e..be843e29 100644 --- a/src/main/resources/com/microsoft/azure/vmagent/Messages.properties +++ b/src/main/resources/com/microsoft/azure/vmagent/Messages.properties @@ -1,34 +1,48 @@ # Global configuration - validations Azure_Config_Success=Successfully verified Azure configuration. -Azure_GC_InitScript_Warn_Msg=Ensure image is pre-configured with a Java runtime or provide a script to install Java in headless (silent) mode. \ +Azure_GC_InitScript_Warn_Msg=Ensure image is pre-configured with a Java runtime or provide a script \ + to install Java in headless (silent) mode. \ \nIf using JNLP, see README.md for a sample script. -Azure_GC_LaunchMethod_Warn_Msg=Make sure the Azure agent can reach the controller via the Jenkins URL. Refer to the help for details. -Azure_GC_TemplateStatus_Warn_Msg=The template is marked as disabled. Check the template status details in the Advanced section. +Azure_GC_LaunchMethod_Warn_Msg=Make sure the Azure agent can reach the controller via the Jenkins URL. \ + Refer to the help for details. +Azure_GC_TemplateStatus_Warn_Msg=The template is marked as disabled. Check the template status details in \ + the Advanced section. Azure_GC_OS_Type_Unknown_Err=Unknown OS type. Should be Linux or Windows -Azure_GC_UserName_Err=Not a valid user name. The user name must contain between 3 and 15 characters: alphanumerics, underscore or hyphen. -Azure_GC_Password_Err=Required: Not a valid password. The password length must be between 8 and 123 characters. It also needs to have at least one digit, one lowercase and one uppercase letter. +Azure_GC_UserName_Err=Not a valid user name. The user name must contain between 3 and 15 characters: \ + alphanumerics, underscore or hyphen. +Azure_GC_Password_Err=Required: Not a valid password. The password length must be between 8 and 123 characters. \ + It also needs to have at least one digit, one lowercase and one uppercase letter. Azure_GC_JVM_Option_Err=Error: Not a valid JVM Option. JVM options should start with a hyphen(-). e.g. -Xmx1500m Azure_GC_Template_Error_List=The following errors occurred while validating the template. Azure_GC_Template_Val_Profile_Missing=The profile configuration is missing. Configure an Azure profile first. -Azure_GC_Template_ResourceGroupName_Err=Resource Group Name is invalid. Valid characters are Alphanumeric, underscore(_) and hyphen(-), length 2-64 \ +Azure_GC_Template_ResourceGroupName_Err=Resource Group Name is invalid. Valid characters are Alphanumeric, \ + underscore(_) and hyphen(-), length 2-64 \ \nAvoid having - or _ as the first or last character in name. -Azure_GC_Template_Deployment_Timeout_Err=Deployment Timeout value is invalid. Should be a positive integer and more than 1200 seconds. +Azure_GC_Template_Deployment_Timeout_Err=Deployment Timeout value is invalid. Should be a positive integer and\ + more than 1200 seconds. -Azure_GC_Template_Val_Profile_Err=Failed to validate the Azure profile. Verify the subscription Id, client Id and secret, OAUth 2.0 Token Endpoint and the URL information. -Azure_GC_Template_max_VM_Err=The current number of virtual machines in this Azure subscription is {0}, which is more than or equal to the default value {1} \ - \n.Consider increasing Max Virtual Machines Limit value or delete existing virtual machines from your subscription. +Azure_GC_Template_Val_Profile_Err=Failed to validate the Azure profile. Verify the subscription Id, client Id and\ + secret, OAUth 2.0 Token Endpoint and the URL information. +Azure_GC_Template_max_VM_Err=The current number of virtual machines in this Azure subscription is {0},\ + which is more than or equal to the default value {1} \ + \n.Consider increasing Max Virtual Machines Limit value or delete existing\ + virtual machines from your subscription. Azure_GC_Template_Null_Or_Empty=The template name is null or empty. -Azure_GC_Template_Name_Not_Valid=The template name is not valid. Must begin with a letter, and contain only lowercase letters, numbers, or dashes +Azure_GC_Template_Name_Not_Valid=The template name is not valid. Must begin with a letter, and \ + contain only lowercase letters, numbers, or dashes Azure_GC_Template_Name_Shortened=The template name is valid, but VM names will be shortened to: {0} Azure_GC_Template_Name_Reserved=The template name is using reserved words: login, microsoft, windows, xbox. Azure_GC_Template_LOC_Not_Found=The location is not valid -Azure_GC_Template_Name_LOC_No_Match=The cloud service location and the location selected do not match. Use a different template or location. +Azure_GC_Template_Name_LOC_No_Match=The cloud service location and the location selected do not match. \ + Use a different template or location. Azure_GC_Template_CS_NA=Cloud service name {0} is either not available or not valid. Use a different cloud service name. -Azure_GC_Template_CS_LOC_No_Match=The cloud service location and the location selected do not match. Use a different cloud service or location. -Azure_GC_Template_SA_Not_Valid=The storage account name is not valid, a valid name can contain only lowercase letters and numbers, and must between 3 and 24 characters. +Azure_GC_Template_CS_LOC_No_Match=The cloud service location and the location selected do not match. \ + Use a different cloud service or location. +Azure_GC_Template_SA_Not_Valid=The storage account name is not valid, a valid name can contain only lowercase letters \ + and numbers, and must between 3 and 24 characters. Azure_GC_Template_SA_Type_Not_Match=The chosen storage type: {0} and the existing account type: {1} do not match. Azure_GC_Template_SA_Already_Exists=The storage account name already exists. Use a different name. Azure_GC_Template_SA_Cant_Validate=Could not validate the storage account name. @@ -41,17 +55,22 @@ Azure_GC_Template_RT_Null_Or_Empty=Missing retention time. Azure_GC_Template_RT_Not_Positive=The retention time must be a positive integer. Azure_GC_Template_ImageFamilyOrID_Null_Or_Empty=Missing image family or image ID. Azure_GC_Template_ImageURI_Not_Valid=Failed to validate the provided image location. -Azure_GC_Template_ImageURI_Wrong_Storage_Account=The reference image should be in the same storage account as the one declared in the template. +Azure_GC_Template_ImageURI_Wrong_Storage_Account=The reference image should be in the same storage account as the one \ + declared in the template. Azure_GC_Template_ImageReference_Not_Valid=Failed to validate the provided image reference: {0} Azure_GC_Template_ImageID_Not_Valid=The provided Image ID does not exist Azure_GC_Template_Gallery_Image_Not_Found=The target gallery image does not exist -Azure_GC_Template_ImageURI_Not_In_Same_Account=The image URI is not located in the same storage account as the target storage account for the VM +Azure_GC_Template_ImageURI_Not_In_Same_Account=The image URI is not located in the same storage account as the target \ + storage account for the VM Azure_GC_Template_JNLP_Not_Supported=The JNLP launch method is supported only for Windows. Azure_GC_Template_UN_Null_Or_Empty=Missing admin user name. Azure_GC_Template_PWD_Null_Or_Empty=Missing admin password. -Azure_GC_Template_PWD_Not_Valid=Required: Not a valid password. The password length must be between 12 and 123 characters. It also needs to have at least one digit, one lowercase, one uppercase letter and one special character ( @#$%^&*-_!+=[]'{}'|\\:`,.?/~\"();\' ). +Azure_GC_Template_PWD_Not_Valid=Required: Not a valid password. The password length must be between 12 and 123 \ + characters. It also needs to have at least one digit, one lowercase, one uppercase letter and one \ + special character ( @#$%^&*-_!+=[]'{}'|\\:`,.?/~\"();\' ). Azure_GC_Template_VirtualNetwork_Null_Or_Empty=Missing virtual network name. -Azure_GC_Template_VirtualNetwork_NotFound=The virtual network {0} does not exist in the resource group {1} in this subscription. +Azure_GC_Template_VirtualNetwork_NotFound=The virtual network {0} does not exist in the resource group {1} \ + in this subscription. Azure_GC_Template_subnet_Empty=The subnet name cannot be empty Azure_GC_Template_subnet_NotFound=The subnet {0} does not belong to the specified virtual network. Azure_GC_Template_BuiltIn_Not_Valid=Azure build-in image is not valid. @@ -62,9 +81,11 @@ Failed_Initial_Shutdown_Or_Delete=Node failed initial shutdown/deletion. Markin Idle_Timeout_Shutdown=Node is being stopped(Deallocated) by Jenkins after idle timeout Idle_Timeout_Delete=Node is being deleted by Jenkins after idle timeout User_Delete=Node is being deleted by the user -Agent_Failed_To_Connect=The agent failed to connect. The node has been marked for deletion. Make sure that the appropriate firewall exceptions have been configured \ +Agent_Failed_To_Connect=The agent failed to connect. The node has been marked for deletion. \ + Make sure that the appropriate firewall exceptions have been configured \ for the agent to connect to the controller. -Agent_Failed_Init_Script=The agent connected, but failed its initialization script. The node has been marked for deletion. +Agent_Failed_Init_Script=The agent connected, but failed its initialization script. \ + The node has been marked for deletion. Shutdown_Agent_Failed_To_Revive=The previously shut down agent failed to start. # Post build action for deprovisioning