Skip to content

Commit

Permalink
Move AzureCredentials in a separate plugin [FIXED JENKINS-42479]
Browse files Browse the repository at this point in the history
  • Loading branch information
clguiman committed Mar 8, 2017
1 parent a243ad5 commit dd6d66d
Show file tree
Hide file tree
Showing 14 changed files with 33 additions and 416 deletions.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -33,7 +33,7 @@ Refer to
## Configure the plugin : Azure profile configuration
1. Within the Jenkins dashboard, click Manage Jenkins --> Configure System --> Scroll to the bottom of the page
and find the section with the dropdown "Add new cloud" --> click on it and select "Microsoft Azure VM Agents"
2. Select an existing account from the Azure Credentials drop down or add new "Microsoft Azure VM Agents" credentials in the Credentials Management page by filling out the Subscription ID, Client ID, Client Secret and the OAuth 2.0 Token Endpoint.
2. Select an existing account from the Azure Credentials drop down or add new "Microsoft Azure Service Principal" credentials in the Credentials Management page by filling out the Subscription ID, Client ID, Client Secret and the OAuth 2.0 Token Endpoint.
3. Click on “Verify configuration” to make sure that the profile configuration is done correctly.
4. Save and continue with the template configuration (See instructions below)

Expand Down
32 changes: 25 additions & 7 deletions pom.xml
Expand Up @@ -18,11 +18,13 @@
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<azuresdk.version>1.0.0-beta5</azuresdk.version>
<azure-storage.version>4.4.0</azure-storage.version>
<jackson.version>2.7.2</jackson.version>
<jenkins.version>1.653</jenkins.version>
<java.level>7</java.level>
<findbugs.failOnError>true</findbugs.failOnError>
<findbugs.excludeFilterFile>findbugs-exclude.xml</findbugs.excludeFilterFile>
<maven.javadoc.skip>true</maven.javadoc.skip>
<azure-credentials.version>1.0</azure-credentials.version>
</properties>

<licenses>
Expand Down Expand Up @@ -84,7 +86,29 @@
<version>${azuresdk.version}</version>
<type>jar</type>
</dependency>


<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>${jackson.version}</version>
</dependency>

<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>azure-credentials</artifactId>
<version>${azure-credentials.version}</version>
</dependency>

<dependency>
<groupId>com.jcraft</groupId>
<artifactId>jsch</artifactId>
Expand Down Expand Up @@ -139,12 +163,6 @@
<scope>test</scope>
</dependency>


<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>credentials</artifactId>
<version>1.21</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plain-credentials</artifactId>
Expand Down
307 changes: 0 additions & 307 deletions src/main/java/com/microsoft/azure/util/AzureCredentials.java

This file was deleted.

8 changes: 6 additions & 2 deletions src/main/java/com/microsoft/azure/vmagent/AzureVMCloud.java
Expand Up @@ -725,8 +725,12 @@ public FormValidation doVerifyConfiguration(
}
AzureCredentials.ServicePrincipal credentials = AzureCredentials.getServicePrincipal(azureCredentialsId);
try {
credentials.validate(resourceGroupName, maxVirtualMachinesLimit, deploymentTimeout);
} catch (AzureCredentialsValidationException e) {
credentials.validate();
final String validationResult = AzureVMManagementServiceDelegate.verifyConfiguration(credentials, resourceGroupName, maxVirtualMachinesLimit, deploymentTimeout);
if (!validationResult.equalsIgnoreCase(Constants.OP_SUCCESS)) {
return FormValidation.error(validationResult);
}
} catch (AzureCredentials.ValidationException e) {
return FormValidation.error(e.getMessage());
}
return FormValidation.ok(Messages.Azure_Config_Success());
Expand Down

0 comments on commit dd6d66d

Please sign in to comment.