Skip to content

Commit

Permalink
Updating release branch to release new version (#31)
Browse files Browse the repository at this point in the history
* Update action.yml (#6)

* Update action.yml - update name (#9)

* Update action.yml

* Update action.yml

* enable local debugging (#8)

* Fixing ci tests and adding code owners (#11)

* fix ci tests with codeowners

* adding how to debug.md

* updating uri

* updating test file

* updating test file

* error for deployment

* error for deployment

* updating options

* Add changes

* space and warning fix (#12)

* Add changes

* Updates in action.yaml (#13)

* action edits

* update content

* Adding validate mode (#14)

* adding validate mode

* update readme

* PR review

* PR review

* Add changes

* Added workflow for stale issues

* Update stale.yml

* Adding workflow for default label

* Upgrade @actions/core to version 1.2.6 or later (#24)

* Upgrade @actions/core to version 1.2.6 or later

This is as per the security vulnerability : https://github.com/Azure/arm-deploy/network/alert/package-lock.json/@actions%2Fcore/open

* update

Co-authored-by: Kanika Pasrija <[email protected]>

* Add changes

* Documentation for ReleaseProcess (#25)

* Create ReleaseProcess.md

* Update HowToDebug.md

* Update ReleaseProcess.md

* Update ReleaseProcess.md

* updating references in advance examples (#20)

* updating reference

* updating reference

* Updated Readme for Azure ARM Deploy Action (#28)

* Update README.md

* Update README.md

Co-authored-by: Usha N <[email protected]>

* Change the subscriptionId paremeter to be completely optional (#19)

* Change the subscriptionId paremeter to be completely optional

Use the subscription id set by the Azure Login action by default.

* address feedback

* Update exampleGuide.md (#26)

* Update exampleGuide.md

* Update exampleGuide.md

* Add changes

* Update ReleaseProcess.md

Dummy commit to run build-release WF

Co-authored-by: Bishal Prasad <[email protected]>
Co-authored-by: GitHub Action <[email protected]>
Co-authored-by: t-dedah <[email protected]>
Co-authored-by: Deepak Dahiya <[email protected]>
Co-authored-by: Kanika Pasrija <[email protected]>
Co-authored-by: pulkitaggarwl <[email protected]>
Co-authored-by: Zainudeen V K <[email protected]>
Co-authored-by: Usha N <[email protected]>
Co-authored-by: harvey-k <[email protected]>
  • Loading branch information
10 people authored Feb 18, 2021
1 parent 0541b76 commit 70ed799
Show file tree
Hide file tree
Showing 24 changed files with 314 additions and 216 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @bishal-pdmsft @kanika1894 @pulkitaggarwl
39 changes: 35 additions & 4 deletions .github/workflows/ci-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,44 @@ jobs:

- run: sudo npm i -g ts-node

- name: Test
- name: Resource group scope test
env:
INPUT_SCOPE: resourcegroup
INPUT_SUBSCRIPTIONID: ${{ secrets.SUBSCRIPTION_ID }}
INPUT_RESOURCEGROUPNAME: azurearmaction
INPUT_RESOURCEGROUPNAME: E2eTestResourceGroupForArmAction
INPUT_TEMPLATE: https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/101-webapp-basic-linux/azuredeploy.json
INPUT_PARAMETERS: https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/101-webapp-basic-linux/azuredeploy.parameters.json
INPUT_DEPLOYMENTNAME: github-test-rg
INPUT_DEPLOYMENTMODE: Complete
run: ts-node test/main.tests.ts

- name: Management group scope test
env:
INPUT_SCOPE: managementgroup
INPUT_MANAGEMENTGROUPID: E2eTestGroupForArmAction
INPUT_REGION: WestUS
INPUT_TEMPLATE: ./test/template.json
INPUT_PARAMETERS: ./test/parameters.json
INPUT_DEPLOYMENTNAME: github-test
INPUT_DEPLOYMENTMODE: Incremental
INPUT_DEPLOYMENTNAME: github-test-mg
run: ts-node test/main.tests.ts

- name: Subscription scope test
env:
INPUT_SCOPE: subscription
INPUT_SUBSCRIPTIONID: ${{ secrets.SUBSCRIPTION_ID }}
INPUT_REGION: centralus
INPUT_TEMPLATE: https://raw.githubusercontent.com/Azure/azure-docs-json-samples/master/azure-resource-manager/emptyRG.json
INPUT_PARAMETERS: rgName=demoResourceGroup rgLocation=centralus
INPUT_DEPLOYMENTNAME: github-test-subs
run: ts-node test/main.tests.ts

- name: Validate mode test
env:
INPUT_SCOPE: resourcegroup
INPUT_SUBSCRIPTIONID: ${{ secrets.SUBSCRIPTION_ID }}
INPUT_RESOURCEGROUPNAME: E2eTestResourceGroupForArmAction
INPUT_TEMPLATE: https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/101-webapp-basic-linux/azuredeploy.json
INPUT_PARAMETERS: https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/101-webapp-basic-linux/azuredeploy.parameters.json
INPUT_DEPLOYMENTNAME: github-test-rg
INPUT_DEPLOYMENTMODE: Validate
run: ts-node test/main.tests.ts
20 changes: 20 additions & 0 deletions .github/workflows/defaultLabel.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Mark issues "default"

on:
schedule:
- cron: "0 0/3 * * *"

jobs:
stale:

runs-on: ubuntu-latest

steps:
- uses: actions/stale@v3
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
stale-issue-message: 'This issue is marked default for generating issues report.'
stale-issue-label: 'default'
days-before-stale: 0
days-before-close: -1
operations-per-run: 100
20 changes: 20 additions & 0 deletions .github/workflows/stale.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Mark stale issues

on:
schedule:
- cron: "0 0/3 * * *"

jobs:
stale:
runs-on: ubuntu-latest

steps:
- uses: actions/stale@v3
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
stale-issue-message: "This issue is stale because it has been open for 7 days with no activity."
stale-issue-label: "stale"
days-before-stale: 7
days-before-close: -1
operations-per-run: 100
exempt-issue-labels: "backlog"
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore

# local built files
_build

# User-specific files
*.rsuser
*.suo
Expand Down
29 changes: 29 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"skipFiles": [
"<node_internals>/**"
],
"program": "${workspaceFolder}/src/entrypoint.ts",
"outFiles": [
"${workspaceFolder}/_build/*.js"
],
"env": {
"INPUT_SCOPE": "resourcegroup",
"INPUT_SUBSCRIPTIONID": "c00d16c7-6c1f-4c03-9be1-6934a4c49682",
"INPUT_RESOURCEGROUPNAME": "kptest",
"INPUT_TEMPLATE": "./test/template.json",
"INPUT_PARAMETERS": "./test/parameters.json",
"INPUT_DEPLOYMENTNAME": "github-test",
"INPUT_DEPLOYMENTMODE": "Incremental"
}
}
]
}
16 changes: 16 additions & 0 deletions HowToDebug.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
**Debugging the ARM action in local machine**

Open PowerShell, go to the directory where the repo is stored (.../arm-deploy/) and execute the following commands.

**1.npm install** \
npm install downloads dependencies defined in a package. json file and generates a node_modules folder with the installed modules. \
**2.npm install -g @vercel/ncc** \
**3.ncc build src/entrypoint.ts -s -o _build** \
ncc is a simple CLI for compiling a Node.js module into a single file, together with all its dependencies, gcc-style. \
**4. az login** \
This will open the browser, where you can do the Azure login which gives you proper access required for the action.

Open the arm-deploy repository in VSCode, attach debugging points at required places _(flow begins from entrypoint.ts)_ and press F5. The debugger gets attached.

Also, for various input values required while testing, you can specify those as environment variables in launch.json that gets created. \
_Happy debugging!_
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ This action can be used to deploy Azure Resource Manager templates at different

* `scope`: Provide the scope of the deployment. Valid values are: `resourcegroup`(default) , `subscription`, `managementgroup`.
* `resourceGroupName`: **Conditional** Provide the name of a resource group. Only required for Resource Group Scope
* `subscriptionId`: **Conditional** Provide the subscription ID which should be used. Only required for scope `resourcegroup` & `subscription`.
* `subscriptionId`: **Conditional** Provide a value to override the subscription ID set by [Azure Login](https://github.com/Azure/login).
* `managementGroupId`: **Conditional** Specify the Management Group ID, only required for Management Group Deployments.
* `region`: **Conditional** Provide the target region, only required for Management Group or Subscription deployments.
* `template`: **Required** Specify the path or URL to the Azure Resource Manager template.
* `parameters`: Specify the path or URL to the Azure Resource Manager deployment parameter values. Or local / remote value file.
* `deploymentMode`: `Incremental`(default) (only add resources to resource group) or `Complete` (remove extra resources from resource group).
* `deploymentMode`: `Incremental`(default) (only add resources to resource group) or `Complete` (remove extra resources from resource group) or `Validate` (only validates the template).
* `deploymentName`: Specifies the name of the resource group deployment to create.


Expand Down Expand Up @@ -52,7 +52,6 @@ jobs:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- uses: azure/arm-deploy@v1
with:
subscriptionId: e1046c08-7072-****-****-************
resourceGroupName: github-action-arm-rg
template: ./azuredeploy.json
parameters: storageAccountType=Standard_LRS
Expand All @@ -66,7 +65,6 @@ In this exmaple, our template outputs `containerName`.
- uses: azure/arm-deploy@v1
id: deploy
with:
subscriptionId: e1046c08-7072-****-****-************
resourceGroupName: azurearmaction
template: examples/template/template.json
parameters: examples/template/parameters.json
Expand All @@ -93,6 +91,10 @@ If we now add a Shell script with a simple echo from that value, we can see that
- run: echo ${{ steps.deploy.outputs.containerName }}
```

ARM Deploy Actions is supported for the Azure public cloud as well as Azure government clouds ('AzureUSGovernment' or 'AzureChinaCloud') and Azure Stack ('AzureStack') Hub. Before running this action, login to the respective Azure Cloud using [Azure Login](https://github.com/Azure/login) by setting appropriate value for the `environment` parameter.

For more examples, refer : [Example Guide](https://github.com/Azure/arm-deploy/blob/main/examples/exampleGuide.md)

# Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a
Expand Down
16 changes: 16 additions & 0 deletions ReleaseProcess.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
**Releasing a new version**

Semanting versioning is used to release different versions of the action. Following steps are to be followed :

1. Create a new branch for every major version. \
Example, releases/v1, releases/v2.
2. For every minor and patch release for a major version, update the corresponding release branch. \
Example, for releasing v1.1.1, update releases/v1.
3. Create tags for every new release (major/minor/patch). \
Example,v1.0.0. , v1.0.1, v2.0.1, etc. and also have tags like v1, v2 for every major version release.
4. On releasing minor and patch versions, update the tag of the corresponding major version. \
Example, for releasing v1.0.1, update the v1 tag to point to the ref of the current release. \
The following commands are to be run on the release\v1 branch so that it picks the latest commit and updates the v1 tag accordingly :
(Ensure that you are on same commit locally as you want to release.)
* `git tag -fa v1 -m "Update v1 tag"`
* `git push origin v1 --force`
9 changes: 4 additions & 5 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ name: "Deploy Azure Resource Manager (ARM) Template"
description: "Use this GitHub Action task to deploy Azure Resource Manager (ARM) template"
inputs:
scope:
description: "Provide the scope of the deployment. alid values are: 'resourcegroup', 'managementgroup', 'subscription'"
description: "Provide the scope of the deployment. Valid values are: 'resourcegroup', 'managementgroup', 'subscription'"
required: true
subscriptionId:
description: "Provide the Id of the subscription which should be used."
description: "Override the Subscription Id set by Azure Login."
required: false
managementGroupId:
description: "Specify the Id for the Management Group, only required for Management Group Deployments."
Expand All @@ -14,15 +14,14 @@ inputs:
description: "Provide the target region, only required for management Group or Subscription deployments."
required: false
resourceGroupName:
description: "Provide the name of a resource group."
description: "Provide the name of a resource group, only required for resource Group deployments."
required: false
template:
description: "Specify the path or URL to the Azure Resource Manager template."
required: true
deploymentMode:
description: "Incremental (only add resources to resource group) or Complete (remove extra resources from resource group)."
description: "Incremental (only add resources to resource group) or Complete (remove extra resources from resource group) or Validate (only validates the template)."
required: false
default: Incremental
deploymentName:
description: "Specifies the name of the resource group deployment to create."
required: false
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js

Large diffs are not rendered by default.

8 changes: 3 additions & 5 deletions examples/Advanced.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@ Our template has two outputs `location` and `containerName`. But we are only int

## Steps
```yaml
- uses: whiteducksoftware/azure-arm-action-js@v3
- uses: azure/arm-deploy@v1
id: deploy
with:
scope: resourcegroup
subscriptionId: e1046c08-7072-****-****-************
resourceGroupName: azurearmaction
template: examples/template/template.json
parameters: examples/template/parameters.json
Expand Down Expand Up @@ -37,11 +36,10 @@ we can see that on the console will be `github-action` printed.

Now we add our second deployment which relies on that value and modfies the `containerName` parameter,
```yaml
- uses: whiteducksoftware/azure-arm-action-js@v3
- uses: azure/arm-deploy@v1
id: deploy2
with:
scope: resourcegroup
subscriptionId: e1046c08-7072-****-****-************
resourceGroupName: azurearmaction
template: examples/template/template.json
parameters: examples/template/parameters.json containerName=${{ steps.deploy.outputs.containerName }}-overriden
Expand All @@ -51,4 +49,4 @@ Look at the `parameters` section, where we plug in another `parameter.json` File
```yaml
- run: echo ${{ steps.deploy2.outputs.containerName }}
```
we can see that on the console will be `github-action-overriden` printed.
we can see that on the console will be `github-action-overriden` printed.
8 changes: 3 additions & 5 deletions examples/advanced-example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,26 +15,24 @@ jobs:
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}

- uses: whiteducksoftware/azure-arm-action-js@v3
- uses: azure/arm-deploy@v1
id: deploy
with:
scope: resourcegroup
subscriptionId: e1046c08-7072-****-****-************
resourceGroupName: azurearmaction
template: examples/template/template.json
parameters: examples/template/parameters.json
deploymentName: github-advanced-test

- run: echo ${{ steps.deploy.outputs.containerName }}

- uses: whiteducksoftware/azure-arm-action-js@v3
- uses: azure/arm-deploy@v1
id: deploy2
with:
scope: resourcegroup
subscriptionId: e1046c08-7072-****-****-************
resourceGroupName: azurearmaction
template: examples/template/template.json
parameters: examples/template/parameters.json containerName=${{ steps.deploy.outputs.containerName }}-overriden
deploymentName: github-advanced-test

- run: echo ${{ steps.deploy2.outputs.containerName }}
- run: echo ${{ steps.deploy2.outputs.containerName }}
10 changes: 6 additions & 4 deletions examples/exampleGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ Different scopes:
resourceGroupName**: demoGroup
template: examples/template/template.json


There are a lot of [sample templates](https://github.com/Azure/azure-quickstart-templates) available which can be used for deployment.

**Subscription**
Expand All @@ -28,13 +27,16 @@ More [Sample templates](https://github.com/Azure/azure-quickstart-templates/tree
scope: managementgroup
managementGroupId: demoId
region: centralus
template: https://teststorage.blob.......... /template.json
parameters: https://teststorage.blob.......... /parameters.json
template: https://teststorage.blob/template.json
parameters: https://teststorage.blob/parameters.json

[Sample templates](https://github.com/Azure/azure-quickstart-templates/tree/master/managementgroup-deployments) can be found here.
**Note:** Parameter value specified in parameter file can be overridden by specifying it along with parameter file name.
Example:
parameters: https://teststorage.blob/parameters.json parameterName=parameterValue

**Things to keep in mind:**

* For all scenarios, you can either paste the template in your repo and provide its location or can use the URI of the template directly. Same thing applies to providing parameters.
* Authorization issue can be due to lack of proper access to the secret AZURE_CREDENTIALS. So, ensure that the secret has proper rights.
* DeploymentMode is a parameter required only in case of Resource group deployments. It can either be incremental(default) or complete.
* DeploymentMode is a parameter required only in case of Resource group deployments. It can either be incremental(default) or complete.
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"typescript": "^3.8.3"
},
"dependencies": {
"@actions/core": "^1.2.3",
"@actions/core": "^1.2.6",
"@actions/exec": "^1.0.3",
"@actions/io": "^1.0.2",
"@types/assert": "^1.4.7",
Expand Down
Loading

0 comments on commit 70ed799

Please sign in to comment.