Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
danieljurek committed Jul 7, 2022
0 parents commit 3c6e5d7
Show file tree
Hide file tree
Showing 541 changed files with 183,423 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Contributing to `azd`

Please see [this document](./cli/azd/CONTRIBUTING.md) on how to contribute to this project.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright 2022 (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
27,427 changes: 27,427 additions & 0 deletions NOTICE.txt

Large diffs are not rendered by default.

63 changes: 63 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# Azure Developer CLI

Latest (daily) builds:

| Package | Version | Download |
| ------- | ------- | -------- |
| azd | ![azd version](https://img.shields.io/endpoint?url=https%3A%2F%2Fazuresdkreleasepreview.blob.core.windows.net%2Fazd%2Fstandalone%2Flatest%2Fshield.json) | [Windows](https://azuresdkreleasepreview.blob.core.windows.net/azd/standalone/latest/azd-windows-amd64.zip) | [Linux](https://azuresdkreleasepreview.blob.core.windows.net/azd/standalone/latest/azd-linux-amd64.tar.gz) | [Mac](https://azuresdkreleasepreview.blob.core.windows.net/azd/standalone/latest/azd-darwin-amd64.zip) |
| vscode extension | ![vscode extension version](https://img.shields.io/endpoint?url=https%3A%2F%2Fazuresdkreleasepreview.blob.core.windows.net%2Fazd%2Fvscode%2Flatest%2Fshield.json) | [VSIX](https://azuresdkreleasepreview.blob.core.windows.net/azd/vscode/latest/azure-dev-latest.vsix) |

The Azure Developer CLI (**azure-dev**) is a developer-centric command-line interface (CLI) tool for creating Azure applications. The goals of the CLI are to:

- reduce the time required for a developer to be productive
- demonstrate opinionated best practices for Azure development
- help developers understand core Azure development constructs

To take full advantage of the CLI, code repositories need to conform to a well defined set of [conventions](https://github.com/Azure/azure-dev/wiki/Azure-Developer-CLI-Overview) that will be recognized by the tooling. Please checkout the [wiki](https://github.com/Azure/azure-dev/wiki) for more information and to get started. Use [discussions](https://github.com/Azure/azure-dev/discussions) to participate in the conversation, ask questions, and see the latest announcements.

## Install/Upgrade Azure Developer CLI

Install and Upgrade using the following scripts. Re-running the script will install the latest available version (daily)

### Windows

```powershell
powershell -c "Set-ExecutionPolicy Bypass Process -Force; irm 'https://aka.ms/install-azd.ps1' | iex"
```

### Linux/MacOS

```
curl -fsSL https://aka.ms/install-azd.sh | bash
```


## Data Collection

The software may collect information about you and your use of the software and send it to Microsoft. Microsoft may use this information to provide services and improve our products and services. You may turn off the telemetry as described in the repository. There are also some features in the software that may enable you and Microsoft to collect data from users of your applications. If you use these features, you must comply with applicable law, including providing appropriate notices to users of your applications together with a copy of Microsoft's privacy statement. Our privacy statement is located at https://go.microsoft.com/fwlink/?LinkID=824704. You can learn more about data collection and use in the help documentation and our privacy statement. Your use of the software operates as your consent to these practices.

### Telemetry Configuration

Telemetry collection is on by default.

To opt out, set the environment variable `AZURE_DEV_COLLECT_TELEMETRY` to `no` in your environment.

## 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.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., label, comment). Simply follow the instructions
provided by the bot. You will only need to do this once across all repos using our CLA.

Please see our [contributing guide](cli/azd/CONTRIBUTING.md) for complete instructions on how you can contribute to the Azure Developer CLI.

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 [[email protected]](mailto:[email protected]) with any additional questions or comments.

## Trademark Notice

Trademarks This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow Microsoft’s Trademark & Brand Guidelines. Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party’s policies.
41 changes: 41 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<!-- BEGIN MICROSOFT SECURITY.MD V0.0.6 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 definition of a security vulnerability](https://docs.microsoft.com/previous-versions/tn-archive/cc751383(v=technet.10)), 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 [[email protected]](mailto:[email protected]). If possible, encrypt your message with our PGP key; please download it from the [Microsoft Security Response Center PGP Key page](https://www.microsoft.com/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/msrc/cvd).

<!-- END MICROSOFT SECURITY.MD BLOCK -->
Binary file added assets/hero.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
36 changes: 36 additions & 0 deletions cli/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
FROM mcr.microsoft.com/dotnet/sdk:6.0

WORKDIR /app

RUN export DEBIAN_FRONTEND=noninteractive \
&& wget -q https://packages.microsoft.com/config/ubuntu/19.04/packages-microsoft-prod.deb && dpkg -i packages-microsoft-prod.deb \
&& apt-get update && apt-get install -y --no-install-recommends apt-utils && apt-get install -y apt-transport-https ca-certificates curl unzip procps gnupg2 software-properties-common lsb-release \
# functions core tools
&& curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg \
&& mv microsoft.gpg /etc/apt/trusted.gpg.d/microsoft.gpg \
&& sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/debian/$(lsb_release -rs | cut -d'.' -f 1)/prod $(lsb_release -cs) main" > /etc/apt/sources.list.d/dotnetdev.list' \
&& apt-get update && apt-get install -y azure-functions-core-tools-4 \
# docker
&& curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add - \
&& add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable" \
&& apt-get update && apt-get install -y docker-ce-cli \
# gh cli
&& curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | gpg --dearmor -o /usr/share/keyrings/githubcli-archive-keyring.gpg \
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | tee /etc/apt/sources.list.d/github-cli.list > /dev/null \
&& apt-get update && apt-get install -y gh \
# az cli
&& curl -sSL https://aka.ms/InstallAzureCLIDeb | bash \
# bicep
&& az bicep install \
# nodejs
&& curl -fsSL https://deb.nodesource.com/setup_16.x | bash - \
&& apt-get install -y nodejs \
# python
&& apt-get install -y --no-install-recommends python3-pip python-dev \
&& python3 -m pip install --upgrade pip \
&& echo 'alias python=python3' >> ~/.bashrc \
&& echo 'alias pip=pip3' >> ~/.bashrc \
&& apt-get clean -y && rm -rf /var/lib/apt/lists/*
# azd
COPY cli/bin/azd-linux-amd64 /usr/bin/azd
COPY NOTICE.txt .
3 changes: 3 additions & 0 deletions cli/azd/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
azd
azd.exe
build
9 changes: 9 additions & 0 deletions cli/azd/.golangci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
linters:
enable:
- errorlint
- gofmt
linters-settings:
errorlint:
errorf: true
asserts: true
comparison: true
45 changes: 45 additions & 0 deletions cli/azd/.vscode/cspell-azd-dictionary.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
AADSTS
appservice
AZCLI
azdcli
azddeploy
azdev
azdinternal
azdtempl
azdtempl
azdtest
azsdk
AZURECLI
azureutil
byts
containerapp
csharpapp
devel
eastus
envname
errcheck
errorlint
executil
funcapp
functestapp
functionapp
GOARCH
godotenv
golangci
ldflags
mgmt
nodeapp
nolint
omitempty
osutil
pflag
pyapp
restoreapp
rzip
sstore
staticwebapp
structs
swacli
unmarshaling
westus2
yacspin
49 changes: 49 additions & 0 deletions cli/azd/.vscode/cspell.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.

# cspell settings azd cli

# Use global config
import: ../../../.vscode/cspell.global.yaml

# Use words for non-project-specific words only.
# Use azdProjectDictionary to add project-specific words.
words:
- backoff
- Codespace
- Codespaces
- Retryable
- Canonicalize
dictionaryDefinitions:
- name: azdProjectDictionary
path: ./cspell-azd-dictionary.txt
description: Custom Workspace Dictionary
addWords: true
scope: workspace
dictionaries:
- azdProjectDictionary
overrides:
- filename: pkg/tools/python.go
words:
- venv
- filename: pkg/spin/run.go
words:
- errored
- filename: pkg/project/framework_service_python.go
words:
- __pycache__
- Venv
- filename: pkg/project/project_test.go
words:
- Aapi
- Aweb
- Aworker
- azdtempl
- filename: pkg/executil/executil_windows.go
words:
- hndl
- JOBOBJECT
- filename: pkg/environment/azd_context.go
words:
- ents
- unmarshalled
9 changes: 9 additions & 0 deletions cli/azd/.vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
// See http://go.microsoft.com/fwlink/?LinkId=827846
// for the documentation about the extensions.json format
"recommendations": [
"golang.go",
"streetsidesoftware.code-spell-checker",
"redhat.vscode-yaml"
]
}
7 changes: 7 additions & 0 deletions cli/azd/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"go.testTimeout": "10m",
"go.lintTool": "golangci-lint",
"go.lintOnSave": "package",
"cSpell.import": ["cspell.yaml"]
}

77 changes: 77 additions & 0 deletions cli/azd/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# Contributing to `azd`

## Prerequisites

`azd` is written in Golang and requires Go 1.18 or above:

- [Go](https://go.dev/dl/)

If you don't have a preferred editor for Go code, we recommend [Visual Studio Code](https://code.visualstudio.com/Download). We have a `settings.json` file checked in, so if you launch `code` from within `cli/azd` you should get our customizations.

It also requires the `az` CLI:

- [AZ CLI](https://docs.microsoft.com/cli/azure/)

We have some additional linting tools that we run in CI, and you will want to be able to run locally:

- [golangci-lint](https://golangci-lint.run/usage/install/#local-installation)

In order to run some of the tests, you'll need the toolchain for all the languages we support:

- [NodeJS](https://nodejs.org/en/download/)
- [Python](https://www.python.org/downloads)
- [DotNet CLI](https://get.dot.net)

Also, you'll want to install Docker (as we use that for some of our tests)

- [Docker](https://docs.docker.com/desktop/#download-and-install)

## Submitting A Change

As part of our pre-check-in validation we run tests that require creating Azure resources. Right now this requires that PRs don't come from Forks.

1. Create a branch named `<your-github-user>/<some-description>` (e.g. `ellismg/fix-123` for a bug fix or `ellismg/add-deploy-command`).
2. Push the branch to `azure/azure-dev` on GitHub.
3. Open a pull request in GitHub.

## Debugging

In VS Code you can create a launch.json that runs the tool with a specified set of arguments and in a specific folder, for example:

```json
{
"name": "dev-azd (launch)",
"type": "go",
"request": "launch",
"mode": "debug",
"program": "${workspaceFolder}",
"args": [
"restore"
],
"cwd": "/Users/karolz/code/scratch/azd-devel/src/api"
},
```

## Testing

We use `go test`. The `functional` package contains end to end tests that run `azd` and deploy live resources. You need to ensure you have run `go build` to
build a copy of `azd` at the root of the repository. The tests look for that binary. We hope to improve this. Use the `-run` flag of `go test` to filter tests,
as usual. You'll want to pass a larger `-timeout` since these tests deploy live resources.

### Run all the tests

`go test -timeout 15m -v ./...`

### Run a specific test

`go test -timeout 15m -v ./... -run Test_CLI_RestoreCommand`

## Linting

Run `golangci-lint run ./...`

> On Windows you may need to add `C:\Program Files\Git\usr\bin` to `%PATH%`
## Spell checking

Install [cspell](https://cspell.org/) and then run `cspell lint "**/*.go" --relative --config ./.vscode/cspell.yaml`
9 changes: 9 additions & 0 deletions cli/azd/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Azure Developer CLI (azd)

## VS Code

Install Go extension https://marketplace.visualstudio.com/items?itemName=golang.Go

## Contribute

See [CONTRIBUTING.md] for information on contributing.
5 changes: 5 additions & 0 deletions cli/azd/ci-build.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
param(
[string] $Version,
[string] $SourceVersion
)
go build -ldflags="-X 'github.com/azure/azure-dev/cli/azd/internal.Version=$Version (commit $SourceVersion)'"
Loading

0 comments on commit 3c6e5d7

Please sign in to comment.