-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 6ab3c37
Showing
4,372 changed files
with
308,537 additions
and
0 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Microsoft Open Source Code of Conduct | ||
|
||
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). | ||
|
||
Resources: | ||
|
||
- [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/) | ||
- [Microsoft Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) | ||
- Contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with questions or concerns |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) Microsoft Corporation. | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,180 @@ | ||
# GitHub Action for Creating Azure Container App Revision | ||
|
||
[GitHub Actions](https://help.github.com/en/articles/about-github-actions) provides the flexibility to build automated workflows for the software development lifecycle. | ||
|
||
GitHub Actions can be used to automate the workflow of deploying to [Azure Container App](https://azure.microsoft.com/en-us/services/container-apps/). | ||
|
||
Let's get started today with a [free Azure account](https://azure.com/free/open-source)! | ||
|
||
This repository contains to deploy to Azure Container App. It supports deploying your container image to an Azure Container App. | ||
|
||
This repository contains the [GitHub Action for Deploying to Azure Container App](./action.yml). | ||
|
||
The definition of this GitHub Action is in [action.yml](./action.yml). | ||
|
||
## End-to-End Sample Workflows | ||
|
||
### Dependencies on other GitHub Actions | ||
|
||
* [Azure Login](https://github.com/Azure/login) Login with your Azure Credentials for Authentication. Once login is done, the next set of Azure Actions in the workflow can re-use the same session within the job. | ||
|
||
### Azure Service Principal for RBAC | ||
|
||
For using any credentials like Azure Service Principal in your workflow, add them as [secrets](https://help.github.com/en/articles/virtual-enivronments-for-github-actions#creating-and-using-secrets-encrypted-variables) in the GitHub Repository and then refer them in the workflow. | ||
|
||
1. Download Azure CLI from [here](https://docs.microsoft.com/en-us/cli/azure/install-azure-cli?view=azure-cli-latest), run `az login` to login with your Azure Credentials. | ||
2. Run Azure CLI command to create an [Azure Service Principal for RBAC](https://docs.microsoft.com/en-us/azure/role-based-access-control/overview): | ||
|
||
```bash | ||
az ad sp create-for-rbac --name "myApp" --role contributor \ | ||
--scopes /subscriptions/{subscription-id}/resourceGroups/{resource-group} \ | ||
--sdk-auth | ||
|
||
# Replace {subscription-id}, {resource-group} with the subscription, resource group details of the WebApp | ||
# The command should output a JSON object similar to this: | ||
|
||
{ | ||
"clientId": "<GUID>", | ||
"clientSecret": "<GUID>", | ||
"subscriptionId": "<GUID>", | ||
"tenantId": "<GUID>", | ||
(...) | ||
} | ||
``` | ||
|
||
\* You can further scope down the Azure Credentials to the Web App using scope attribute. For example, | ||
|
||
```bash | ||
az ad sp create-for-rbac --name "myApp" --role contributor \ | ||
--scopes /subscriptions/{subscription-id}/resourceGroups/{resource-group}/providers/Microsoft.Web/sites/{app-name} \ | ||
--sdk-auth | ||
# Replace {subscription-id}, {resource-group}, and {app-name} with the names of your subscription, resource group, and Azure Web App. | ||
``` | ||
|
||
3. Paste the json response from above Azure CLI to your GitHub Repository > Settings > Secrets > Add a new secret > **AZURE_CREDENTIALS** | ||
|
||
1. 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 below) | ||
|
||
### Build and Deploy a Node.JS App to Azure Container App | ||
|
||
```yaml | ||
on: [push] | ||
name: Linux_Container_Workflow | ||
SAMPLE WORKFLOW WILL BE HERE | ||
``` | ||
|
||
### Example YAML Snippets | ||
|
||
#### Basic sample to create a revision | ||
|
||
```yaml | ||
on: [push, pull_request] | ||
name: Preview Deployment | ||
jobs: | ||
build-and-deploy: | ||
runs-on: ubuntu-latest | ||
env: | ||
RESOURCE_GROUP: <YOUR_RESOURCE_GROUP_NAME> | ||
CONTAINER_APP_NAME: <YOUR_CONTAINER_APP_NAME> | ||
DOCKER_IMAGE_NAME: <YOUR_DOCKER_IMAGE_NAME> | ||
# REVISION_NAME_SUFFIX: <YOUR_REVISION_NAME_SUFFIX> # Optional: Default is github commit hash | ||
steps: | ||
- name: 'Checkout GitHub Action' | ||
uses: actions/checkout@master | ||
- name: 'Login via Azure CLI' | ||
uses: azure/login@v1 | ||
with: | ||
creds: ${{ secrets.AZURE_CREDENTIALS }} | ||
- name: 'Create a new Container App revision' | ||
uses: azure/aca-preview@v0.1 | ||
with: | ||
resource-group: ${{ env.RESOURCE_GROUP }} | ||
name: ${{ env.CONTAINER_APP_NAME }} | ||
image: ${{ env.DOCKER_IMAGE_NAME }} | ||
``` | ||
|
||
##### Using customize suffice instead of git commit hash | ||
|
||
```yaml | ||
- name: 'Create a new Container App revision' | ||
uses: azure/aca-preview@v0.1 | ||
with: | ||
resource-group: ${{ env.RESOURCE_GROUP }} | ||
name: ${{ env.CONTAINER_APP_NAME }} | ||
image: ${{ env.DOCKER_IMAGE_NAME }} | ||
revision-name-suffix: ${{ env.REVISION_NAME_SUFFIX }} | ||
with: | ||
``` | ||
|
||
#### Create and Deactivate an action | ||
|
||
```yaml | ||
on: [push, pull_request] | ||
name: Preview Deployment | ||
jobs: | ||
build-and-deploy: | ||
runs-on: ubuntu-latest | ||
env: | ||
RESOURCE_GROUP: <YOUR_RESOURCE_GROUP_NAME> | ||
CONTAINER_APP_NAME: <YOUR_CONTAINER_APP_NAME> | ||
DOCKER_IMAGE_NAME: <YOUR_DOCKER_IMAGE_NAME> | ||
steps: | ||
- name: 'Checkout GitHub Action' | ||
uses: actions/checkout@master | ||
- name: 'Login via Azure CLI' | ||
uses: azure/login@v1 | ||
with: | ||
creds: ${{ secrets.AZURE_CREDENTIALS }} | ||
# Revision Creation | ||
- name: 'Create a new Container App revision' | ||
uses: azure/aca-preview@v0.1 | ||
with: | ||
resource-group: ${{ env.RESOURCE_GROUP }} | ||
name: ${{ env.CONTAINER_APP_NAME }} | ||
image: ${{ env.DOCKER_IMAGE_NAME }} | ||
# Revision Deactivation | ||
- name: Deactivate Preview Deployment | ||
if: github.event.action == 'closed' | ||
uses: azure/aca-preview@v0.0.1 | ||
with: | ||
deactivate-revision-mode: ture | ||
resource-group: ${{ env.RESOURCE_GROUP }} | ||
name: ${{ env.CONTAINER_APP_NAME }} | ||
image: ${{ env.DOCKER_IMAGE_NAME }} | ||
``` | ||
|
||
### How to develop/test this Action | ||
|
||
#### Debug with breakpoints on Visual Studio Code | ||
|
||
This action can be tried on not only GitHub Actions workflow but also your local PC or GitHub Codespaces. | ||
|
||
If you use Visual Studio Code, debugging this action with breakpoints can be used by running [`Launch Program` configuration](./.vscode/launch.json#L10). | ||
![image](https://user-images.githubusercontent.com/4566555/189843026-61153630-4151-4e6c-8a1e-16163aec0910.png) | ||
|
||
#### Check workflow behavior without pushing to GitHub | ||
|
||
Also, you can try to run your workflow with this action by executing [`npm run act`](./package.json#L8) on Visual Studio Code Remote-Container extension or GitHub Codespaces without pushing it to GitHub, because a devcontainer image for this repository includes `Docker-in-Docker` enabled devcontainer and `act`. | ||
|
||
For more detail, refer to following links. | ||
|
||
* `Docker-in-Docker`: <https://github.com/microsoft/vscode-dev-containers/blob/main/script-library/docs/docker-in-docker.md> . | ||
* `act`: <https://github.com/nektos/act> | ||
|
||
## Contributing | ||
|
||
This project welcomes contributions and suggestions. Most contributions require you to agree to a | ||
Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us | ||
the rights to use your contribution. For details, visit <https://cla.opensource.microsoft.com>. | ||
|
||
When you submit a pull request, a CLA bot will automatically determine whether you need to provide | ||
a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions | ||
provided by the bot. You will only need to do this once across all repos using our CLA. | ||
|
||
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). | ||
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or | ||
contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<!-- BEGIN MICROSOFT SECURITY.MD V0.0.3 BLOCK --> | ||
|
||
## Security | ||
|
||
Microsoft takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations, which include [Microsoft](https://github.com/Microsoft), [Azure](https://github.com/Azure), [DotNet](https://github.com/dotnet), [AspNet](https://github.com/aspnet), [Xamarin](https://github.com/xamarin), and [our GitHub organizations](https://opensource.microsoft.com/). | ||
|
||
If you believe you have found a security vulnerability in any Microsoft-owned repository that meets Microsoft's [Microsoft's definition of a security vulnerability](https://docs.microsoft.com/en-us/previous-versions/tn-archive/cc751383(v=technet.10)) of a security vulnerability, please report it to us as described below. | ||
|
||
## Reporting Security Issues | ||
|
||
**Please do not report security vulnerabilities through public GitHub issues.** | ||
|
||
Instead, please report them to the Microsoft Security Response Center (MSRC) at [https://msrc.microsoft.com/create-report](https://msrc.microsoft.com/create-report). | ||
|
||
If you prefer to submit without logging in, send email to [secure@microsoft.com](mailto:secure@microsoft.com). If possible, encrypt your message with our PGP key; please download it from the the [Microsoft Security Response Center PGP Key page](https://www.microsoft.com/en-us/msrc/pgp-key-msrc). | ||
|
||
You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://www.microsoft.com/msrc). | ||
|
||
Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue: | ||
|
||
* Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.) | ||
* Full paths of source file(s) related to the manifestation of the issue | ||
* The location of the affected source code (tag/branch/commit or direct URL) | ||
* Any special configuration required to reproduce the issue | ||
* Step-by-step instructions to reproduce the issue | ||
* Proof-of-concept or exploit code (if possible) | ||
* Impact of the issue, including how an attacker might exploit the issue | ||
|
||
This information will help us triage your report more quickly. | ||
|
||
If you are reporting for a bug bounty, more complete reports can contribute to a higher bounty award. Please visit our [Microsoft Bug Bounty Program](https://microsoft.com/msrc/bounty) page for more details about our active programs. | ||
|
||
## Preferred Languages | ||
|
||
We prefer all communications to be in English. | ||
|
||
## Policy | ||
|
||
Microsoft follows the principle of [Coordinated Vulnerability Disclosure](https://www.microsoft.com/en-us/msrc/cvd). | ||
|
||
<!-- END MICROSOFT SECURITY.MD BLOCK --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# TODO: The maintainer of this repo has not yet edited this file | ||
|
||
**REPO OWNER**: Do you want Customer Service & Support (CSS) support for this product/project? | ||
|
||
- **No CSS support:** Fill out this template with information about how to file issues and get help. | ||
- **Yes CSS support:** Fill out an intake form at [aka.ms/onboardsupport](https://aka.ms/onboardsupport). CSS will work with/help you to determine next steps. | ||
- **Not sure?** Fill out an intake as though the answer were "Yes". CSS will help you decide. | ||
|
||
*Then remove this first heading from this SUPPORT.MD file before publishing your repo.* | ||
|
||
# Support | ||
|
||
## How to file issues and get help | ||
|
||
This project uses GitHub Issues to track bugs and feature requests. Please search the existing | ||
issues before filing new issues to avoid duplicates. For new issues, file your bug or | ||
feature request as a new Issue. | ||
|
||
For help and questions about using this project, please **REPO MAINTAINER: INSERT INSTRUCTIONS HERE | ||
FOR HOW TO ENGAGE REPO OWNERS OR COMMUNITY FOR HELP. COULD BE A STACK OVERFLOW TAG OR OTHER | ||
CHANNEL. WHERE WILL YOU HELP PEOPLE?**. | ||
|
||
## Microsoft Support Policy | ||
|
||
Support for this **PROJECT or PRODUCT** is limited to the resources listed above. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
name: 'Create Azure Container App Revision for Review' | ||
description: 'GitHub Action to create a new Container App revision for PR review. github.com/Azure/Actions' | ||
inputs: | ||
resource-group: | ||
description: 'Name of the Resource Group in which the Container App will be created' | ||
required: true | ||
name: | ||
description: 'Name of the Container App' | ||
required: true | ||
image: | ||
description: Name of Container Image. If the `mode` input is `deactivate-revision`, this input is ignored. | ||
required: true | ||
revision-name-suffix: | ||
description: Suffixes for New Revision or Target Revision of deactivation. If the `mode` input is `deactivate-revision`, this input needs to be set. | ||
required: true | ||
deactivate-revision-mode: | ||
description: Enable Deactivation-Revision Mode of this action. `true` or `false`. Default value is `false` | ||
required: false | ||
outputs: | ||
app-url: | ||
description: 'Deployed App URL' | ||
branding: | ||
icon: 'azure-logo.svg' | ||
color: 'blue' | ||
runs: | ||
using: 'node16' | ||
main: 'lib/main.js' |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file.
Oops, something went wrong.