-
Notifications
You must be signed in to change notification settings - Fork 27
AzureCreateVirtualMachineTask: introduce new task #346
Conversation
prebuilt-tasks/src/main/java/com/redhat/parodos/tasks/azure/AzureCreateVirtualMachineTask.java
Show resolved
Hide resolved
import com.azure.core.management.AzureEnvironment; | ||
import com.azure.core.management.Region; | ||
import com.azure.core.management.profile.AzureProfile; | ||
import com.azure.identity.*; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pls expand.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
prebuilt-tasks/src/main/java/com/redhat/parodos/tasks/azure/AzureCreateVirtualMachineTask.java
Show resolved
Hide resolved
prebuilt-tasks/src/main/java/com/redhat/parodos/tasks/azure/AzureCreateVirtualMachineTask.java
Show resolved
Hide resolved
VirtualMachine virtualMachine = azureResourceManager.virtualMachines().define(resourcesPrefix + "VM") | ||
.withRegion(Region.US_EAST).withExistingResourceGroup(resourcesPrefix + "ResourceGroup") | ||
.withExistingPrimaryNetworkInterface(networkInterface) | ||
.withPopularLinuxImage(KnownLinuxVirtualMachineImage.UBUNTU_SERVER_18_04_LTS) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we make this dynamic to support windows server or other systems?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1, I'd suggest to parameterized it (or a closed list of options) + also let the user specify VirtualMachineSizeTypes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest to have this change after the demo
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As from the first impression I got, its not just about changing the machine type, also the function (withPopularLinuxImage) and the size might be changed .
Need to investigate more about the types included.
079c20e
to
05db65b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please add some tests
prebuilt-tasks/pom.xml
Outdated
<dependency> | ||
<groupId>com.azure</groupId> | ||
<artifactId>azure-core</artifactId> | ||
<version>1.37.0</version> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please use properties for versions like we do it for other dependencies.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
catch (MissingParameterException e) { | ||
log.error("Task {} failed: missing required parameter, error: {}", getName(), e.getMessage()); | ||
} | ||
catch (Exception e) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please be specific which exceptions we want to catch here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Except to MissingParameterException
there is no known declared Exception that should be catched
Therefore I catch Exception
to cover any unexpected RuntimeException
@pkliczewski |
b30678f
to
0176a9c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
Added unit tests to the PR |
|
||
@Test | ||
public void testHappyFlow() { | ||
String publicIP = "11.11.11.11"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pls add tests using the convention:
/ /given
...
// when
..
// then
..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
Add new task creating VM on Azure cloud Currently it create Ubuntu
In order to include the unit tests this commit also include changes in the task Moving all azure API access to interface (mock it in the test)
…rkflow configuration
Also added instructions how to use the example workflow configuration |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: masayag The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Add new task creating VM on Azure cloud
Currently it create Ubuntu
What this PR does / why we need it:
This PR is created as part of the next demo requirements
*Which issue(s) this PR fixes:
Fixes #FLPATH-362
Change type
Impacted services
Checklist