Skip to content

Commit

Permalink
Releasing v1.0.5 (#60)
Browse files Browse the repository at this point in the history
* Updated Readme for Azure CLI actions  (#29)

* Update README.md

* Update README.md

Co-authored-by: Usha N <n-usha@github.com>

* Add changes

* Added add-label workflow (#41)

* Added add-label workflow

* Updated default label worlkflow for health dashboard

* Reduced time

* Added issue template for health dashboard (#42)

* Added issue template for health dashboard

* Added assignees

* Add 'getting help' section to point customers to Azure CLI Repo for help (#50)

Signed-off-by: James Casey <james.casey@microsoft.com>

* Write Test Case For Azure cli Action (#48)

* Create main.test.ts

* Create ci-workflow.yml

* Update main.ts

* Update ci-workflow.yml

* Update main.ts

* Update ci-workflow.yml

* Update ci-workflow.yml

* Resolved multiple README issues (#51)

* Resolved multiple issues

* revert

* Changed default for azcliversion. (#57)

* Added restrictLatestToAgent

* typo

* required set to false

* Changed default to agent az cli version

* deleted lib files

* Resolved comments

* Add changes

* Update package.json

* Update package-lock.json

* Upgrade version (#59)

* Revert "Update package-lock.json"

This reverts commit 5633362.

* Revert "Update package.json"

This reverts commit f4b36bb.

* Upgrade version in packkage.json

Co-authored-by: Zainudeen V K <zainuvk@github.com>
Co-authored-by: Usha N <n-usha@github.com>
Co-authored-by: GitHub Action <action@github.com>
Co-authored-by: James Casey <james.casey@microsoft.com>
Co-authored-by: PankajGovindRao <84085346+PankajGovindRao@users.noreply.github.com>
  • Loading branch information
6 people authored Nov 10, 2021
1 parent 4b58c94 commit 37ee7d1
Show file tree
Hide file tree
Showing 13 changed files with 618 additions and 96 deletions.
10 changes: 10 additions & 0 deletions .github/ISSUE_TEMPLATE/bug-report---feature-request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
name: Bug Report / Feature Request
about: Create a report to help us improve
title: ''
labels: need-to-triage
assignees: bishal-pdMSFT, t-dedah

---


47 changes: 47 additions & 0 deletions .github/config/labels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
- name: need-to-triage
color: "#fbca04"
description: "Requires investigation"

- name: idle
color: "#9A777A"
description: "Inactive for 14 days"

- name: stale
color: "#A9A9A9"
description: "90 days old"

- name: question
color: "#d876e3"
description: "Requiring some clarification"

- name: bug
color: "#d73a4a"
description: "Something is not working"

- name: P0
color: "#B60205"
description: "Action not working"

- name: P1
color: "#EE3D1D"
description: "Some scenario broken but workaround exists"

- name: enhancement
color: "#a2eeef"
description: "Feature request/improved experience"

- name: documentation
color: "#0075ca"
description: "Improvements or additions to documentation"

- name: backlog
color: "#bd7e4b"
description: "Planned for future"

- name: performance-issue
color: "#0e8a16"
description: "Performance improvement required"

- name: waiting-for-customer
color: "#0e8a16"
description: "Waiting for inputs from customer"
17 changes: 17 additions & 0 deletions .github/workflows/add-labels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: add-labels
on:
workflow_dispatch:

jobs:
test_action_job:
runs-on: ubuntu-latest
steps:
- name: Check out source code
uses: actions/checkout@v1
- name: Synchronize labels
uses: julb/action-manage-label@v1
with:
from: .github/config/labels.yml
skip_delete: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
58 changes: 58 additions & 0 deletions .github/workflows/ci-workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: ci-workflow
on:
push:
schedule:
- cron: '0 */3 * * *'

jobs:
test_action_job:
runs-on: ubuntu-latest
steps:
- name: Check out source code
uses: actions/checkout@v1
- uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: "12.x"
- run: npm install --production

- run: sudo npm i -g ts-node
- run: npm install typescript

- name: Azure CLI Version test
env:
INPUT_AZCLIVERSION: 2.0.72
INPUT_INLINESCRIPT: |
az account show
az storage -h
EXPECTED_TO: pass
run: ts-node test/main.test.ts

- name: Azure CLI Version Test - Negative
env:
INPUT_AZCLIVERSION: 0
INPUT_INLINESCRIPT: |
az account show
az storage -h
EXPECTED_TO: fail
run: ts-node test/main.test.ts

- name: Inline Script Test - Negative
env:
INPUT_AZCLIVERSION: 2.0.72
INPUT_INLINESCRIPT: " "
EXPECTED_TO: fail
run: ts-node test/main.test.ts

- name: Post to slack on failure
if: failure()
uses: 8398a7/action-slack@v3.9.1
with:
status: ${{ job.status }}
fields: repo,message,author,action,ref,workflow
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}

39 changes: 27 additions & 12 deletions .github/workflows/defaultLabel.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,36 @@
name: setting-default-labels

name: Mark issues "default"

# Controls when the action will run.
on:
schedule:
- cron: "0 0/3 * * *"

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
stale:

build:
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
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

- uses: actions/stale@v3
name: Setting issue as idle
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
stale-issue-message: 'This issue is idle because it has been open for 14 days with no activity.'
stale-issue-label: 'idle'
days-before-stale: 7
days-before-close: -1
operations-per-run: 100
exempt-issue-labels: 'backlog'

- uses: actions/stale@v3
name: Setting PR as idle
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
stale-pr-message: 'This PR is idle because it has been open for 14 days with no activity.'
stale-pr-label: 'idle'
days-before-stale: 5
days-before-close: -1
operations-per-run: 100
21 changes: 13 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,22 @@ With Azure CLI GitHub Action, you can automate your workflow by executing [Azure
The action executes the Azure CLI Bash script on a user defined Azure CLI version. If the user does not specify a version, latest CLI version is used.
Read more about various Azure CLI versions [here](https://github.com/Azure/azure-cli/releases).

- `azcliversion`**Optional** Example: 2.0.72, Default: latest
- `azcliversion`**Optional** Example: 2.0.72, Default: set to az cli version of the agent.
- `inlineScript`**Required**

Azure CLI GitHub Action 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.

The definition of this GitHub Action is in [action.yml](https://github.com/Azure/CLI/blob/master/action.yml). The action status is determined by the exit code returned by the script rather than StandardError stream.

## Note
Please note that the action executes Az CLI script in a docker container. This means that the action is subjected to potential restrictions which arise from containerized execution. For example:
1. If script sets up an environment variable, it will not take effect in host and hence subsequent actions shouldn't rely on such environment variable.
2. There is some restriction on how cross action file read/write is done. GITHUB_WORKSPACE directory in host is mapped to working directory inside container. So, if the action wants to create a file, which will be read by subsequent actions, it should do so within current working directory tree.

## Sample workflow

### Dependencies on other GitHub Actions
* [Azure Login](https://github.com/Azure/login)**Required** Login with your Azure credentials
* [Azure Login](https://github.com/Azure/login)**Optional** Login with your Azure credentials, required only for authentication via azure credentials. Authentication via connection strings or keys do not require this step.
* [Checkout](https://github.com/actions/checkout)**Optional** To execute the scripts present in your repository
### Workflow to execute an AZ CLI script of a specific CLI version
```
Expand Down Expand Up @@ -104,12 +111,6 @@ Follow the steps to configure the secret:
```
* Now in the workflow file in your branch: `.github/workflows/workflow.yml` replace the secret in Azure login action with your secret (Refer to the example above)


## Note
Please note that the action executes Az CLI script in a docker container. This means that the action is subjected to potential restrictions which arise from containerized execution. For example:
1. If script sets up an environment variable, it will not take effect in host and hence subsequent actions shouldn't rely on such environment variable.
2. There is some restriction on how cross action file read/write is done. GITHUB_WORKSPACE directory in host is mapped to working directory inside container. So, if the action wants to create a file, which will be read by subsequent actions, it should do so within current working directory tree.

## Azure CLI Action metadata file

```
Expand All @@ -131,6 +132,10 @@ runs:
main: 'lib/main.js'
```

# Getting Help for Azure CLI Issues

If you encounter an issue related to the Azure CLI commands executed in your script, you can file an issue directly on the [Azure CLI repository](https://github.com/Azure/azure-cli/issues/new/choose).

# Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a
Expand Down
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ inputs:
azcliversion:
description: 'Azure CLI version to be used to execute the script. If not provided, latest version is used'
required: false
default: 'latest'
default: 'agentazcliversion'
branding:
icon: 'login.svg'
color: 'blue'
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js

Large diffs are not rendered by default.

Loading

0 comments on commit 37ee7d1

Please sign in to comment.