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

Enable source control management as option for user to deploy web apps #826

Merged
merged 26 commits into from
Mar 28, 2018

Conversation

metacpp
Copy link
Contributor

@metacpp metacpp commented Feb 13, 2018

This PR includes:

  1. New argument, scm_type, as deployment option for web app. Supported value list include "None" and "LocalGit", will add more options in a later time.
  2. New site_source_control_props with necessary git repo and branch information.

TestAccAzureRMAppService

@metacpp metacpp added this to the 1.1.2 milestone Feb 13, 2018
Copy link
Contributor

@tombuildsstuff tombuildsstuff left a comment

Choose a reason for hiding this comment

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

hey @metacpp

Thanks for this PR - I've taken a look through and this mostly looks good to me; it'd be good to expose the value of the Source Control URL, so that folks could use this value without having to go to the Portal first; so can we look into adding that?

Thanks!

@@ -160,6 +162,8 @@ The following arguments are supported:

* `websockets_enabled` - (Optional) Should WebSockets be enabled?

* `scm_type` - (Optional) The Source Control Management Type. Possible values are `None` and `LocalGit`. Defaults to `None`.
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd suggest we change this to:

* `scm_type` - (Optional) The type of Source Control enabled for this App Service. Possible values include `None` and `LocalGit`. Defaults to `None`

and add a blue info box below it - stating the other types are coming soon

-> **Note:** Additional Source Control types will be added in the future, once support for them has been added in the Azure SDK for Go.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good suggestion.

string(web.ScmTypeNone),
string(web.ScmTypeLocalGit),
}, false),
},
Copy link
Contributor

Choose a reason for hiding this comment

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

so it'd also be good to expose the value of the SCM URL as a computed field - which I believe should be returned from the GetSourceControl API call when this is set to ScmTypeLocalGit?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the reminding, this is exactly what I did the recent commit, please see changes.

@metacpp
Copy link
Contributor Author

metacpp commented Feb 14, 2018

@tombuildsstuff I've updated the PR to include the repo url and branch name.

Copy link
Contributor

@tombuildsstuff tombuildsstuff left a comment

Choose a reason for hiding this comment

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

adding pending comments which have since been fixed


"site_source_control_props": {
Type: schema.TypeList,
Optional: true,
Copy link
Contributor

Choose a reason for hiding this comment

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

given this isn't user-settable - we can remove the Optional assignment here (Computed is read-only)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes.

@@ -239,6 +248,23 @@ func resourceArmAppService() *schema.Resource {
Type: schema.TypeString,
Computed: true,
},

"site_source_control_props": {
Copy link
Contributor

Choose a reason for hiding this comment

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

can we rename this source_control (to match the other fields)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure.


"source_control": {
Type: schema.TypeList,
Optional: true,
Copy link
Contributor

Choose a reason for hiding this comment

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

can we remove this Optional assignment? it's only needed for user specifiable fields (and not readonly ones)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch.

`source_control` supports the following:

* `repo_url` - URL of the Git repo.
* `branch` - Branch name of the Git repo.
Copy link
Contributor

Choose a reason for hiding this comment

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

can we suffix both of these with .. the Git repository for this App Service

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

Copy link
Contributor

@tombuildsstuff tombuildsstuff left a comment

Choose a reason for hiding this comment

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

hey @metacpp

Thanks for pushing those latest updates - if we can remove the Optional field assignment this otherwise looks good to me.

Thanks!

return fmt.Sprintf(`
resource "azurerm_resource_group" "test" {
name = "acctestRG-%d"
location = "%s"
Copy link

Choose a reason for hiding this comment

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

Aligning at '='?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch.

app_service_plan_id = "${azurerm_app_service_plan.test.id}"

site_config {
scm_type = "LocalGit"
Copy link

Choose a reason for hiding this comment

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

Reduce spaces here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch.

@metacpp
Copy link
Contributor Author

metacpp commented Feb 14, 2018

@tombuildsstuff the PR has been updated, please check.

tombuildsstuff
tombuildsstuff previously approved these changes Feb 15, 2018
Copy link
Contributor

@tombuildsstuff tombuildsstuff left a comment

Choose a reason for hiding this comment

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

LGTM 👍 I'll kick off the test suite now

@metacpp
Copy link
Contributor Author

metacpp commented Feb 15, 2018

@tombuildsstuff Thanks for the reviewing.

@tombuildsstuff
Copy link
Contributor

@metacpp given App Service Slots shares the same Set function - it appears we need to add the field to that schema too:

------- Stdout: -------
=== RUN   TestAccAzureRMAppServiceSlot_importBasic
--- FAIL: TestAccAzureRMAppServiceSlot_importBasic (51.57s)
    testing.go:459: Step 0 error: Error applying: 1 error(s) occurred:
        
        * azurerm_app_service_slot.test: 1 error(s) occurred:
        
        * azurerm_app_service_slot.test: Invalid address to set: []string{"site_config", "0", "scm_type"}
    testing.go:519: Error destroying resource! WARNING: Dangling resources
        may exist. The full state and error is shown below.
        
        Error: Error refreshing: 1 error(s) occurred:
        
        * azurerm_app_service_slot.test: azurerm_app_service_slot.test: Invalid address to set: []string{"site_config", "0", "scm_type"}
        
        State: <nil>
FAIL

I'll push a commit for this today

@tombuildsstuff tombuildsstuff dismissed their stale review February 15, 2018 19:35

the tests reveal this requires a fix to the App Service Slot schema

@tombuildsstuff tombuildsstuff self-assigned this Feb 15, 2018
@metacpp metacpp reopened this Mar 21, 2018
@metacpp
Copy link
Contributor Author

metacpp commented Mar 21, 2018

@tombuildsstuff I reopened this PR coz I worked with App Service team have the LocalGit deployment supported.

@metacpp metacpp modified the milestones: Future, 1.3.1, 1.4.0 Mar 21, 2018
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"user_name": {
Copy link
Contributor

Choose a reason for hiding this comment

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

we'd tend to write this as username - I'll push a commit to make this consistent

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the updating.

Copy link
Contributor

@tombuildsstuff tombuildsstuff left a comment

Choose a reason for hiding this comment

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

One minor comment (which I'll push a commit for) - but this otherwise LGTM 👍

Thanks!

@tombuildsstuff
Copy link
Contributor

App Service tests pass:

screen shot 2018-03-28 at 10 00 13

@tombuildsstuff tombuildsstuff merged commit 7020f3e into master Mar 28, 2018
@tombuildsstuff tombuildsstuff deleted the hack_scm branch March 28, 2018 14:01
tombuildsstuff added a commit that referenced this pull request Mar 28, 2018
@ghost
Copy link

ghost commented Mar 31, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 hashibot-feedback@hashicorp.com. Thanks!

@ghost ghost locked and limited conversation to collaborators Mar 31, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants